@ebarooni/capacitor-calendar 8.4.0 → 8.6.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 (42) hide show
  1. package/README.md +179 -241
  2. package/android/src/main/java/dev/barooni/capacitor/calendar/implementation/CapacitorCalendar.kt +82 -0
  3. package/android/src/main/java/dev/barooni/capacitor/calendar/models/data/CalendarEvent.kt +4 -0
  4. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/CreateEventResult.kt +1 -0
  5. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/ListEventsInRangeResult.kt +4 -0
  6. package/dist/docs.json +380 -156
  7. package/dist/esm/index.d.ts +6 -2
  8. package/dist/esm/index.js +2 -1
  9. package/dist/esm/index.js.map +1 -1
  10. package/dist/esm/schemas/interfaces/calendar-event.d.ts +140 -67
  11. package/dist/esm/schemas/interfaces/calendar-event.js.map +1 -1
  12. package/dist/esm/schemas/interfaces/create-event-options.d.ts +22 -13
  13. package/dist/esm/schemas/interfaces/create-event-options.js.map +1 -1
  14. package/dist/esm/schemas/interfaces/create-event-result.d.ts +24 -0
  15. package/dist/esm/schemas/interfaces/create-event-result.js +2 -0
  16. package/dist/esm/schemas/interfaces/create-event-result.js.map +1 -0
  17. package/dist/esm/schemas/interfaces/create-event-with-prompt-result.d.ts +14 -0
  18. package/dist/esm/schemas/interfaces/create-event-with-prompt-result.js +2 -0
  19. package/dist/esm/schemas/interfaces/create-event-with-prompt-result.js.map +1 -0
  20. package/dist/esm/schemas/interfaces/list-events-in-range-result.d.ts +13 -0
  21. package/dist/esm/schemas/interfaces/list-events-in-range-result.js +2 -0
  22. package/dist/esm/schemas/interfaces/list-events-in-range-result.js.map +1 -0
  23. package/dist/esm/sub-definitions/event-operations.d.ts +22 -12
  24. package/dist/esm/sub-definitions/event-operations.js.map +1 -1
  25. package/dist/esm/web/download-ics-file.d.ts +18 -0
  26. package/dist/esm/web/download-ics-file.js +33 -0
  27. package/dist/esm/web/download-ics-file.js.map +1 -0
  28. package/dist/esm/web/ics.d.ts +21 -0
  29. package/dist/esm/web/ics.js +252 -0
  30. package/dist/esm/web/ics.js.map +1 -0
  31. package/dist/esm/web.d.ts +6 -10
  32. package/dist/esm/web.js +13 -2
  33. package/dist/esm/web.js.map +1 -1
  34. package/dist/plugin.cjs.js +297 -2
  35. package/dist/plugin.cjs.js.map +1 -1
  36. package/dist/plugin.js +297 -2
  37. package/dist/plugin.js.map +1 -1
  38. package/ios/Plugin/Implementation/CapacitorCalendar.swift +1 -1
  39. package/ios/Plugin/Models/Results/CreateEventResult.swift +1 -0
  40. package/ios/Plugin/Models/Results/ListEventsInRangeResult.swift +15 -2
  41. package/ios/Plugin/Utils/ImplementationHelper.swift +47 -3
  42. package/package.json +3 -3
@@ -1,17 +1,19 @@
1
- import type { CalendarEvent } from '../schemas/interfaces/calendar-event';
2
1
  import type { CreateEventOptions } from '../schemas/interfaces/create-event-options';
2
+ import type { CreateEventResult } from '../schemas/interfaces/create-event-result';
3
3
  import type { CreateEventWithPromptOptions } from '../schemas/interfaces/create-event-with-prompt-options';
4
+ import type { CreateEventWithPromptResult } from '../schemas/interfaces/create-event-with-prompt-result';
4
5
  import type { DeleteEventOptions } from '../schemas/interfaces/delete-event-options';
5
6
  import type { DeleteEventWithPromptOptions } from '../schemas/interfaces/delete-event-with-prompt-options';
6
7
  import type { DeleteEventsByIdOptions } from '../schemas/interfaces/delete-events-by-id-options';
7
8
  import type { ListEventsInRangeOptions } from '../schemas/interfaces/list-events-in-range-options';
9
+ import type { ListEventsInRangeResult } from '../schemas/interfaces/list-events-in-range-result';
8
10
  import type { ModifyEventOptions } from '../schemas/interfaces/modify-event-options';
9
11
  import type { ModifyEventWithPromptOptions } from '../schemas/interfaces/modify-event-with-prompt-options';
10
12
  import type { EventEditAction } from '../schemas/types/event-edit-action';
