@ebarooni/capacitor-calendar 8.2.0 → 8.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +219 -93
  2. package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +42 -7
  3. package/android/src/main/java/dev/barooni/capacitor/calendar/PluginError.kt +33 -19
  4. package/android/src/main/java/dev/barooni/capacitor/calendar/implementation/CapacitorCalendar.kt +88 -21
  5. package/android/src/main/java/dev/barooni/capacitor/calendar/models/data/EventDeleteInfo.kt +8 -0
  6. package/android/src/main/java/dev/barooni/capacitor/calendar/models/enums/EventSpan.kt +13 -0
  7. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CheckPermissionInput.kt +0 -4
  8. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateCalendarInput.kt +3 -1
  9. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteCalendarInput.kt +4 -1
  10. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteEventInput.kt +4 -1
  11. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteEventWithPromptInput.kt +4 -1
  12. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteEventsByIdInput.kt +2 -0
  13. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/GetDefaultCalendarInput.kt +9 -0
  14. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyCalendarInput.kt +10 -1
  15. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/RequestPermissionInput.kt +3 -5
  16. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/CheckAllPermissionsResult.kt +3 -2
  17. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/RequestAllPermissionsResult.kt +1 -1
  18. package/android/src/main/java/dev/barooni/capacitor/calendar/models/templates/PluginCompletion.kt +8 -0
  19. package/android/src/main/java/dev/barooni/capacitor/calendar/utils/ImplementationHelper.kt +340 -35
  20. package/dist/docs.json +616 -88
  21. package/dist/esm/index.d.ts +8 -1
  22. package/dist/esm/index.js.map +1 -1
  23. package/dist/esm/schemas/enums/calendar-permission-scope.d.ts +8 -0
  24. package/dist/esm/schemas/enums/calendar-permission-scope.js +8 -0
  25. package/dist/esm/schemas/enums/calendar-permission-scope.js.map +1 -1
  26. package/dist/esm/schemas/enums/event-span.d.ts +4 -0
  27. package/dist/esm/schemas/enums/event-span.js +4 -0
  28. package/dist/esm/schemas/enums/event-span.js.map +1 -1
  29. package/dist/esm/schemas/interfaces/calendar-source.d.ts +3 -0
  30. package/dist/esm/schemas/interfaces/calendar-source.js.map +1 -1
  31. package/dist/esm/schemas/interfaces/calendar.d.ts +12 -2
  32. package/dist/esm/schemas/interfaces/calendar.js.map +1 -1
  33. package/dist/esm/schemas/interfaces/check-permission-options.d.ts +19 -0
  34. package/dist/esm/schemas/interfaces/check-permission-options.js +2 -0
  35. package/dist/esm/schemas/interfaces/check-permission-options.js.map +1 -0
  36. package/dist/esm/schemas/interfaces/create-calendar-options.d.ts +16 -5
  37. package/dist/esm/schemas/interfaces/create-calendar-options.js.map +1 -1
  38. package/dist/esm/schemas/interfaces/create-calendar-result.d.ts +12 -0
  39. package/dist/esm/schemas/interfaces/create-calendar-result.js +2 -0
  40. package/dist/esm/schemas/interfaces/create-calendar-result.js.map +1 -0
  41. package/dist/esm/schemas/interfaces/delete-calendar-options.d.ts +1 -0
  42. package/dist/esm/schemas/interfaces/delete-calendar-options.js.map +1 -1
  43. package/dist/esm/schemas/interfaces/delete-event-options.d.ts +28 -3
  44. package/dist/esm/schemas/interfaces/delete-event-options.js.map +1 -1
  45. package/dist/esm/schemas/interfaces/delete-event-with-prompt-options.d.ts +38 -13
  46. package/dist/esm/schemas/interfaces/delete-event-with-prompt-options.js.map +1 -1
  47. package/dist/esm/schemas/interfaces/delete-events-by-id-options.d.ts +15 -3
  48. package/dist/esm/schemas/interfaces/delete-events-by-id-options.js.map +1 -1
  49. package/dist/esm/schemas/interfaces/fetch-all-calendar-sources-result.d.ts +13 -0
  50. package/dist/esm/schemas/interfaces/fetch-all-calendar-sources-result.js +2 -0
  51. package/dist/esm/schemas/interfaces/fetch-all-calendar-sources-result.js.map +1 -0
  52. package/dist/esm/schemas/interfaces/get-default-calendar-options.d.ts +13 -0
  53. package/dist/esm/schemas/interfaces/get-default-calendar-options.js +2 -0
  54. package/dist/esm/schemas/interfaces/get-default-calendar-options.js.map +1 -0
  55. package/dist/esm/schemas/interfaces/list-calendars-result.d.ts +13 -0
  56. package/dist/esm/schemas/interfaces/list-calendars-result.js +2 -0
  57. package/dist/esm/schemas/interfaces/list-calendars-result.js.map +1 -0
  58. package/dist/esm/schemas/interfaces/list-events-in-range-options.d.ts +7 -2
  59. package/dist/esm/schemas/interfaces/list-events-in-range-options.js.map +1 -1
  60. package/dist/esm/schemas/interfaces/modify-calendar-options.d.ts +8 -1
  61. package/dist/esm/schemas/interfaces/modify-calendar-options.js.map +1 -1
  62. package/dist/esm/schemas/interfaces/open-calendar-options.d.ts +5 -1
  63. package/dist/esm/schemas/interfaces/open-calendar-options.js.map +1 -1
  64. package/dist/esm/schemas/interfaces/request-permission-options.d.ts +16 -0
  65. package/dist/esm/schemas/interfaces/request-permission-options.js +2 -0
  66. package/dist/esm/schemas/interfaces/request-permission-options.js.map +1 -0
  67. package/dist/esm/schemas/interfaces/select-calendars-with-prompt-result.d.ts +14 -0
  68. package/dist/esm/schemas/interfaces/select-calendars-with-prompt-result.js +2 -0
  69. package/dist/esm/schemas/interfaces/select-calendars-with-prompt-result.js.map +1 -0
  70. package/dist/esm/sub-definitions/calendar-access.d.ts +22 -10
  71. package/dist/esm/sub-definitions/calendar-access.js.map +1 -1
  72. package/dist/esm/sub-definitions/calendar-operations.d.ts +62 -15
  73. package/dist/esm/sub-definitions/calendar-operations.js.map +1 -1
  74. package/dist/esm/sub-definitions/event-operations.d.ts +15 -1
  75. package/dist/esm/sub-definitions/event-operations.js.map +1 -1
  76. package/dist/esm/sub-definitions/reminders-access.d.ts +4 -0
  77. package/dist/esm/sub-definitions/reminders-access.js.map +1 -1
  78. package/dist/esm/web.d.ts +15 -21
  79. package/dist/esm/web.js +1 -1
  80. package/dist/esm/web.js.map +1 -1
  81. package/dist/plugin.cjs.js +13 -1
  82. package/dist/plugin.cjs.js.map +1 -1
  83. package/dist/plugin.js +13 -1
  84. package/dist/plugin.js.map +1 -1
  85. package/ios/Plugin/CapacitorCalendarPlugin.swift +19 -16
  86. package/ios/Plugin/Implementation/CapacitorCalendar.swift +67 -37
  87. package/ios/Plugin/Models/Enums/EventSpan.swift +8 -0
  88. package/ios/Plugin/Models/Inputs/CreateCalendarInput.swift +4 -5
  89. package/ios/Plugin/Models/Inputs/DeleteCalendarInput.swift +1 -1
  90. package/ios/Plugin/Models/Inputs/DeleteEventInput.swift +9 -4
  91. package/ios/Plugin/Models/Inputs/DeleteEventWithPromptInput.swift +9 -4
  92. package/ios/Plugin/Models/Inputs/DeleteEventsByIdInput.swift +9 -4
  93. package/ios/Plugin/Models/Inputs/GetDefaultCalendarInput.swift +13 -0
  94. package/ios/Plugin/Models/Inputs/ModifyCalendarInput.swift +4 -1
  95. package/ios/Plugin/PluginError.swift +68 -56
  96. package/ios/Plugin/Utils/ImplementationHelper.swift +22 -14
  97. package/package.json +1 -1