11
13
  export interface EventOperations {
12
14
  /**
13
15
  * Opens the system calendar interface to create a new event.
14
- * On Android always returns `null`.
16
+ * On Android always returns `null` for `id`.
15
17
  * Fetch the events to find the ID of the newly created event.
16
18
  *
17
19
  * @example
@@ -24,9 +26,7 @@ export interface EventOperations {
24
26
  * @platform Android, iOS
25
27
  * @since 0.1.0
26
28
  */
27
- createEventWithPrompt(options?: CreateEventWithPromptOptions): Promise<{
28
- id: string | null;
29
- }>;
29
+ createEventWithPrompt(options?: CreateEventWithPromptOptions): Promise<CreateEventWithPromptResult>;
30
30
  /**
31
31
  * Opens a system calendar interface to modify an event.
32
32
  * On Android always returns `null`.
@@ -46,13 +46,25 @@ export interface EventOperations {
46
46
  }>;
47
47
  /**
48
48
  * Creates an event in the calendar.
49
+ * On Android and iOS, inserts into the system calendar and returns its `id`.
50
+ * On Web, there is no system calendar store: builds an `.ics` `File` as `ics`.
51
+ * The app must download or open that file (for example with `downloadIcsFile(...)`);
52
+ * this method does not trigger a download.
49
53
  *
50
- * @platform iOS, Android
54
+ * @example
55
+ * const { id, ics } = await CapacitorCalendar.createEvent({
56
+ * title: 'Team standup',
57
+ * startDate: Date.now(),
58
+ * icsFileName: 'team-standup.ics',
59
+ * });
60
+ * if (ics) {
61
+ * await downloadIcsFile(ics);
62
+ * }
63
+ *
64
+ * @platform Android, iOS, Web
51
65
  * @since 0.4.0
52
66
  */
53
- createEvent(options: CreateEventOptions): Promise<{
54
- id: string;
55
- }>;
67
+ createEvent(options: CreateEventOptions): Promise<CreateEventResult>;
56
68
  /**
57
69
  * Modifies an event.
58
70
  *
@@ -106,9 +118,7 @@ export interface EventOperations {
106
118
  * @platform Android, iOS
107
119
  * @since 0.10.0
108
120
  */
109
- listEventsInRange(options: ListEventsInRangeOptions): Promise<{
110
- result: CalendarEvent[];
111
- }>;
121
+ listEventsInRange(options: ListEventsInRangeOptions): Promise<ListEventsInRangeResult>;
112
122
  }
113
123
  /**
114
124
  * @since 7.1.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 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"]}
1
+ {"version":3,"file":"event-operations.js","sourceRoot":"","sources":["../../../src/sub-definitions/event-operations.ts"],"names":[],"mappings":"","sourcesContent":["import 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 { 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 { ListEventsInRangeResult } from '../schemas/interfaces/list-events-in-range-result';\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` for `id`.\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<CreateEventWithPromptResult>;\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 * On Android and iOS, inserts into the system calendar and returns its `id`.\n * On Web, there is no system calendar store: builds an `.ics` `File` as `ics`.\n * The app must download or open that file (for example with `downloadIcsFile(...)`);\n * this method does not trigger a download.\n *\n * @example\n * const { id, ics } = await CapacitorCalendar.createEvent({\n * title: 'Team standup',\n * startDate: Date.now(),\n * icsFileName: 'team-standup.ics',\n * });\n * if (ics) {\n * await downloadIcsFile(ics);\n * }\n *\n * @platform Android, iOS, Web\n * @since 0.4.0\n */\n createEvent(options: CreateEventOptions): Promise<CreateEventResult>;\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<ListEventsInRangeResult>;\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"]}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Triggers a browser download for an `.ics` `File`.
3
+ * Resolves after the object URL is revoked.
4
+ *
5
+ * @throws If `document` or `URL` is not available.
6
+ *
7
+ * @example
8
+ * const { ics } = await CapacitorCalendar.createEvent({
9
+ * title: 'Team standup',
10
+ * icsFileName: 'team-standup.ics',
11
+ * });
12
+ * if (ics) {
13
+ * await downloadIcsFile(ics);
14
+ * }
15
+ *
16
+ * @since 8.5.0
17
+ */
18
+ export declare function downloadIcsFile(file: File): Promise<void>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Triggers a browser download for an `.ics` `File`.
3
+ * Resolves after the object URL is revoked.
4
+ *
5
+ * @throws If `document` or `URL` is not available.
6
+ *
7
+ * @example
8
+ * const { ics } = await CapacitorCalendar.createEvent({
9
+ * title: 'Team standup',
10
+ * icsFileName: 'team-standup.ics',
11
+ * });
12
+ * if (ics) {
13
+ * await downloadIcsFile(ics);
14
+ * }
15
+ *
16
+ * @since 8.5.0
17
+ */
18
+ export async function downloadIcsFile(file) {
19
+ if (typeof document === 'undefined' || typeof URL === 'undefined') {
20
+ throw new Error('downloadIcsFile requires a browser document environment.');
21
+ }
22
+ const url = URL.createObjectURL(file);
23
+ const link = document.createElement('a');
24
+ link.href = url;
25
+ link.download = file.name.length > 0 ? file.name : 'event.ics';
26
+ document.body.appendChild(link);
27
+ link.click();
28
+ link.remove();
29
+ // Delay revoke so the browser can start the download
30
+ await new Promise((resolve) => setTimeout(resolve, 1000));
31
+ URL.revokeObjectURL(url);
32
+ }
33
+ //# sourceMappingURL=download-ics-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-ics-file.js","sourceRoot":"","sources":["../../../src/web/download-ics-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAU;IAC9C,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,GAAG,KAAK,WAAW,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IAED,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;IAC/D,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK,EAAE,CAAC;IACb,IAAI,CAAC,MAAM,EAAE,CAAC;IACd,qDAAqD;IACrD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1D,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["/**\n * Triggers a browser download for an `.ics` `File`.\n * Resolves after the object URL is revoked.\n *\n * @throws If `document` or `URL` is not available.\n *\n * @example\n * const { ics } = await CapacitorCalendar.createEvent({\n * title: 'Team standup',\n * icsFileName: 'team-standup.ics',\n * });\n * if (ics) {\n * await downloadIcsFile(ics);\n * }\n *\n * @since 8.5.0\n */\nexport async function downloadIcsFile(file: File): Promise<void> {\n if (typeof document === 'undefined' || typeof URL === 'undefined') {\n throw new Error('downloadIcsFile requires a browser document environment.');\n }\n\n const url = URL.createObjectURL(file);\n const link = document.createElement('a');\n link.href = url;\n link.download = file.name.length > 0 ? file.name : 'event.ics';\n document.body.appendChild(link);\n link.click();\n link.remove();\n // Delay revoke so the browser can start the download\n await new Promise((resolve) => setTimeout(resolve, 1000));\n URL.revokeObjectURL(url);\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import type { CreateEventOptions } from '../schemas/interfaces/create-event-options';
2
+ /**
3
+ * Builds an RFC 5545 `VCALENDAR` document with one `VEVENT` from CreateEventOptions.
4
+ * When `startDate` is omitted, uses the current time. When `endDate` is omitted, uses
5
+ * one hour after the start (or the next day for all-day events).
6
+ */
7
+ export declare function buildEventIcs(options: CreateEventOptions): string;
8
+ /**
9
+ * Resolves the `.ics` download filename.
10
+ * Uses `icsFileName` when set; otherwise derives a name from `title` (fallback `event.ics`).
11
+ * Appends `.ics` when the chosen name has no such extension.
12
+ */
13
+ export declare function resolveIcsFileName(options: Pick<CreateEventOptions, 'icsFileName' | 'title'>): string;
14
+ /**
15
+ * Escapes TEXT values per RFC 5545 §3.3.11.
16
+ */
17
+ export declare function escapeText(value: string): string;
18
+ /**
19
+ * Folds a content line so each physical line is at most 75 octets (RFC 5545 §3.1).
20
+ */
21
+ export declare function foldLine(line: string): string;
@@ -0,0 +1,252 @@
1
+ import { EventAvailability } from '../schemas/enums/event-availability';
2
+ const HOUR_MS = 60 * 60 * 1000;
3
+ const DAY_MS = 24 * HOUR_MS;
4
+ const CRLF = '\r\n';
5
+ /**
6
+ * Builds an RFC 5545 `VCALENDAR` document with one `VEVENT` from CreateEventOptions.
7
+ * When `startDate` is omitted, uses the current time. When `endDate` is omitted, uses
8
+ * one hour after the start (or the next day for all-day events).
9
+ */
10
+ export function buildEventIcs(options) {
11
+ var _a;
12
+ const startDate = (_a = options.startDate) !== null && _a !== void 0 ? _a : Date.now();
13
+ const isAllDay = options.isAllDay === true;
14
+ const endDate = resolveEndDate(startDate, options.endDate, isAllDay);
15
+ const lines = [
16
+ 'BEGIN:VCALENDAR',
17
+ 'VERSION:2.0',
18
+ 'PRODID:-//ebarooni/capacitor-calendar//EN',
19
+ 'CALSCALE:GREGORIAN',
20
+ 'METHOD:PUBLISH',
21
+ 'BEGIN:VEVENT',
22
+ `UID:${generateUid()}`,
23
+ `DTSTAMP:${formatDateTimeUtc(Date.now())}`,
24
+ ];
25
+ if (isAllDay) {
26
+ lines.push(`DTSTART;VALUE=DATE:${formatDateOnlyLocal(startDate)}`);
27
+ lines.push(`DTEND;VALUE=DATE:${formatDateOnlyLocal(endDate)}`);
28
+ }
29
+ else {
30
+ lines.push(`DTSTART:${formatDateTimeUtc(startDate)}`);
31
+ lines.push(`DTEND:${formatDateTimeUtc(endDate)}`);
32
+ }
33
+ lines.push(`SUMMARY:${escapeText(options.title)}`);
34
+ if (options.description != null && options.description.length > 0) {
35
+ lines.push(`DESCRIPTION:${escapeText(options.description)}`);
36
+ }
37
+ if (options.location != null && options.location.length > 0) {
38
+ lines.push(`LOCATION:${escapeText(options.location)}`);
39
+ }
40
+ if (options.url != null && options.url.length > 0) {
41
+ lines.push(`URL:${escapeText(options.url)}`);
42
+ }
43
+ if (options.organizer != null && options.organizer.length > 0) {
44
+ lines.push(`ORGANIZER:mailto:${escapeText(options.organizer)}`);
45
+ }
46
+ const transp = mapTransparency(options.availability);
47
+ if (transp != null) {
48
+ lines.push(`TRANSP:${transp}`);
49
+ }
50
+ if (options.recurrence != null) {
51
+ lines.push(`RRULE:${toRRule(options.recurrence, isAllDay)}`);
52
+ }
53
+ if (options.attendees != null) {
54
+ for (const guest of options.attendees) {
55
+ if (guest.email.length === 0) {
56
+ continue;
57
+ }
58
+ const cn = guest.name != null && guest.name.length > 0 ? `;CN=${formatParamValue(guest.name)}` : '';
59
+ lines.push(`ATTENDEE${cn}:mailto:${escapeText(guest.email)}`);
60
+ }
61
+ }
62
+ if (options.alerts != null) {
63
+ for (const minutes of options.alerts) {
64
+ lines.push(...buildAlarm(minutes));
65
+ }
66
+ }
67
+ lines.push('END:VEVENT', 'END:VCALENDAR');
68
+ return lines.map(foldLine).join(CRLF) + CRLF;
69
+ }
70
+ /**
71
+ * Resolves the `.ics` download filename.
72
+ * Uses `icsFileName` when set; otherwise derives a name from `title` (fallback `event.ics`).
73
+ * Appends `.ics` when the chosen name has no such extension.
74
+ */
75
+ export function resolveIcsFileName(options) {
76
+ var _a;
77
+ const custom = (_a = options.icsFileName) === null || _a === void 0 ? void 0 : _a.trim();
78
+ if (custom != null && custom.length > 0) {
79
+ return /\.ics$/i.test(custom) ? custom : `${custom}.ics`;
80
+ }
81
+ return fileNameFromTitle(options.title);
82
+ }
83
+ function fileNameFromTitle(title) {
84
+ const base = (title !== null && title !== void 0 ? title : 'event')
85
+ .trim()
86
+ .replace(/[^\w\s-]+/g, '')
87
+ .replace(/\s+/g, '-')
88
+ .replace(/-+/g, '-')
89
+ .replace(/^-|-$/g, '')
90
+ .slice(0, 64);
91
+ return `${base.length > 0 ? base : 'event'}.ics`;
92
+ }
93
+ function resolveEndDate(startDate, endDate, isAllDay) {
94
+ if (!isAllDay) {
95
+ return endDate !== null && endDate !== void 0 ? endDate : startDate + HOUR_MS;
96
+ }
97
+ if (endDate == null) {
98
+ return startDate + DAY_MS;
99
+ }
100
+ // ICS all-day DTEND is exclusive; same local date as DTSTART is zero-length.
101
+ if (formatDateOnlyLocal(endDate) <= formatDateOnlyLocal(startDate)) {
102
+ return startDate + DAY_MS;
103
+ }
104
+ return endDate;
105
+ }
106
+ function mapTransparency(availability) {
107
+ if (availability == null) {
108
+ return null;
109
+ }
110
+ if (availability === EventAvailability.FREE) {
111
+ return 'TRANSPARENT';
112
+ }
113
+ if (availability === EventAvailability.BUSY) {
114
+ return 'OPAQUE';
115
+ }
116
+ return 'OPAQUE';
117
+ }
118
+ function toRRule(rule, isAllDay) {
119
+ var _a;
120
+ const parts = [`FREQ=${rule.frequency.toUpperCase()}`, `INTERVAL=${Math.max(1, (_a = rule.interval) !== null && _a !== void 0 ? _a : 1)}`];
121
+ if (rule.count != null) {
122
+ parts.push(`COUNT=${rule.count}`);
123
+ }
124
+ else if (rule.end != null) {
125
+ // RFC 5545: UNTIL must match DTSTART value type (DATE vs DATE-TIME).
126
+ parts.push(`UNTIL=${isAllDay ? formatDateOnlyLocal(rule.end) : formatDateTimeUtc(rule.end)}`);
127
+ }
128
+ if (rule.byWeekDay != null && rule.byWeekDay.length > 0) {
129
+ const mapped = rule.byWeekDay.map(mapWeekday).filter((d) => d != null);
130
+ if (mapped.length > 0) {
131
+ parts.push(`BYDAY=${[...new Set(mapped)].join(',')}`);
132
+ }
133
+ }
134
+ if (rule.byMonthDay != null && rule.byMonthDay.length > 0) {
135
+ parts.push(`BYMONTHDAY=${rule.byMonthDay.join(',')}`);
136
+ }
137
+ if (rule.byMonth != null && rule.byMonth.length > 0) {
138
+ parts.push(`BYMONTH=${rule.byMonth.join(',')}`);
139
+ }
140
+ if (rule.weeksOfTheYear != null && rule.weeksOfTheYear.length > 0) {
141
+ parts.push(`BYWEEKNO=${rule.weeksOfTheYear.join(',')}`);
142
+ }
143
+ if (rule.daysOfTheYear != null && rule.daysOfTheYear.length > 0) {
144
+ parts.push(`BYYEARDAY=${rule.daysOfTheYear.join(',')}`);
145
+ }
146
+ return parts.join(';');
147
+ }
148
+ function mapWeekday(day) {
149
+ switch (day) {
150
+ case 1:
151
+ return 'MO';
152
+ case 2:
153
+ return 'TU';
154
+ case 3:
155
+ return 'WE';
156
+ case 4:
157
+ return 'TH';
158
+ case 5:
159
+ return 'FR';
160
+ case 6:
161
+ return 'SA';
162
+ case 7:
163
+ return 'SU';
164
+ default:
165
+ return null;
166
+ }
167
+ }
168
+ function buildAlarm(minutes) {
169
+ const trigger = minutes < 0 ? `-PT${Math.abs(minutes)}M` : `PT${minutes}M`;
170
+ return ['BEGIN:VALARM', 'ACTION:DISPLAY', 'DESCRIPTION:Reminder', `TRIGGER:${trigger}`, 'END:VALARM'];
171
+ }
172
+ function generateUid() {
173
+ if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
174
+ return `${crypto.randomUUID()}@capacitor-calendar`;
175
+ }
176
+ return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}@capacitor-calendar`;
177
+ }
178
+ function formatDateTimeUtc(ms) {
179
+ const d = new Date(ms);
180
+ const y = d.getUTCFullYear();
181
+ const mo = pad(d.getUTCMonth() + 1);
182
+ const day = pad(d.getUTCDate());
183
+ const h = pad(d.getUTCHours());
184
+ const mi = pad(d.getUTCMinutes());
185
+ const s = pad(d.getUTCSeconds());
186
+ return `${y}${mo}${day}T${h}${mi}${s}Z`;
187
+ }
188
+ function formatDateOnlyLocal(ms) {
189
+ const d = new Date(ms);
190
+ return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}`;
191
+ }
192
+ function pad(n) {
193
+ return n < 10 ? `0${n}` : String(n);
194
+ }
195
+ /**
196
+ * Escapes TEXT values per RFC 5545 §3.3.11.
197
+ */
198
+ export function escapeText(value) {
199
+ return value
200
+ .replace(/\\/g, '\\\\')
201
+ .replace(/;/g, '\\;')
202
+ .replace(/,/g, '\\,')
203
+ .replace(/\r\n|\n|\r/g, '\\n');
204
+ }
205
+ /**
206
+ * Formats a property parameter value per RFC 5545 §3.2.
207
+ * Values with COMMA, SEMICOLON, or COLON are quoted; DQUOTE and line breaks are sanitized.
208
+ */
209
+ function formatParamValue(value) {
210
+ const sanitized = value.replace(/[\r\n]+/g, ' ').replace(/"/g, "'");
211
+ if (/[;:,]/.test(sanitized)) {
212
+ return `"${sanitized}"`;
213
+ }
214
+ return sanitized;
215
+ }
216
+ /**
217
+ * Folds a content line so each physical line is at most 75 octets (RFC 5545 §3.1).
218
+ */
219
+ export function foldLine(line) {
220
+ const max = 75;
221
+ if (byteLength(line) <= max) {
222
+ return line;
223
+ }
224
+ const chars = [...line];
225
+ let result = '';
226
+ let current = '';
227
+ for (const ch of chars) {
228
+ const next = current + ch;
229
+ if (byteLength(next) > max) {
230
+ result += result.length === 0 ? current : `${CRLF} ${current}`;
231
+ current = ch;
232
+ // Continuations are limited to 74 octets of content + leading space = 75
233
+ while (byteLength(current) > max - 1) {
234
+ // Extremely rare for a single code point; split by taking first unit as-is
235
+ result += `${CRLF} ${current}`;
236
+ current = '';
237
+ break;
238
+ }
239
+ }
240
+ else {
241
+ current = next;
242
+ }
243
+ }
244
+ if (current.length > 0) {
245
+ result += result.length === 0 ? current : `${CRLF} ${current}`;
246
+ }
247
+ return result;
248
+ }
249
+ function byteLength(s) {
250
+ return new TextEncoder().encode(s).length;
251
+ }
252
+ //# sourceMappingURL=ics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ics.js","sourceRoot":"","sources":["../../../src/web/ics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAIxE,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC/B,MAAM,MAAM,GAAG,EAAE,GAAG,OAAO,CAAC;AAC5B,MAAM,IAAI,GAAG,MAAM,CAAC;AAEpB;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAA2B;;IACvD,MAAM,SAAS,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,IA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AI,OAAO,EAAE,CAAC;YAC/D,OAAO,GAAG,EAAE,CAAC;YACb,yEAAyE;YACzE,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC;gBACrC,2EAA2E;gBAC3E,MAAM,IAAI,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC;gBAC/B,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM;YACR,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC;IACjE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5C,CAAC","sourcesContent":["import { EventAvailability } from '../schemas/enums/event-availability';\nimport type { CreateEventOptions } from '../schemas/interfaces/create-event-options';\nimport type { EventRecurrenceRule } from '../schemas/interfaces/event-recurrence-rule';\n\nconst HOUR_MS = 60 * 60 * 1000;\nconst DAY_MS = 24 * HOUR_MS;\nconst CRLF = '\\r\\n';\n\n/**\n * Builds an RFC 5545 `VCALENDAR` document with one `VEVENT` from CreateEventOptions.\n * When `startDate` is omitted, uses the current time. When `endDate` is omitted, uses\n * one hour after the start (or the next day for all-day events).\n */\nexport function buildEventIcs(options: CreateEventOptions): string {\n const startDate = options.startDate ?? Date.now();\n const isAllDay = options.isAllDay === true;\n const endDate = resolveEndDate(startDate, options.endDate, isAllDay);\n\n const lines: string[] = [\n 'BEGIN:VCALENDAR',\n 'VERSION:2.0',\n 'PRODID:-//ebarooni/capacitor-calendar//EN',\n 'CALSCALE:GREGORIAN',\n 'METHOD:PUBLISH',\n 'BEGIN:VEVENT',\n `UID:${generateUid()}`,\n `DTSTAMP:${formatDateTimeUtc(Date.now())}`,\n ];\n\n if (isAllDay) {\n lines.push(`DTSTART;VALUE=DATE:${formatDateOnlyLocal(startDate)}`);\n lines.push(`DTEND;VALUE=DATE:${formatDateOnlyLocal(endDate)}`);\n } else {\n lines.push(`DTSTART:${formatDateTimeUtc(startDate)}`);\n lines.push(`DTEND:${formatDateTimeUtc(endDate)}`);\n }\n\n lines.push(`SUMMARY:${escapeText(options.title)}`);\n\n if (options.description != null && options.description.length > 0) {\n lines.push(`DESCRIPTION:${escapeText(options.description)}`);\n }\n if (options.location != null && options.location.length > 0) {\n lines.push(`LOCATION:${escapeText(options.location)}`);\n }\n if (options.url != null && options.url.length > 0) {\n lines.push(`URL:${escapeText(options.url)}`);\n }\n if (options.organizer != null && options.organizer.length > 0) {\n lines.push(`ORGANIZER:mailto:${escapeText(options.organizer)}`);\n }\n\n const transp = mapTransparency(options.availability);\n if (transp != null) {\n lines.push(`TRANSP:${transp}`);\n }\n\n if (options.recurrence != null) {\n lines.push(`RRULE:${toRRule(options.recurrence, isAllDay)}`);\n }\n\n if (options.attendees != null) {\n for (const guest of options.attendees) {\n if (guest.email.length === 0) {\n continue;\n }\n const cn = guest.name != null && guest.name.length > 0 ? `;CN=${formatParamValue(guest.name)}` : '';\n lines.push(`ATTENDEE${cn}:mailto:${escapeText(guest.email)}`);\n }\n }\n\n if (options.alerts != null) {\n for (const minutes of options.alerts) {\n lines.push(...buildAlarm(minutes));\n }\n }\n\n lines.push('END:VEVENT', 'END:VCALENDAR');\n\n return lines.map(foldLine).join(CRLF) + CRLF;\n}\n\n/**\n * Resolves the `.ics` download filename.\n * Uses `icsFileName` when set; otherwise derives a name from `title` (fallback `event.ics`).\n * Appends `.ics` when the chosen name has no such extension.\n */\nexport function resolveIcsFileName(options: Pick<CreateEventOptions, 'icsFileName' | 'title'>): string {\n const custom = options.icsFileName?.trim();\n if (custom != null && custom.length > 0) {\n return /\\.ics$/i.test(custom) ? custom : `${custom}.ics`;\n }\n return fileNameFromTitle(options.title);\n}\n\nfunction fileNameFromTitle(title?: string): string {\n const base = (title ?? 'event')\n .trim()\n .replace(/[^\\w\\s-]+/g, '')\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '')\n .slice(0, 64);\n return `${base.length > 0 ? base : 'event'}.ics`;\n}\n\nfunction resolveEndDate(startDate: number, endDate: number | undefined, isAllDay: boolean): number {\n if (!isAllDay) {\n return endDate ?? startDate + HOUR_MS;\n }\n if (endDate == null) {\n return startDate + DAY_MS;\n }\n // ICS all-day DTEND is exclusive; same local date as DTSTART is zero-length.\n if (formatDateOnlyLocal(endDate) <= formatDateOnlyLocal(startDate)) {\n return startDate + DAY_MS;\n }\n return endDate;\n}\n\nfunction mapTransparency(availability: EventAvailability | undefined): 'OPAQUE' | 'TRANSPARENT' | null {\n if (availability == null) {\n return null;\n }\n if (availability === EventAvailability.FREE) {\n return 'TRANSPARENT';\n }\n if (availability === EventAvailability.BUSY) {\n return 'OPAQUE';\n }\n return 'OPAQUE';\n}\n\nfunction toRRule(rule: EventRecurrenceRule, isAllDay: boolean): string {\n const parts: string[] = [`FREQ=${rule.frequency.toUpperCase()}`, `INTERVAL=${Math.max(1, rule.interval ?? 1)}`];\n\n if (rule.count != null) {\n parts.push(`COUNT=${rule.count}`);\n } else if (rule.end != null) {\n // RFC 5545: UNTIL must match DTSTART value type (DATE vs DATE-TIME).\n parts.push(`UNTIL=${isAllDay ? formatDateOnlyLocal(rule.end) : formatDateTimeUtc(rule.end)}`);\n }\n\n if (rule.byWeekDay != null && rule.byWeekDay.length > 0) {\n const mapped = rule.byWeekDay.map(mapWeekday).filter((d): d is string => d != null);\n if (mapped.length > 0) {\n parts.push(`BYDAY=${[...new Set(mapped)].join(',')}`);\n }\n }\n\n if (rule.byMonthDay != null && rule.byMonthDay.length > 0) {\n parts.push(`BYMONTHDAY=${rule.byMonthDay.join(',')}`);\n }\n if (rule.byMonth != null && rule.byMonth.length > 0) {\n parts.push(`BYMONTH=${rule.byMonth.join(',')}`);\n }\n if (rule.weeksOfTheYear != null && rule.weeksOfTheYear.length > 0) {\n parts.push(`BYWEEKNO=${rule.weeksOfTheYear.join(',')}`);\n }\n if (rule.daysOfTheYear != null && rule.daysOfTheYear.length > 0) {\n parts.push(`BYYEARDAY=${rule.daysOfTheYear.join(',')}`);\n }\n\n return parts.join(';');\n}\n\nfunction mapWeekday(day: number): string | null {\n switch (day) {\n case 1:\n return 'MO';\n case 2:\n return 'TU';\n case 3:\n return 'WE';\n case 4:\n return 'TH';\n case 5:\n return 'FR';\n case 6:\n return 'SA';\n case 7:\n return 'SU';\n default:\n return null;\n }\n}\n\nfunction buildAlarm(minutes: number): string[] {\n const trigger = minutes < 0 ? `-PT${Math.abs(minutes)}M` : `PT${minutes}M`;\n return ['BEGIN:VALARM', 'ACTION:DISPLAY', 'DESCRIPTION:Reminder', `TRIGGER:${trigger}`, 'END:VALARM'];\n}\n\nfunction generateUid(): string {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return `${crypto.randomUUID()}@capacitor-calendar`;\n }\n return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}@capacitor-calendar`;\n}\n\nfunction formatDateTimeUtc(ms: number): string {\n const d = new Date(ms);\n const y = d.getUTCFullYear();\n const mo = pad(d.getUTCMonth() + 1);\n const day = pad(d.getUTCDate());\n const h = pad(d.getUTCHours());\n const mi = pad(d.getUTCMinutes());\n const s = pad(d.getUTCSeconds());\n return `${y}${mo}${day}T${h}${mi}${s}Z`;\n}\n\nfunction formatDateOnlyLocal(ms: number): string {\n const d = new Date(ms);\n return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}`;\n}\n\nfunction pad(n: number): string {\n return n < 10 ? `0${n}` : String(n);\n}\n\n/**\n * Escapes TEXT values per RFC 5545 §3.3.11.\n */\nexport function escapeText(value: string): string {\n return value\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/;/g, '\\\\;')\n .replace(/,/g, '\\\\,')\n .replace(/\\r\\n|\\n|\\r/g, '\\\\n');\n}\n\n/**\n * Formats a property parameter value per RFC 5545 §3.2.\n * Values with COMMA, SEMICOLON, or COLON are quoted; DQUOTE and line breaks are sanitized.\n */\nfunction formatParamValue(value: string): string {\n const sanitized = value.replace(/[\\r\\n]+/g, ' ').replace(/\"/g, \"'\");\n if (/[;:,]/.test(sanitized)) {\n return `\"${sanitized}\"`;\n }\n return sanitized;\n}\n\n/**\n * Folds a content line so each physical line is at most 75 octets (RFC 5545 §3.1).\n */\nexport function foldLine(line: string): string {\n const max = 75;\n if (byteLength(line) <= max) {\n return line;\n }\n\n const chars = [...line];\n let result = '';\n let current = '';\n\n for (const ch of chars) {\n const next = current + ch;\n if (byteLength(next) > max) {\n result += result.length === 0 ? current : `${CRLF} ${current}`;\n current = ch;\n // Continuations are limited to 74 octets of content + leading space = 75\n while (byteLength(current) > max - 1) {\n // Extremely rare for a single code point; split by taking first unit as-is\n result += `${CRLF} ${current}`;\n current = '';\n break;\n }\n } else {\n current = next;\n }\n }\n\n if (current.length > 0) {\n result += result.length === 0 ? current : `${CRLF} ${current}`;\n }\n\n return result;\n}\n\nfunction byteLength(s: string): number {\n return new TextEncoder().encode(s).length;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -2,13 +2,14 @@ import type { PermissionState } from '@capacitor/core';
2
2
  import { WebPlugin } from '@capacitor/core';
3
3
  import type { CapacitorCalendarPlugin } from './definitions';
4
4
  import type { Calendar } from './schemas/interfaces/calendar';
5
- import type { CalendarEvent } from './schemas/interfaces/calendar-event';
6
5
  import type { CalendarSource } from './schemas/interfaces/calendar-source';
7
6
  import type { CheckPermissionOptions } from './schemas/interfaces/check-permission-options';
8
7
  import type { CreateCalendarOptions } from './schemas/interfaces/create-calendar-options';
9
8
  import type { CreateCalendarResult } from './schemas/interfaces/create-calendar-result';
10
9
  import type { CreateEventOptions } from './schemas/interfaces/create-event-options';
10
+ import type { CreateEventResult } from './schemas/interfaces/create-event-result';
11
11
  import type { CreateEventWithPromptOptions } from './schemas/interfaces/create-event-with-prompt-options';
12
+ import type { CreateEventWithPromptResult } from './schemas/interfaces/create-event-with-prompt-result';
12
13
  import type { CreateReminderOptions } from './schemas/interfaces/create-reminder-options';
13
14
  import type { CreateRemindersListOptions } from './schemas/interfaces/create-reminders-list-options';
14
15
  import type { CreateRemindersListResult } from './schemas/interfaces/create-reminders-list-result';
@@ -26,6 +27,7 @@ import type { GetReminderByIdOptions } from './schemas/interfaces/get-reminder-b
26
27
  import type { GetRemindersFromListsOptions } from './schemas/interfaces/get-reminders-from-lists-options';
27
28
  import type { ListCalendarsResult } from './schemas/interfaces/list-calendars-result';
28
29
  import type { ListEventsInRangeOptions } from './schemas/interfaces/list-events-in-range-options';
30
+ import type { ListEventsInRangeResult } from './schemas/interfaces/list-events-in-range-result';
29
31
  import type { ModifyCalendarOptions } from './schemas/interfaces/modify-calendar-options';
30
32
  import type { ModifyEventOptions } from './schemas/interfaces/modify-event-options';
31
33
  import type { ModifyEventWithPromptOptions } from './schemas/interfaces/modify-event-with-prompt-options';
@@ -69,15 +71,11 @@ export declare class CapacitorCalendarWeb extends WebPlugin implements Capacitor
69
71
  requestFullRemindersAccess(): Promise<{
70
72
  result: PermissionState;
71
73
  }>;
72
- createEventWithPrompt(_options: CreateEventWithPromptOptions): Promise<{
73
- id: string | null;
74
- }>;
74
+ createEventWithPrompt(_options: CreateEventWithPromptOptions): Promise<CreateEventWithPromptResult>;
75
75
  modifyEventWithPrompt(_options: ModifyEventWithPromptOptions): Promise<{
76
76
  result: EventEditAction | null;
77
77
  }>;
78
- createEvent(_options: CreateEventOptions): Promise<{
79
- id: string;
80
- }>;
78
+ createEvent(options: CreateEventOptions): Promise<CreateEventResult>;
81
79
  commit(): Promise<void>;
82
80
  modifyEvent(_options: ModifyEventOptions): Promise<void>;
83
81
  selectCalendarsWithPrompt(_options?: SelectCalendarsWithPromptOptions): Promise<SelectCalendarsWithPromptResult>;
@@ -120,9 +118,7 @@ export declare class CapacitorCalendarWeb extends WebPlugin implements Capacitor
120
118
  deleteEventWithPrompt(_options: DeleteEventWithPromptOptions): Promise<{
121
119
  deleted: boolean;
122
120
  }>;
123
- listEventsInRange(_options: ListEventsInRangeOptions): Promise<{
124
- result: CalendarEvent[];
125
- }>;
121
+ listEventsInRange(_options: ListEventsInRangeOptions): Promise<ListEventsInRangeResult>;
126
122
  modifyCalendar(_options: ModifyCalendarOptions): Promise<void>;
127
123
  deleteReminderWithPrompt(_options: DeleteReminderWithPromptOptions): Promise<{
128
124
  deleted: boolean;
package/dist/esm/web.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
+ import { buildEventIcs, resolveIcsFileName } from './web/ics';
2
3
  export class CapacitorCalendarWeb extends WebPlugin {
3
4
  checkPermission(_options) {
4
5
  return this.throwUnimplemented(this.checkPermission.name);
@@ -36,8 +37,18 @@ export class CapacitorCalendarWeb extends WebPlugin {
36
37
  modifyEventWithPrompt(_options) {
37
38
  return this.throwUnimplemented(this.modifyEventWithPrompt.name);
38
39
  }
39
- createEvent(_options) {
40
- return this.throwUnimplemented(this.createEvent.name);
40
+ createEvent(options) {
41
+ try {
42
+ const content = buildEventIcs(options);
43
+ const ics = new File([content], resolveIcsFileName(options), {
44
+ type: 'text/calendar;charset=utf-8',
45
+ });
46
+ return Promise.resolve({ id: null, ics });
47
+ }
48
+ catch (error) {
49
+ const message = error instanceof Error ? error.message : String(error);
50
+ return Promise.reject(new Error(message));
51
+ }
41
52
  }
42
53
  commit() {
43
54
  return this.throwUnimplemented(this.commit.name);
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA6C5C,MAAM,OAAO,oBAAqB,SAAQ,SAAS;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,IAAI,CAAC,CAAC;IAClE,CAAC;IAEM,gBAAgB,CAAC,QAAiC;QAGvD,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IAEM,WAAW,CAAC,QAA4B;QAC7C,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IAEM,qBAAqB,CAAC,QAAsC;QACjE,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IAEM,iBAAiB,CAAC,QAAkC;QACzD,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;IAEM,cAAc,CAAC,QAA+B;QACnD,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,cAAc,CAAC,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 { CalendarEvent } from './schemas/interfaces/calendar-event';\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 { CreateEventWithPromptOptions } from './schemas/interfaces/create-event-with-prompt-options';\nimport type { CreateReminderOptions } from './schemas/interfaces/create-reminder-options';\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 { 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 { GetRemindersFromListsOptions } from './schemas/interfaces/get-reminders-from-lists-options';\nimport type { ListCalendarsResult } from './schemas/interfaces/list-calendars-result';\nimport type { ListEventsInRangeOptions } from './schemas/interfaces/list-events-in-range-options';\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 { Reminder } from './schemas/interfaces/reminder';\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 type { DeleteRemindersByIdResult } from './sub-definitions/reminders-operations';\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<{ id: string | null }> {\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<{\n id: string;\n }> {\n return this.throwUnimplemented(this.createEvent.name);\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<{ id: string }> {\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<{ result: Reminder | null }> {\n return this.throwUnimplemented(this.getReminderById.name);\n }\n\n public getRemindersFromLists(_options: GetRemindersFromListsOptions): Promise<{ result: Reminder[] }> {\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<{ result: CalendarEvent[] }> {\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.unimplemented(`${methodName} is not implemented on the web.`));\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA8C5C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE9D,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAC1C,eAAe,CAAC,QAAgC;QACrD,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;IAEM,mBAAmB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IAEM,iBAAiB,CAAC,QAAkC;QACzD,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;IAEM,mBAAmB,CAAC,QAAoC;QAC7D,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IAEM,mBAAmB,CAAC,QAAoC;QAC7D,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IAEM,qBAAqB;QAG1B,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IAEM,8BAA8B;QAGnC,OAAO,IAAI,CAAC,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,CAAC;IAEM,qBAAqB,CAAC,QAAsC;QACjE,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IAEM,iBAAiB,CAAC,QAAkC;QACzD,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;IAEM,cAAc,CAAC,QAA+B;QACnD,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,cAAc,CAAC,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 { 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 { 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 { GetRemindersFromListsOptions } from './schemas/interfaces/get-reminders-from-lists-options';\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 { Reminder } from './schemas/interfaces/reminder';\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 type { DeleteRemindersByIdResult } from './sub-definitions/reminders-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<{ id: string }> {\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<{ result: Reminder | null }> {\n return this.throwUnimplemented(this.getReminderById.name);\n }\n\n public getRemindersFromLists(_options: GetRemindersFromListsOptions): Promise<{ result: Reminder[] }> {\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.unimplemented(`${methodName} is not implemented on the web.`));\n }\n}\n"]}