@@ -0,0 +1,13 @@
1
+ import type { Calendar } from './calendar';
2
+ /**
3
+ * @since 8.4.0
4
+ */
5
+ export interface ListCalendarsResult {
6
+ /**
7
+ * All available calendars.
8
+ *
9
+ * @platform Android, iOS
10
+ * @since 8.4.0
11
+ */
12
+ result: Calendar[];
13
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=list-calendars-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-calendars-result.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/list-calendars-result.ts"],"names":[],"mappings":"","sourcesContent":["import type { Calendar } from './calendar';\n\n/**\n * @since 8.4.0\n */\nexport interface ListCalendarsResult {\n /**\n * All available calendars.\n *\n * @platform Android, iOS\n * @since 8.4.0\n */\n result: Calendar[];\n}\n"]}
@@ -3,14 +3,19 @@
3
3
  */
4
4
  export interface ListEventsInRangeOptions {
5
5
  /**
6
- * The timestamp in milliseconds.
6
+ * The start of the range, in milliseconds since the epoch.
7
+ * Events still in progress at this time are included.
7
8
  *
9
+ * @example 1719792000000
8
10
  * @since 7.1.0
9
11
  */
10
12
  from: number;
11
13
  /**
12
- * The timestamp in milliseconds.
14
+ * The end of the range, in milliseconds since the epoch.
15
+ * Events that begin at or after this time are typically excluded; prefer the
16
+ * next day's start when querying a single calendar day.
13
17
  *
18
+ * @example 1719878400000
14
19
  * @since 7.1.0
15
20
  */
16
21
  to: number;
@@ -1 +1 @@
1
- {"version":3,"file":"list-events-in-range-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/list-events-in-range-options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @since 7.1.0\n */\nexport interface ListEventsInRangeOptions {\n /**\n * The timestamp in milliseconds.\n *\n * @since 7.1.0\n */\n from: number;\n /**\n * The timestamp in milliseconds.\n *\n * @since 7.1.0\n */\n to: number;\n}\n"]}
1
+ {"version":3,"file":"list-events-in-range-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/list-events-in-range-options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @since 7.1.0\n */\nexport interface ListEventsInRangeOptions {\n /**\n * The start of the range, in milliseconds since the epoch.\n * Events still in progress at this time are included.\n *\n * @example 1719792000000\n * @since 7.1.0\n */\n from: number;\n /**\n * The end of the range, in milliseconds since the epoch.\n * Events that begin at or after this time are typically excluded; prefer the\n * next day's start when querying a single calendar day.\n *\n * @example 1719878400000\n * @since 7.1.0\n */\n to: number;\n}\n"]}
@@ -8,13 +8,20 @@ export interface ModifyCalendarOptions {
8
8
  */
9
9
  id: string;
10
10
  /**
11
+ * Display title of the calendar.
12
+ *
13
+ * On Android this updates both `CALENDAR_DISPLAY_NAME` (`title`) and
14
+ * `Calendars.NAME` (`internalTitle`).
15
+ *
11
16
  * @platform Android, iOS
12
17
  * @since 7.2.0
13
18
  */
14
19
  title?: string;
15
20
  /**
21
+ * The color of the calendar as `#RRGGBB` or `#RRGGBBAA`.
22
+ *
16
23
  * @platform Android, iOS
17
- * @example #0000FF
24
+ * @example #007AFF
18
25
  * @since 7.2.0
19
26
  */
20
27
  color?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"modify-calendar-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/modify-calendar-options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @since 7.2.0\n */\nexport interface ModifyCalendarOptions {\n /**\n * @platform Android, iOS\n * @since 7.2.0\n */\n id: string;\n /**\n * @platform Android, iOS\n * @since 7.2.0\n */\n title?: string;\n /**\n * @platform Android, iOS\n * @example #0000FF\n * @since 7.2.0\n */\n color?: string;\n}\n"]}
1
+ {"version":3,"file":"modify-calendar-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/modify-calendar-options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @since 7.2.0\n */\nexport interface ModifyCalendarOptions {\n /**\n * @platform Android, iOS\n * @since 7.2.0\n */\n id: string;\n /**\n * Display title of the calendar.\n *\n * On Android this updates both `CALENDAR_DISPLAY_NAME` (`title`) and\n * `Calendars.NAME` (`internalTitle`).\n *\n * @platform Android, iOS\n * @since 7.2.0\n */\n title?: string;\n /**\n * The color of the calendar as `#RRGGBB` or `#RRGGBBAA`.\n *\n * @platform Android, iOS\n * @example #007AFF\n * @since 7.2.0\n */\n color?: string;\n}\n"]}
@@ -3,8 +3,12 @@
3
3
  */
4
4
  export interface OpenCalendarOptions {
5
5
  /**
6
+ * The date to open the calendar at, in milliseconds since the epoch.
7
+ *
8
+ * @example Date.now()
6
9
  * @default Date.now()
10
+ * @platform Android, iOS
7
11
  * @since 7.1.0
8
12
  */
9
- date: number;
13
+ date?: number;
10
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"open-calendar-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/open-calendar-options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @since 7.1.0\n */\nexport interface OpenCalendarOptions {\n /**\n * @default Date.now()\n * @since 7.1.0\n */\n date: number;\n}\n"]}
1
+ {"version":3,"file":"open-calendar-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/open-calendar-options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @since 7.1.0\n */\nexport interface OpenCalendarOptions {\n /**\n * The date to open the calendar at, in milliseconds since the epoch.\n *\n * @example Date.now()\n * @default Date.now()\n * @platform Android, iOS\n * @since 7.1.0\n */\n date?: number;\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import type { CalendarPermissionScope } from '../enums/calendar-permission-scope';
2
+ /**
3
+ * Options for {@link CalendarAccess#requestPermission}.
4
+ *
5
+ * @since 8.3.1
6
+ */
7
+ export interface RequestPermissionOptions {
8
+ /**
9
+ * The permission scope to request.
10
+ *
11
+ * @example CalendarPermissionScope.READ_CALENDAR
12
+ * @platform Android, iOS
13
+ * @since 8.3.1
14
+ */
15
+ scope: CalendarPermissionScope;
16
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=request-permission-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-permission-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/request-permission-options.ts"],"names":[],"mappings":"","sourcesContent":["import type { CalendarPermissionScope } from '../enums/calendar-permission-scope';\n\n/**\n * Options for {@link CalendarAccess#requestPermission}.\n *\n * @since 8.3.1\n */\nexport interface RequestPermissionOptions {\n /**\n * The permission scope to request.\n *\n * @example CalendarPermissionScope.READ_CALENDAR\n * @platform Android, iOS\n * @since 8.3.1\n */\n scope: CalendarPermissionScope;\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import type { Calendar } from './calendar';
2
+ /**
3
+ * @since 8.4.0
4
+ */
5
+ export interface SelectCalendarsWithPromptResult {
6
+ /**
7
+ * Calendars the user confirmed in the chooser.
8
+ * Empty when the user cancels.
9
+ *
10
+ * @platform iOS
11
+ * @since 8.4.0
12
+ */
13
+ result: Calendar[];
14
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=select-calendars-with-prompt-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-calendars-with-prompt-result.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/select-calendars-with-prompt-result.ts"],"names":[],"mappings":"","sourcesContent":["import type { Calendar } from './calendar';\n\n/**\n * @since 8.4.0\n */\nexport interface SelectCalendarsWithPromptResult {\n /**\n * Calendars the user confirmed in the chooser.\n * Empty when the user cancels.\n *\n * @platform iOS\n * @since 8.4.0\n */\n result: Calendar[];\n}\n"]}
@@ -1,26 +1,33 @@
1
1
  import type { PermissionState } from '@capacitor/core';
2
2
  import type { CalendarPermissionScope } from '../schemas/enums/calendar-permission-scope';
3
+ import type { CheckPermissionOptions } from '../schemas/interfaces/check-permission-options';
4
+ import type { RequestPermissionOptions } from '../schemas/interfaces/request-permission-options';
3
5
  /**
4
6
  * @since 7.1.0
5
7
  */
6
8
  export interface CalendarAccess {
7
9
  /**
8
10
  * Retrieves the current permission state for a given scope.
11
+ * On Android, `readReminders` and `writeReminders` resolve to `"prompt"`.
9
12
  *
10
13
  * @example
11
14
  * CapacitorCalendar.checkPermission({ scope: CalendarPermissionScope.READ_CALENDAR });
12
15
  *
16
+ * @throws {Error} `Scope must be provided.` — when `scope` is missing.
17
+ * @throws {Error} `Invalid scope.` — when `scope` is invalid.
18
+ * @throws {Error} `Unhandled permission state.` — when the native status cannot be mapped.
19
+ *
13
20
  * @platform Android, iOS
14
21
  * @since 0.1.0
15
- *
16
22
  */
17
- checkPermission(options: {
18
- scope: CalendarPermissionScope;
19
- }): Promise<{
23
+ checkPermission(options: CheckPermissionOptions): Promise<{
20
24
  result: PermissionState;
21
25
  }>;
22
26
  /**
23
27
  * Retrieves the current state of all permissions.
28
+ * On Android, reminder keys always resolve to `"prompt"`.
29
+ *
30
+ * @throws {Error} `Unhandled permission state.` — when a native status cannot be mapped.
24
31
  *
25
32
  * @platform Android, iOS
26
33
  * @since 0.1.0
@@ -30,23 +37,28 @@ export interface CalendarAccess {
30
37
  }>;
31
38
  /**
32
39
  * Requests permission for a given scope.
40
+ * On Android, `readReminders` and `writeReminders` reject with `Invalid scope.`
33
41
  *
34
42
  * @example
35
- * this.requestPermission({ scope: CalendarPermissionScope.READ_CALENDAR });
43
+ * CapacitorCalendar.requestPermission({ scope: CalendarPermissionScope.READ_CALENDAR });
44
+ *
45
+ * @throws {Error} `Scope must be provided.` — when `scope` is missing.
46
+ * @throws {Error} `Invalid scope.` — when `scope` is invalid, or a reminders scope on Android.
36
47
  *
37
- * @deprecated Use {@link requestWriteOnlyCalendarAccess}, {@link requestReadOnlyCalendarAccess},
38
- * {@link requestFullCalendarAccess} or {@link requestFullRemindersAccess} instead.
48
+ * @deprecated Use {@link requestWriteOnlyCalendarAccess},
49
+ * {@link requestReadOnlyCalendarAccess} (Android),
50
+ * {@link requestFullCalendarAccess} (also for read on iOS),
51
+ * or {@link requestFullRemindersAccess} instead.
39
52
  *
40
53
  * @platform Android, iOS
41
54
  * @since 0.1.0
42
55
  */
43
- requestPermission(options: {
44
- scope: CalendarPermissionScope;
45
- }): Promise<{
56
+ requestPermission(options: RequestPermissionOptions): Promise<{
46
57
  result: PermissionState;
47
58
  }>;
48
59
  /**
49
60
  * Requests permission for all calendar and reminder permissions.
61
+ * On Android, only calendar permissions are requested; reminder keys stay `"prompt"`.
50
62
  *
51
63
  * @deprecated Use {@link requestFullCalendarAccess} or {@link requestFullRemindersAccess} instead.
52
64
  * @platform Android, iOS
@@ -1 +1 @@
1
- {"version":3,"file":"calendar-access.js","sourceRoot":"","sources":["../../../src/sub-definitions/calendar-access.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nimport type { CalendarPermissionScope } from '../schemas/enums/calendar-permission-scope';\n\n/**\n * @since 7.1.0\n */\nexport interface CalendarAccess {\n /**\n * Retrieves the current permission state for a given scope.\n *\n * @example\n * CapacitorCalendar.checkPermission({ scope: CalendarPermissionScope.READ_CALENDAR });\n *\n * @platform Android, iOS\n * @since 0.1.0\n *\n */\n checkPermission(options: { scope: CalendarPermissionScope }): Promise<{ result: PermissionState }>;\n\n /**\n * Retrieves the current state of all permissions.\n *\n * @platform Android, iOS\n * @since 0.1.0\n */\n checkAllPermissions(): Promise<{ result: CheckAllPermissionsResult }>;\n\n /**\n * Requests permission for a given scope.\n *\n * @example\n * this.requestPermission({ scope: CalendarPermissionScope.READ_CALENDAR });\n *\n * @deprecated Use {@link requestWriteOnlyCalendarAccess}, {@link requestReadOnlyCalendarAccess},\n * {@link requestFullCalendarAccess} or {@link requestFullRemindersAccess} instead.\n *\n * @platform Android, iOS\n * @since 0.1.0\n */\n requestPermission(options: { scope: CalendarPermissionScope }): Promise<{ result: PermissionState }>;\n\n /**\n * Requests permission for all calendar and reminder permissions.\n *\n * @deprecated Use {@link requestFullCalendarAccess} or {@link requestFullRemindersAccess} instead.\n * @platform Android, iOS\n * @since 0.1.0\n */\n requestAllPermissions(): Promise<{ result: RequestAllPermissionsResult }>;\n\n /**\n * Requests write access to the calendar.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | iOS 17+ | `NSCalendarsWriteOnlyAccessUsageDescription` |\n * | iOS 13-16 | `NSCalendarsUsageDescription` |\n * | Android | `android.permission.WRITE_CALENDAR` |\n *\n * @platform Android, iOS\n * @since 5.4.0\n */\n requestWriteOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read access to the calendar.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | Android | `android.permission.READ_CALENDAR` |\n *\n * @platform Android\n * @since 5.4.0\n */\n requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read and write access to the calendar.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | iOS 17+ | `NSCalendarsFullAccessUsageDescription` |\n * | iOS 13-16 | `NSCalendarsUsageDescription` |\n * | Android | `android.permission.READ_CALENDAR` & `android.permission.WRITE_CALENDAR` |\n *\n * @platform Android, iOS\n * @since 5.4.0\n */\n requestFullCalendarAccess(): Promise<{ result: PermissionState }>;\n}\n\n/**\n * @platform Android, iOS\n * @since 7.1.0\n */\nexport type CheckAllPermissionsResult = Record<CalendarPermissionScope, PermissionState>;\n\n/**\n * @platform Android, iOS\n * @since 7.1.0\n */\nexport type RequestAllPermissionsResult = CheckAllPermissionsResult;\n"]}
1
+ {"version":3,"file":"calendar-access.js","sourceRoot":"","sources":["../../../src/sub-definitions/calendar-access.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nimport type { CalendarPermissionScope } from '../schemas/enums/calendar-permission-scope';\nimport type { CheckPermissionOptions } from '../schemas/interfaces/check-permission-options';\nimport type { RequestPermissionOptions } from '../schemas/interfaces/request-permission-options';\n\n/**\n * @since 7.1.0\n */\nexport interface CalendarAccess {\n /**\n * Retrieves the current permission state for a given scope.\n * On Android, `readReminders` and `writeReminders` resolve to `\"prompt\"`.\n *\n * @example\n * CapacitorCalendar.checkPermission({ scope: CalendarPermissionScope.READ_CALENDAR });\n *\n * @throws {Error} `Scope must be provided.` — when `scope` is missing.\n * @throws {Error} `Invalid scope.` — when `scope` is invalid.\n * @throws {Error} `Unhandled permission state.` — when the native status cannot be mapped.\n *\n * @platform Android, iOS\n * @since 0.1.0\n */\n checkPermission(options: CheckPermissionOptions): Promise<{ result: PermissionState }>;\n\n /**\n * Retrieves the current state of all permissions.\n * On Android, reminder keys always resolve to `\"prompt\"`.\n *\n * @throws {Error} `Unhandled permission state.` — when a native status cannot be mapped.\n *\n * @platform Android, iOS\n * @since 0.1.0\n */\n checkAllPermissions(): Promise<{ result: CheckAllPermissionsResult }>;\n\n /**\n * Requests permission for a given scope.\n * On Android, `readReminders` and `writeReminders` reject with `Invalid scope.`\n *\n * @example\n * CapacitorCalendar.requestPermission({ scope: CalendarPermissionScope.READ_CALENDAR });\n *\n * @throws {Error} `Scope must be provided.` — when `scope` is missing.\n * @throws {Error} `Invalid scope.` — when `scope` is invalid, or a reminders scope on Android.\n *\n * @deprecated Use {@link requestWriteOnlyCalendarAccess},\n * {@link requestReadOnlyCalendarAccess} (Android),\n * {@link requestFullCalendarAccess} (also for read on iOS),\n * or {@link requestFullRemindersAccess} instead.\n *\n * @platform Android, iOS\n * @since 0.1.0\n */\n requestPermission(options: RequestPermissionOptions): Promise<{ result: PermissionState }>;\n\n /**\n * Requests permission for all calendar and reminder permissions.\n * On Android, only calendar permissions are requested; reminder keys stay `\"prompt\"`.\n *\n * @deprecated Use {@link requestFullCalendarAccess} or {@link requestFullRemindersAccess} instead.\n * @platform Android, iOS\n * @since 0.1.0\n */\n requestAllPermissions(): Promise<{ result: RequestAllPermissionsResult }>;\n\n /**\n * Requests write access to the calendar.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | iOS 17+ | `NSCalendarsWriteOnlyAccessUsageDescription` |\n * | iOS 13-16 | `NSCalendarsUsageDescription` |\n * | Android | `android.permission.WRITE_CALENDAR` |\n *\n * @platform Android, iOS\n * @since 5.4.0\n */\n requestWriteOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read access to the calendar.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | Android | `android.permission.READ_CALENDAR` |\n *\n * @platform Android\n * @since 5.4.0\n */\n requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read and write access to the calendar.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | iOS 17+ | `NSCalendarsFullAccessUsageDescription` |\n * | iOS 13-16 | `NSCalendarsUsageDescription` |\n * | Android | `android.permission.READ_CALENDAR` & `android.permission.WRITE_CALENDAR` |\n *\n * @platform Android, iOS\n * @since 5.4.0\n */\n requestFullCalendarAccess(): Promise<{ result: PermissionState }>;\n}\n\n/**\n * @platform Android, iOS\n * @since 7.1.0\n */\nexport type CheckAllPermissionsResult = Record<CalendarPermissionScope, PermissionState>;\n\n/**\n * @platform Android, iOS\n * @since 7.1.0\n */\nexport type RequestAllPermissionsResult = CheckAllPermissionsResult;\n"]}
@@ -1,13 +1,17 @@
1
1
  import type { Calendar } from '../schemas/interfaces/calendar';
2
- import type { CalendarSource } from '../schemas/interfaces/calendar-source';
3
2
  import type { CreateCalendarOptions } from '../schemas/interfaces/create-calendar-options';
3
+ import type { CreateCalendarResult } from '../schemas/interfaces/create-calendar-result';
4
4
  import type { DeleteCalendarOptions } from '../schemas/interfaces/delete-calendar-options';
5
+ import type { FetchAllCalendarSourcesResult } from '../schemas/interfaces/fetch-all-calendar-sources-result';
6
+ import type { GetDefaultCalendarOptions } from '../schemas/interfaces/get-default-calendar-options';
7
+ import type { ListCalendarsResult } from '../schemas/interfaces/list-calendars-result';
5
8
  import type { ModifyCalendarOptions } from '../schemas/interfaces/modify-calendar-options';
6
9
  import type { OpenCalendarOptions } from '../schemas/interfaces/open-calendar-options';
7
10
  import type { SelectCalendarsWithPromptOptions } from '../schemas/interfaces/select-calendars-with-prompt-options';
11
+ import type { SelectCalendarsWithPromptResult } from '../schemas/interfaces/select-calendars-with-prompt-result';
8
12
  export interface CalendarOperations {
9
13
  /**
10
- * Save the changes to the calendar.
14
+ * Saves pending calendar changes.
11
15
  *
12
16
  * @platform iOS
13
17
  * @since 7.1.0
@@ -16,37 +20,54 @@ export interface CalendarOperations {
16
20
  /**
17
21
  * Opens a system interface to choose one or multiple calendars.
18
22
  *
23
+ * Calendar access is expected. Call `requestFullCalendarAccess()` first.
24
+ * Without authorization the chooser can look empty.
25
+ *
26
+ * On confirm, `result` contains the calendars the user selected.
27
+ * On cancel, `result` is an empty array.
28
+ *
29
+ * If a chooser is already presented, a new call is rejected; the in-flight
30
+ * call continues until the user confirms or cancels.
31
+ *
19
32
  * @platform iOS
20
33
  * @since 0.2.0
21
34
  */
22
- selectCalendarsWithPrompt(options?: SelectCalendarsWithPromptOptions): Promise<{
23
- result: Calendar[];
24
- }>;
35
+ selectCalendarsWithPrompt(options?: SelectCalendarsWithPromptOptions): Promise<SelectCalendarsWithPromptResult>;
25
36
  /**
26
37
  * Retrieves a list of calendar sources.
27
38
  *
39
+ * Requires calendar access. Without authorization, `result` is typically
40
+ * an empty array. This method does not reject solely for missing permission.
41
+ *
28
42
  * @platform iOS
29
43
  * @since 6.6.0
30
44
  */
31
- fetchAllCalendarSources(): Promise<{
32
- result: CalendarSource[];
33
- }>;
45
+ fetchAllCalendarSources(): Promise<FetchAllCalendarSourcesResult>;
34
46
  /**
35
47
  * Retrieves a list of all available calendars.
36
48
  *
49
+ * Requires calendar read access. On Android, missing permission typically
50
+ * rejects. On iOS, missing authorization typically returns an empty `result`.
51
+ *
37
52
  * @platform Android, iOS
38
53
  * @since 7.1.0
39
54
  */
40
- listCalendars(): Promise<{
41
- result: Calendar[];
42
- }>;
55
+ listCalendars(): Promise<ListCalendarsResult>;
43
56
  /**
44
57
  * Retrieves the default calendar.
45
58
  *
59
+ * Requires calendar read access. On Android, missing permission typically
60
+ * rejects. On iOS, missing authorization typically yields `result: null`.
61
+ *
62
+ * The system default is the primary calendar on Android and
63
+ * `defaultCalendarForNewEvents` on iOS. When neither exists and
64
+ * `useFallbackCalendar` is true, the first available calendar is returned.
65
+ * Otherwise the method returns `null` when there is no system default.
66
+ *
46
67
  * @platform Android, iOS
47
68
  * @since 0.3.0
48
69
  */
49
- getDefaultCalendar(): Promise<{
70
+ getDefaultCalendar(options?: GetDefaultCalendarOptions): Promise<{
50
71
  result: Calendar | null;
51
72
  }>;
52
73
  /**
@@ -62,15 +83,34 @@ export interface CalendarOperations {
62
83
  /**
63
84
  * Creates a calendar.
64
85
  *
86
+ * `title` is required. `color` is optional and defaults to `#007AFF`.
87
+ * On Android, `accountName` and `ownerAccount` are required at runtime.
88
+ *
89
+ * @example
90
+ * CapacitorCalendar.createCalendar({
91
+ * title: 'Work',
92
+ * accountName: 'plugin@example.com',
93
+ * ownerAccount: 'plugin@example.com',
94
+ * });
95
+ *
96
+ * @throws {Error} `Title must be provided.` — when `title` is missing.
97
+ * @throws {Error} `Invalid color format.` — when `color` is present but invalid.
98
+ * @throws {Error} `Account name must be provided.` — when `accountName` is missing on Android.
99
+ * @throws {Error} `Owner account must be provided.` — when `ownerAccount` is missing on Android.
100
+ * @throws {Error} `Calendar source not found.` — when `sourceId` is set and no EventKit source matches (iOS).
101
+ * @throws {Error} `Failed to retrieve calendar ID.` — when the calendar is created but no id is returned.
102
+ *
65
103
  * @platform Android, iOS
66
104
  * @since 5.2.0
67
105
  */
68
- createCalendar(options: CreateCalendarOptions): Promise<{
69
- id: string;
70
- }>;
106
+ createCalendar(options: CreateCalendarOptions): Promise<CreateCalendarResult>;
71
107
  /**
72
108
  * Deletes a calendar by id.
73
109
  *
110
+ * @throws {Error} `Calendar ID must be provided.` — when `id` is missing.
111
+ * @throws {Error} `Invalid calendar ID.` — when `id` is not a numeric Android calendar id.
112
+ * @throws {Error} `Calendar not found.` — when no calendar exists for `id`.
113
+ *
74
114
  * @platform Android, iOS
75
115
  * @since 5.2.0
76
116
  */
@@ -78,6 +118,13 @@ export interface CalendarOperations {
78
118
  /**
79
119
  * Modifies a calendar with options.
80
120
  *
121
+ * @throws {Error} `Calendar ID must be provided.` — when `id` is missing.
122
+ * @throws {Error} `Invalid calendar ID.` — when `id` is not a numeric Android calendar id.
123
+ * @throws {Error} `At least one of title or color must be provided.` — when both are omitted.
124
+ * @throws {Error} `Invalid color format.` — when `color` is present but invalid.
125
+ * @throws {Error} `Calendar not found.` — when no calendar exists for `id`.
126
+ * @throws {Error} `Calendar is not modifiable.` — when the calendar cannot be modified (iOS).
127
+ *
81
128
  * @platform Android, iOS
82
129
  * @since 7.2.0
83
130
  */
@@ -1 +1 @@
1
- {"version":3,"file":"calendar-operations.js","sourceRoot":"","sources":["../../../src/sub-definitions/calendar-operations.ts"],"names":[],"mappings":"","sourcesContent":["import type { Calendar } from '../schemas/interfaces/calendar';\nimport type { CalendarSource } from '../schemas/interfaces/calendar-source';\nimport type { CreateCalendarOptions } from '../schemas/interfaces/create-calendar-options';\nimport type { DeleteCalendarOptions } from '../schemas/interfaces/delete-calendar-options';\nimport type { ModifyCalendarOptions } from '../schemas/interfaces/modify-calendar-options';\nimport type { OpenCalendarOptions } from '../schemas/interfaces/open-calendar-options';\nimport type { SelectCalendarsWithPromptOptions } from '../schemas/interfaces/select-calendars-with-prompt-options';\n\nexport interface CalendarOperations {\n /**\n * Save the changes to the calendar.\n *\n * @platform iOS\n * @since 7.1.0\n */\n commit(): Promise<void>;\n /**\n * Opens a system interface to choose one or multiple calendars.\n *\n * @platform iOS\n * @since 0.2.0\n */\n selectCalendarsWithPrompt(options?: SelectCalendarsWithPromptOptions): Promise<{ result: Calendar[] }>;\n /**\n * Retrieves a list of calendar sources.\n *\n * @platform iOS\n * @since 6.6.0\n */\n fetchAllCalendarSources(): Promise<{ result: CalendarSource[] }>;\n /**\n * Retrieves a list of all available calendars.\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n listCalendars(): Promise<{ result: Calendar[] }>;\n /**\n * Retrieves the default calendar.\n *\n * @platform Android, iOS\n * @since 0.3.0\n */\n getDefaultCalendar(): Promise<{ result: Calendar | null }>;\n /**\n * Opens the calendar app.\n *\n * @example\n * CapacitorCalendar.openCalendar({ date: Date.now() });\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n openCalendar(options?: OpenCalendarOptions): Promise<void>;\n /**\n * Creates a calendar.\n *\n * @platform Android, iOS\n * @since 5.2.0\n */\n createCalendar(options: CreateCalendarOptions): Promise<{ id: string }>;\n /**\n * Deletes a calendar by id.\n *\n * @platform Android, iOS\n * @since 5.2.0\n */\n deleteCalendar(options: DeleteCalendarOptions): Promise<void>;\n /**\n * Modifies a calendar with options.\n *\n * @platform Android, iOS\n * @since 7.2.0\n */\n modifyCalendar(options: ModifyCalendarOptions): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"calendar-operations.js","sourceRoot":"","sources":["../../../src/sub-definitions/calendar-operations.ts"],"names":[],"mappings":"","sourcesContent":["import type { Calendar } from '../schemas/interfaces/calendar';\nimport type { CreateCalendarOptions } from '../schemas/interfaces/create-calendar-options';\nimport type { CreateCalendarResult } from '../schemas/interfaces/create-calendar-result';\nimport type { DeleteCalendarOptions } from '../schemas/interfaces/delete-calendar-options';\nimport type { FetchAllCalendarSourcesResult } from '../schemas/interfaces/fetch-all-calendar-sources-result';\nimport type { GetDefaultCalendarOptions } from '../schemas/interfaces/get-default-calendar-options';\nimport type { ListCalendarsResult } from '../schemas/interfaces/list-calendars-result';\nimport type { ModifyCalendarOptions } from '../schemas/interfaces/modify-calendar-options';\nimport type { OpenCalendarOptions } from '../schemas/interfaces/open-calendar-options';\nimport type { SelectCalendarsWithPromptOptions } from '../schemas/interfaces/select-calendars-with-prompt-options';\nimport type { SelectCalendarsWithPromptResult } from '../schemas/interfaces/select-calendars-with-prompt-result';\n\nexport interface CalendarOperations {\n /**\n * Saves pending calendar changes.\n *\n * @platform iOS\n * @since 7.1.0\n */\n commit(): Promise<void>;\n /**\n * Opens a system interface to choose one or multiple calendars.\n *\n * Calendar access is expected. Call `requestFullCalendarAccess()` first.\n * Without authorization the chooser can look empty.\n *\n * On confirm, `result` contains the calendars the user selected.\n * On cancel, `result` is an empty array.\n *\n * If a chooser is already presented, a new call is rejected; the in-flight\n * call continues until the user confirms or cancels.\n *\n * @platform iOS\n * @since 0.2.0\n */\n selectCalendarsWithPrompt(options?: SelectCalendarsWithPromptOptions): Promise<SelectCalendarsWithPromptResult>;\n /**\n * Retrieves a list of calendar sources.\n *\n * Requires calendar access. Without authorization, `result` is typically\n * an empty array. This method does not reject solely for missing permission.\n *\n * @platform iOS\n * @since 6.6.0\n */\n fetchAllCalendarSources(): Promise<FetchAllCalendarSourcesResult>;\n /**\n * Retrieves a list of all available calendars.\n *\n * Requires calendar read access. On Android, missing permission typically\n * rejects. On iOS, missing authorization typically returns an empty `result`.\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n listCalendars(): Promise<ListCalendarsResult>;\n /**\n * Retrieves the default calendar.\n *\n * Requires calendar read access. On Android, missing permission typically\n * rejects. On iOS, missing authorization typically yields `result: null`.\n *\n * The system default is the primary calendar on Android and\n * `defaultCalendarForNewEvents` on iOS. When neither exists and\n * `useFallbackCalendar` is true, the first available calendar is returned.\n * Otherwise the method returns `null` when there is no system default.\n *\n * @platform Android, iOS\n * @since 0.3.0\n */\n getDefaultCalendar(options?: GetDefaultCalendarOptions): Promise<{ result: Calendar | null }>;\n /**\n * Opens the calendar app.\n *\n * @example\n * CapacitorCalendar.openCalendar({ date: Date.now() });\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n openCalendar(options?: OpenCalendarOptions): Promise<void>;\n /**\n * Creates a calendar.\n *\n * `title` is required. `color` is optional and defaults to `#007AFF`.\n * On Android, `accountName` and `ownerAccount` are required at runtime.\n *\n * @example\n * CapacitorCalendar.createCalendar({\n * title: 'Work',\n * accountName: 'plugin@example.com',\n * ownerAccount: 'plugin@example.com',\n * });\n *\n * @throws {Error} `Title must be provided.` — when `title` is missing.\n * @throws {Error} `Invalid color format.` — when `color` is present but invalid.\n * @throws {Error} `Account name must be provided.` — when `accountName` is missing on Android.\n * @throws {Error} `Owner account must be provided.` — when `ownerAccount` is missing on Android.\n * @throws {Error} `Calendar source not found.` — when `sourceId` is set and no EventKit source matches (iOS).\n * @throws {Error} `Failed to retrieve calendar ID.` — when the calendar is created but no id is returned.\n *\n * @platform Android, iOS\n * @since 5.2.0\n */\n createCalendar(options: CreateCalendarOptions): Promise<CreateCalendarResult>;\n /**\n * Deletes a calendar by id.\n *\n * @throws {Error} `Calendar ID must be provided.` — when `id` is missing.\n * @throws {Error} `Invalid calendar ID.` — when `id` is not a numeric Android calendar id.\n * @throws {Error} `Calendar not found.` — when no calendar exists for `id`.\n *\n * @platform Android, iOS\n * @since 5.2.0\n */\n deleteCalendar(options: DeleteCalendarOptions): Promise<void>;\n /**\n * Modifies a calendar with options.\n *\n * @throws {Error} `Calendar ID must be provided.` — when `id` is missing.\n * @throws {Error} `Invalid calendar ID.` — when `id` is not a numeric Android calendar id.\n * @throws {Error} `At least one of title or color must be provided.` — when both are omitted.\n * @throws {Error} `Invalid color format.` — when `color` is present but invalid.\n * @throws {Error} `Calendar not found.` — when no calendar exists for `id`.\n * @throws {Error} `Calendar is not modifiable.` — when the calendar cannot be modified (iOS).\n *\n * @platform Android, iOS\n * @since 7.2.0\n */\n modifyCalendar(options: ModifyCalendarOptions): Promise<void>;\n}\n"]}
@@ -87,7 +87,21 @@ export interface EventOperations {
87
87
  deleted: boolean;
88
88
  }>;
89
89
  /**
90
- * Retrieves the events within a date range.
90
+ * Retrieves events that overlap a date range.
91
+ *
92
+ * An event is included when its time interval intersects `[from, to]`, including
93
+ * multi-day events that span the range without starting or ending inside it.
94
+ *
95
+ * @example
96
+ * const startOfDay = new Date();
97
+ * startOfDay.setHours(0, 0, 0, 0);
98
+ * const startOfNextDay = new Date(startOfDay);
99
+ * startOfNextDay.setDate(startOfNextDay.getDate() + 1);
100
+ *
101
+ * const { result } = await CapacitorCalendar.listEventsInRange({
102
+ * from: startOfDay.getTime(),
103
+ * to: startOfNextDay.getTime(),
104
+ * });
91
105
  *
92
106
  * @platform Android, iOS
93
107
  * @since 0.10.0
@@ -1 +1 @@
1
- {"version":3,"file":"event-operations.js","sourceRoot":"","sources":["../../../src/sub-definitions/event-operations.ts"],"names":[],"mappings":"","sourcesContent":["import type { CalendarEvent } from '../schemas/interfaces/calendar-event';\nimport type { CreateEventOptions } from '../schemas/interfaces/create-event-options';\nimport type { CreateEventWithPromptOptions } from '../schemas/interfaces/create-event-with-prompt-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 { ListEventsInRangeOptions } from '../schemas/interfaces/list-events-in-range-options';\nimport type { ModifyEventOptions } from '../schemas/interfaces/modify-event-options';\nimport type { ModifyEventWithPromptOptions } from '../schemas/interfaces/modify-event-with-prompt-options';\nimport type { EventEditAction } from '../schemas/types/event-edit-action';\n\nexport interface EventOperations {\n /**\n * Opens the system calendar interface to create a new event.\n * On Android always returns `null`.\n * Fetch the events to find the ID of the newly created event.\n *\n * @example\n * const options = {\n * title: 'Test event',\n * startDate: Date.now(),\n * }\n * await CapacitorCalendar.createEventWithPrompt(options)\n *\n * @platform Android, iOS\n * @since 0.1.0\n */\n createEventWithPrompt(options?: CreateEventWithPromptOptions): Promise<{ id: string | null }>;\n /**\n * Opens a system calendar interface to modify an event.\n * On Android always returns `null`.\n *\n * @example\n * const options = {\n * id: 'EVENT_ID',\n * title: 'New title',\n * }\n * await CapacitorCalendar.modifyEventWithPrompt(options);\n *\n * @platform Android, iOS\n * @since 6.6.0\n */\n modifyEventWithPrompt(options: ModifyEventWithPromptOptions): Promise<{ result: EventEditAction | null }>;\n /**\n * Creates an event in the calendar.\n *\n * @platform iOS, Android\n * @since 0.4.0\n */\n createEvent(options: CreateEventOptions): Promise<{ id: string }>;\n /**\n * Modifies an event.\n *\n * @platform Android, iOS\n * @since 6.6.0\n */\n modifyEvent(options: ModifyEventOptions): Promise<void>;\n /**\n * Deletes multiple events.\n *\n * @deprecated Use `deleteEvent(...)`.\n * @platform Android, iOS\n * @since 0.11.0\n */\n deleteEventsById(options: DeleteEventsByIdOptions): Promise<{ result: DeleteEventsByIdResult }>;\n /**\n * Deletes an event.\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n deleteEvent(options: DeleteEventOptions): Promise<void>;\n /**\n * Opens a dialog to delete an event.\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n deleteEventWithPrompt(options: DeleteEventWithPromptOptions): Promise<{ deleted: boolean }>;\n /**\n * Retrieves the events within a date range.\n *\n * @platform Android, iOS\n * @since 0.10.0\n */\n listEventsInRange(options: ListEventsInRangeOptions): Promise<{ result: CalendarEvent[] }>;\n}\n\n/**\n * @since 7.1.0\n */\nexport interface DeleteEventsByIdResult {\n /**\n * @since 7.1.0\n */\n deleted: string[];\n /**\n * @since 7.1.0\n */\n failed: string[];\n}\n"]}
1
+ {"version":3,"file":"event-operations.js","sourceRoot":"","sources":["../../../src/sub-definitions/event-operations.ts"],"names":[],"mappings":"","sourcesContent":["import type { CalendarEvent } from '../schemas/interfaces/calendar-event';\nimport type { CreateEventOptions } from '../schemas/interfaces/create-event-options';\nimport type { CreateEventWithPromptOptions } from '../schemas/interfaces/create-event-with-prompt-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 { ListEventsInRangeOptions } from '../schemas/interfaces/list-events-in-range-options';\nimport type { ModifyEventOptions } from '../schemas/interfaces/modify-event-options';\nimport type { ModifyEventWithPromptOptions } from '../schemas/interfaces/modify-event-with-prompt-options';\nimport type { EventEditAction } from '../schemas/types/event-edit-action';\n\nexport interface EventOperations {\n /**\n * Opens the system calendar interface to create a new event.\n * On Android always returns `null`.\n * Fetch the events to find the ID of the newly created event.\n *\n * @example\n * const options = {\n * title: 'Test event',\n * startDate: Date.now(),\n * }\n * await CapacitorCalendar.createEventWithPrompt(options)\n *\n * @platform Android, iOS\n * @since 0.1.0\n */\n createEventWithPrompt(options?: CreateEventWithPromptOptions): Promise<{ id: string | null }>;\n /**\n * Opens a system calendar interface to modify an event.\n * On Android always returns `null`.\n *\n * @example\n * const options = {\n * id: 'EVENT_ID',\n * title: 'New title',\n * }\n * await CapacitorCalendar.modifyEventWithPrompt(options);\n *\n * @platform Android, iOS\n * @since 6.6.0\n */\n modifyEventWithPrompt(options: ModifyEventWithPromptOptions): Promise<{ result: EventEditAction | null }>;\n /**\n * Creates an event in the calendar.\n *\n * @platform iOS, Android\n * @since 0.4.0\n */\n createEvent(options: CreateEventOptions): Promise<{ id: string }>;\n /**\n * Modifies an event.\n *\n * @platform Android, iOS\n * @since 6.6.0\n */\n modifyEvent(options: ModifyEventOptions): Promise<void>;\n /**\n * Deletes multiple events.\n *\n * @deprecated Use `deleteEvent(...)`.\n * @platform Android, iOS\n * @since 0.11.0\n */\n deleteEventsById(options: DeleteEventsByIdOptions): Promise<{ result: DeleteEventsByIdResult }>;\n /**\n * Deletes an event.\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n deleteEvent(options: DeleteEventOptions): Promise<void>;\n /**\n * Opens a dialog to delete an event.\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n deleteEventWithPrompt(options: DeleteEventWithPromptOptions): Promise<{ deleted: boolean }>;\n /**\n * Retrieves events that overlap a date range.\n *\n * An event is included when its time interval intersects `[from, to]`, including\n * multi-day events that span the range without starting or ending inside it.\n *\n * @example\n * const startOfDay = new Date();\n * startOfDay.setHours(0, 0, 0, 0);\n * const startOfNextDay = new Date(startOfDay);\n * startOfNextDay.setDate(startOfNextDay.getDate() + 1);\n *\n * const { result } = await CapacitorCalendar.listEventsInRange({\n * from: startOfDay.getTime(),\n * to: startOfNextDay.getTime(),\n * });\n *\n * @platform Android, iOS\n * @since 0.10.0\n */\n listEventsInRange(options: ListEventsInRangeOptions): Promise<{ result: CalendarEvent[] }>;\n}\n\n/**\n * @since 7.1.0\n */\nexport interface DeleteEventsByIdResult {\n /**\n * @since 7.1.0\n */\n deleted: string[];\n /**\n * @since 7.1.0\n */\n failed: string[];\n}\n"]}
@@ -5,6 +5,8 @@ import type { PermissionState } from '@capacitor/core';
5
5
  export interface RemindersAccess {
6
6
  /**
7
7
  * Requests read and write access to the reminders.
8
+ * Resolves with `"granted"` or `"denied"` (never `"prompt"`).
9
+ * A grant covers both `readReminders` and `writeReminders`.
8
10
  *
9
11
  * @permissions
10
12
  * | Platform | Required |
@@ -12,6 +14,8 @@ export interface RemindersAccess {
12
14
  * | iOS 17+ | `NSRemindersFullAccessUsageDescription` |
13
15
  * | iOS 10-16 | `NSRemindersUsageDescription` |
14
16
  *
17
+ * @throws {Error} when EventKit fails or required Info.plist keys are missing.
18
+ *
15
19
  * @platform iOS
16
20
  * @see {@link CalendarPermissionScope}
17
21
  * @since 5.4.0
@@ -1 +1 @@
1
- {"version":3,"file":"reminders-access.js","sourceRoot":"","sources":["../../../src/sub-definitions/reminders-access.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\n/**\n * @since 7.1.0\n */\nexport interface RemindersAccess {\n /**\n * Requests read and write access to the reminders.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | iOS 17+ | `NSRemindersFullAccessUsageDescription` |\n * | iOS 10-16 | `NSRemindersUsageDescription` |\n *\n * @platform iOS\n * @see {@link CalendarPermissionScope}\n * @since 5.4.0\n */\n requestFullRemindersAccess(): Promise<{ result: PermissionState }>;\n}\n"]}
1
+ {"version":3,"file":"reminders-access.js","sourceRoot":"","sources":["../../../src/sub-definitions/reminders-access.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\n/**\n * @since 7.1.0\n */\nexport interface RemindersAccess {\n /**\n * Requests read and write access to the reminders.\n * Resolves with `\"granted\"` or `\"denied\"` (never `\"prompt\"`).\n * A grant covers both `readReminders` and `writeReminders`.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | iOS 17+ | `NSRemindersFullAccessUsageDescription` |\n * | iOS 10-16 | `NSRemindersUsageDescription` |\n *\n * @throws {Error} when EventKit fails or required Info.plist keys are missing.\n *\n * @platform iOS\n * @see {@link CalendarPermissionScope}\n * @since 5.4.0\n */\n requestFullRemindersAccess(): Promise<{ result: PermissionState }>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import type { PermissionState } from '@capacitor/core';
2
2
  import { WebPlugin } from '@capacitor/core';
3
3
  import type { CapacitorCalendarPlugin } from './definitions';
4
- import type { CalendarPermissionScope } from './schemas/enums/calendar-permission-scope';
5
4
  import type { Calendar } from './schemas/interfaces/calendar';
6
5
  import type { CalendarEvent } from './schemas/interfaces/calendar-event';
7
6
  import type { CalendarSource } from './schemas/interfaces/calendar-source';
7
+ import type { CheckPermissionOptions } from './schemas/interfaces/check-permission-options';
8
8
  import type { CreateCalendarOptions } from './schemas/interfaces/create-calendar-options';
9
+ import type { CreateCalendarResult } from './schemas/interfaces/create-calendar-result';
9
10
  import type { CreateEventOptions } from './schemas/interfaces/create-event-options';
10
11
  import type { CreateEventWithPromptOptions } from './schemas/interfaces/create-event-with-prompt-options';
11
12
  import type { CreateReminderOptions } from './schemas/interfaces/create-reminder-options';
@@ -19,8 +20,11 @@ import type { DeleteReminderOptions } from './schemas/interfaces/delete-reminder
19
20
  import type { DeleteReminderWithPromptOptions } from './schemas/interfaces/delete-reminder-with-prompt-options';
20
21
  import type { DeleteRemindersByIdOptions } from './schemas/interfaces/delete-reminders-by-id-options';
21
22
  import type { DeleteRemindersListOptions } from './schemas/interfaces/delete-reminders-list-options';
23
+ import type { FetchAllCalendarSourcesResult } from './schemas/interfaces/fetch-all-calendar-sources-result';
24
+ import type { GetDefaultCalendarOptions } from './schemas/interfaces/get-default-calendar-options';
22
25
  import type { GetReminderByIdOptions } from './schemas/interfaces/get-reminder-by-id-options';
23
26
  import type { GetRemindersFromListsOptions } from './schemas/interfaces/get-reminders-from-lists-options';
27
+ import type { ListCalendarsResult } from './schemas/interfaces/list-calendars-result';
24
28
  import type { ListEventsInRangeOptions } from './schemas/interfaces/list-events-in-range-options';
25
29
  import type { ModifyCalendarOptions } from './schemas/interfaces/modify-calendar-options';
26
30
  import type { ModifyEventOptions } from './schemas/interfaces/modify-event-options';
@@ -29,7 +33,9 @@ import type { ModifyReminderOptions } from './schemas/interfaces/modify-reminder
29
33
  import type { OpenCalendarOptions } from './schemas/interfaces/open-calendar-options';
30
34
  import type { Reminder } from './schemas/interfaces/reminder';
31
35
  import type { RemindersList } from './schemas/interfaces/reminders-list';
36
+ import type { RequestPermissionOptions } from './schemas/interfaces/request-permission-options';
32
37
  import type { SelectCalendarsWithPromptOptions } from './schemas/interfaces/select-calendars-with-prompt-options';
38
+ import type { SelectCalendarsWithPromptResult } from './schemas/interfaces/select-calendars-with-prompt-result';
33
39
  import type { UpdateRemindersListOptions } from './schemas/interfaces/update-reminders-list-options';
34
40
  import type { UpdateRemindersListResult } from './schemas/interfaces/update-reminders-list-result';
35
41
  import type { EventEditAction } from './schemas/types/event-edit-action';
@@ -37,17 +43,13 @@ import type { CheckAllPermissionsResult, RequestAllPermissionsResult } from './s
37
43
  import type { DeleteEventsByIdResult } from './sub-definitions/event-operations';
38
44
  import type { DeleteRemindersByIdResult } from './sub-definitions/reminders-operations';
39
45
  export declare class CapacitorCalendarWeb extends WebPlugin implements CapacitorCalendarPlugin {
40
- checkPermission(_options: {
41
- scope: CalendarPermissionScope;
42
- }): Promise<{
46
+ checkPermission(_options: CheckPermissionOptions): Promise<{
43
47
  result: PermissionState;
44
48
  }>;
45
49
  checkAllPermissions(): Promise<{
46
50
  result: CheckAllPermissionsResult;
47
51
  }>;
48
- requestPermission(_options: {
49
- scope: CalendarPermissionScope;
50
- }): Promise<{
52
+ requestPermission(_options: RequestPermissionOptions): Promise<{
51
53
  result: PermissionState;
52
54
  }>;
53
55
  createRemindersList(_options: CreateRemindersListOptions): Promise<CreateRemindersListResult>;
@@ -78,19 +80,13 @@ export declare class CapacitorCalendarWeb extends WebPlugin implements Capacitor
78
80
  }>;
79
81
  commit(): Promise<void>;
80
82
  modifyEvent(_options: ModifyEventOptions): Promise<void>;
81
- selectCalendarsWithPrompt(_options?: SelectCalendarsWithPromptOptions): Promise<{
82
- result: Calendar[];
83
- }>;
84
- fetchAllCalendarSources(): Promise<{
85
- result: CalendarSource[];
86
- }>;
87
- listCalendars(): Promise<{
88
- result: Calendar[];
89
- }>;
83
+ selectCalendarsWithPrompt(_options?: SelectCalendarsWithPromptOptions): Promise<SelectCalendarsWithPromptResult>;
84
+ fetchAllCalendarSources(): Promise<FetchAllCalendarSourcesResult>;
85
+ listCalendars(): Promise<ListCalendarsResult>;
90
86
  fetchAllRemindersSources(): Promise<{
91
87
  result: CalendarSource[];
92
88
  }>;
93
- getDefaultCalendar(): Promise<{
89
+ getDefaultCalendar(_options?: GetDefaultCalendarOptions): Promise<{
94
90
  result: Calendar | null;
95
91
  }>;
96
92
  getDefaultRemindersList(): Promise<{
@@ -100,10 +96,8 @@ export declare class CapacitorCalendarWeb extends WebPlugin implements Capacitor
100
96
  getRemindersLists(): Promise<{
101
97
  result: RemindersList[];
102
98
  }>;
103
- openCalendar(_options: OpenCalendarOptions): Promise<void>;
104
- createCalendar(_options: CreateCalendarOptions): Promise<{
105
- id: string;
106
- }>;
99
+ openCalendar(_options?: OpenCalendarOptions): Promise<void>;
100
+ createCalendar(_options: CreateCalendarOptions): Promise<CreateCalendarResult>;
107
101
  deleteCalendar(_options: DeleteCalendarOptions): Promise<void>;
108
102
  createReminder(_options: CreateReminderOptions): Promise<{
109
103
  id: string;
package/dist/esm/web.js CHANGED
@@ -57,7 +57,7 @@ export class CapacitorCalendarWeb extends WebPlugin {
57
57
  fetchAllRemindersSources() {
58
58
  return this.throwUnimplemented(this.fetchAllRemindersSources.name);
59
59
  }
60
- getDefaultCalendar() {
60
+ getDefaultCalendar(_options) {
61
61
  return this.throwUnimplemented(this.getDefaultCalendar.name);
62
62
  }
63
63
  getDefaultRemindersList() {