@ebarooni/capacitor-calendar 8.11.0 → 8.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +280 -104
- package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +37 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/implementation/CalendarChangeObserver.kt +181 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/implementation/CapacitorCalendar.kt +58 -8
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/data/EventDeleteInfo.kt +6 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/StartListeningInput.kt +20 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/utils/ImplementationHelper.kt +88 -67
- package/dist/docs.json +1383 -976
- package/dist/esm/definitions.d.ts +2 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +12 -2
- package/dist/esm/index.js +4 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schemas/enums/capacitor-calendar-error-code.d.ts +2 -2
- package/dist/esm/schemas/enums/capacitor-calendar-error-code.js +2 -2
- package/dist/esm/schemas/enums/capacitor-calendar-error-code.js.map +1 -1
- package/dist/esm/schemas/interfaces/calendar-changed-event.d.ts +52 -0
- package/dist/esm/schemas/interfaces/calendar-changed-event.js +2 -0
- package/dist/esm/schemas/interfaces/calendar-changed-event.js.map +1 -0
- package/dist/esm/schemas/interfaces/calendar-links.d.ts +32 -0
- package/dist/esm/schemas/interfaces/calendar-links.js +2 -0
- package/dist/esm/schemas/interfaces/calendar-links.js.map +1 -0
- package/dist/esm/schemas/interfaces/create-event-options.d.ts +18 -0
- package/dist/esm/schemas/interfaces/create-event-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-event-with-prompt-options.d.ts +9 -0
- package/dist/esm/schemas/interfaces/create-event-with-prompt-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-ics-file-options.d.ts +20 -0
- package/dist/esm/schemas/interfaces/create-ics-file-options.js +2 -0
- package/dist/esm/schemas/interfaces/create-ics-file-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/open-calendar-options.d.ts +9 -0
- package/dist/esm/schemas/interfaces/open-calendar-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/share-ics-file-options.d.ts +17 -0
- package/dist/esm/schemas/interfaces/share-ics-file-options.js +2 -0
- package/dist/esm/schemas/interfaces/share-ics-file-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/start-listening-options.d.ts +46 -0
- package/dist/esm/schemas/interfaces/start-listening-options.js +2 -0
- package/dist/esm/schemas/interfaces/start-listening-options.js.map +1 -0
- package/dist/esm/schemas/types/calendar-day-view-provider.d.ts +7 -0
- package/dist/esm/schemas/types/calendar-day-view-provider.js +2 -0
- package/dist/esm/schemas/types/calendar-day-view-provider.js.map +1 -0
- package/dist/esm/schemas/types/calendar-link-provider.d.ts +6 -0
- package/dist/esm/schemas/types/calendar-link-provider.js +2 -0
- package/dist/esm/schemas/types/calendar-link-provider.js.map +1 -0
- package/dist/esm/sub-definitions/calendar-listening.d.ts +49 -0
- package/dist/esm/sub-definitions/calendar-listening.js +2 -0
- package/dist/esm/sub-definitions/calendar-listening.js.map +1 -0
- package/dist/esm/sub-definitions/calendar-operations.d.ts +2 -1
- package/dist/esm/sub-definitions/calendar-operations.js.map +1 -1
- package/dist/esm/web/calendar-links.d.ts +26 -0
- package/dist/esm/web/calendar-links.js +114 -0
- package/dist/esm/web/calendar-links.js.map +1 -0
- package/dist/esm/web/create-ics-file.d.ts +21 -0
- package/dist/esm/web/create-ics-file.js +30 -0
- package/dist/esm/web/create-ics-file.js.map +1 -0
- package/dist/esm/web/ics.d.ts +11 -0
- package/dist/esm/web/ics.js +48 -32
- package/dist/esm/web/ics.js.map +1 -1
- package/dist/esm/web/share-ics-file.d.ts +21 -0
- package/dist/esm/web/share-ics-file.js +46 -0
- package/dist/esm/web/share-ics-file.js.map +1 -0
- package/dist/esm/web.d.ts +4 -1
- package/dist/esm/web.js +18 -4
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +292 -72
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +292 -72
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorCalendarPlugin.swift +19 -0
- package/ios/Plugin/Implementation/CalendarChangeObserver.swift +259 -0
- package/ios/Plugin/Implementation/CapacitorCalendar.swift +15 -1
- package/ios/Plugin/Models/Inputs/DeleteReminderInput.swift +1 -1
- package/ios/Plugin/Models/Inputs/DeleteReminderWithPromptInput.swift +1 -1
- package/ios/Plugin/Models/Inputs/DeleteRemindersListInput.swift +1 -1
- package/ios/Plugin/Models/Inputs/GetReminderByIdInput.swift +1 -1
- package/ios/Plugin/Models/Inputs/ModifyReminderInput.swift +14 -9
- package/ios/Plugin/Models/Inputs/StartListeningInput.swift +26 -0
- package/ios/Plugin/Models/Inputs/UpdateRemindersListInput.swift +1 -1
- package/ios/Plugin/PluginConfig.swift +2 -0
- package/ios/Plugin/PluginError.swift +25 -3
- package/ios/Plugin/Utils/ImplementationHelper.swift +16 -30
- package/ios/Plugin/Utils/PluginCallRejecter.swift +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share-ics-file.js","sourceRoot":"","sources":["../../../src/web/share-ics-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,IAAU,EACV,UAA+B,EAAE;IAEjC,MAAM,SAAS,GAAc,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IAEzF,IACE,OAAO,SAAS,KAAK,WAAW;QAChC,OAAO,SAAS,CAAC,KAAK,KAAK,UAAU;QACrC,OAAO,SAAS,CAAC,QAAQ,KAAK,UAAU;QACxC,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAC9B,CAAC;QACD,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC;QAC5B,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACjC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,YAAY,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YACjE,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,kGAAkG;QAClG,IAAI,KAAK,YAAY,YAAY,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;YACtE,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC;YAC5B,OAAO,YAAY,CAAC;QACtB,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import type { ShareIcsFileOptions } from '../schemas/interfaces/share-ics-file-options';\n\nimport { downloadIcsFile } from './download-ics-file';\n\n/**\n * Opens the share sheet of the device for an `.ics` `File`.\n * When the browser cannot share files, the file downloads instead.\n * Call it from a user action, such as a click. Browsers reject the share sheet otherwise.\n * Build the file synchronously (for example with `createIcsFile`) so the click still counts when the sheet opens.\n * Some browsers, such as Chrome, do not share `.ics` files and download them instead.\n * Chrome can report that it shares the file and then reject with `NotAllowedError`, so that error also falls back to a download.\n *\n * Resolves `'shared'` after the user picks a target, `'cancelled'` when the user closes the sheet,\n * and `'downloaded'` when the browser fell back to a download.\n *\n * @example\n * button.addEventListener('click', async () => {\n * const file = createIcsFile({ title: 'Team standup', startDate: Date.now() });\n * await shareIcsFile(file, { title: 'Team standup' });\n * });\n *\n * @since 8.12.0\n */\nexport async function shareIcsFile(\n file: File,\n options: ShareIcsFileOptions = {},\n): Promise<'shared' | 'cancelled' | 'downloaded'> {\n const shareData: ShareData = { files: [file], title: options.title, text: options.text };\n\n if (\n typeof navigator === 'undefined' ||\n typeof navigator.share !== 'function' ||\n typeof navigator.canShare !== 'function' ||\n !navigator.canShare(shareData)\n ) {\n await downloadIcsFile(file);\n return 'downloaded';\n }\n\n try {\n await navigator.share(shareData);\n return 'shared';\n } catch (error) {\n if (error instanceof DOMException && error.name === 'AbortError') {\n return 'cancelled';\n }\n // Chrome: canShare() accepts the file, but share() rejects the file type with \"Permission denied\"\n if (error instanceof DOMException && error.name === 'NotAllowedError') {\n await downloadIcsFile(file);\n return 'downloaded';\n }\n throw error;\n }\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ import type { OpenCalendarOptions } from './schemas/interfaces/open-calendar-opt
|
|
|
44
44
|
import type { RequestPermissionOptions } from './schemas/interfaces/request-permission-options';
|
|
45
45
|
import type { SelectCalendarsWithPromptOptions } from './schemas/interfaces/select-calendars-with-prompt-options';
|
|
46
46
|
import type { SelectCalendarsWithPromptResult } from './schemas/interfaces/select-calendars-with-prompt-result';
|
|
47
|
+
import type { StartListeningOptions } from './schemas/interfaces/start-listening-options';
|
|
47
48
|
import type { UpdateRemindersListOptions } from './schemas/interfaces/update-reminders-list-options';
|
|
48
49
|
import type { UpdateRemindersListResult } from './schemas/interfaces/update-reminders-list-result';
|
|
49
50
|
import type { EventEditAction } from './schemas/types/event-edit-action';
|
|
@@ -85,6 +86,8 @@ export declare class CapacitorCalendarWeb extends WebPlugin implements Capacitor
|
|
|
85
86
|
modifyEvent(_options: ModifyEventOptions): Promise<void>;
|
|
86
87
|
selectCalendarsWithPrompt(_options?: SelectCalendarsWithPromptOptions): Promise<SelectCalendarsWithPromptResult>;
|
|
87
88
|
fetchAllCalendarSources(): Promise<FetchAllCalendarSourcesResult>;
|
|
89
|
+
startListening(_options: StartListeningOptions): Promise<void>;
|
|
90
|
+
stopListening(): Promise<void>;
|
|
88
91
|
listCalendars(): Promise<ListCalendarsResult>;
|
|
89
92
|
fetchAllRemindersSources(): Promise<FetchAllCalendarSourcesResult>;
|
|
90
93
|
getDefaultCalendar(_options?: GetDefaultCalendarOptions): Promise<{
|
|
@@ -93,7 +96,7 @@ export declare class CapacitorCalendarWeb extends WebPlugin implements Capacitor
|
|
|
93
96
|
getDefaultRemindersList(): Promise<GetDefaultRemindersListResult>;
|
|
94
97
|
openReminders(): Promise<void>;
|
|
95
98
|
getRemindersLists(): Promise<GetRemindersListsResult>;
|
|
96
|
-
openCalendar(
|
|
99
|
+
openCalendar(options?: OpenCalendarOptions): Promise<void>;
|
|
97
100
|
createCalendar(_options: CreateCalendarOptions): Promise<CreateCalendarResult>;
|
|
98
101
|
deleteCalendar(_options: DeleteCalendarOptions): Promise<void>;
|
|
99
102
|
createReminder(_options: CreateReminderOptions): Promise<CreateReminderResult>;
|
package/dist/esm/web.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import { getCalendarDayLink } from './web/calendar-links';
|
|
2
3
|
import { downloadIcsFile } from './web/download-ics-file';
|
|
3
4
|
import { buildEventIcs, resolveEndDate, resolveIcsFileName } from './web/ics';
|
|
4
5
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
6
|
+
const WEB_HINT = 'The web has no calendar store. Use createEvent or createIcsFile for an .ics file, ' +
|
|
7
|
+
'getCalendarLinks for web calendar links, and shareIcsFile or downloadIcsFile to hand the file to the user.';
|
|
5
8
|
export class CapacitorCalendarWeb extends WebPlugin {
|
|
6
9
|
checkPermission(_options) {
|
|
7
10
|
return this.throwUnimplemented(this.checkPermission.name);
|
|
@@ -35,7 +38,7 @@ export class CapacitorCalendarWeb extends WebPlugin {
|
|
|
35
38
|
}
|
|
36
39
|
async createEventWithPrompt(options = {}) {
|
|
37
40
|
try {
|
|
38
|
-
const confirmed = window.confirm(buildCreateEventConfirmMessage(options));
|
|
41
|
+
const confirmed = options.skipPrompt === true || window.confirm(buildCreateEventConfirmMessage(options));
|
|
39
42
|
if (!confirmed) {
|
|
40
43
|
return { id: null, ics: null };
|
|
41
44
|
}
|
|
@@ -85,6 +88,12 @@ export class CapacitorCalendarWeb extends WebPlugin {
|
|
|
85
88
|
fetchAllCalendarSources() {
|
|
86
89
|
return this.throwUnimplemented(this.fetchAllCalendarSources.name);
|
|
87
90
|
}
|
|
91
|
+
startListening(_options) {
|
|
92
|
+
return this.throwUnimplemented(this.startListening.name);
|
|
93
|
+
}
|
|
94
|
+
stopListening() {
|
|
95
|
+
return this.throwUnimplemented(this.stopListening.name);
|
|
96
|
+
}
|
|
88
97
|
listCalendars() {
|
|
89
98
|
return this.throwUnimplemented(this.listCalendars.name);
|
|
90
99
|
}
|
|
@@ -103,8 +112,13 @@ export class CapacitorCalendarWeb extends WebPlugin {
|
|
|
103
112
|
getRemindersLists() {
|
|
104
113
|
return this.throwUnimplemented(this.getRemindersLists.name);
|
|
105
114
|
}
|
|
106
|
-
openCalendar(
|
|
107
|
-
|
|
115
|
+
async openCalendar(options) {
|
|
116
|
+
var _a;
|
|
117
|
+
if ((options === null || options === void 0 ? void 0 : options.provider) == null) {
|
|
118
|
+
return this.throwUnimplemented(this.openCalendar.name);
|
|
119
|
+
}
|
|
120
|
+
const url = getCalendarDayLink(options.provider, (_a = options.date) !== null && _a !== void 0 ? _a : Date.now());
|
|
121
|
+
window.open(url, '_blank', 'noopener');
|
|
108
122
|
}
|
|
109
123
|
createCalendar(_options) {
|
|
110
124
|
return this.throwUnimplemented(this.createCalendar.name);
|
|
@@ -155,7 +169,7 @@ export class CapacitorCalendarWeb extends WebPlugin {
|
|
|
155
169
|
return this.throwUnimplemented(this.updateRemindersList.name);
|
|
156
170
|
}
|
|
157
171
|
throwUnimplemented(methodName) {
|
|
158
|
-
return Promise.reject(this.unimplemented(`${methodName} is not implemented on the web
|
|
172
|
+
return Promise.reject(this.unimplemented(`${methodName} is not implemented on the web. ${WEB_HINT}`));
|
|
159
173
|
}
|
|
160
174
|
}
|
|
161
175
|
function mapPromptOptionsToCreateEvent(options) {
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAmD5C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE9E,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,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,kBAAkB,CAAC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,CAAC,eAAe,CAAC,EAAE,CAAC;IAC7F,CAAC;IAED,OAAO,GAAG,qBAAqB,CAAC,SAAS,CAAC,MAAM,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;AACnF,CAAC;AAED,SAAS,eAAe,CAAC,EAAU;IACjC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3D,OAAO,GAAG,QAAQ,IAAI,KAAK,IAAI,UAAU,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,iBAAiB,CAAC,EAAU;IACnC,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE;QAChD,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,EAAU;IACvC,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE;QAC5C,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { PermissionState } from '@capacitor/core';\nimport { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorCalendarPlugin } from './definitions';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { CheckPermissionOptions } from './schemas/interfaces/check-permission-options';\nimport type { CreateCalendarOptions } from './schemas/interfaces/create-calendar-options';\nimport type { CreateCalendarResult } from './schemas/interfaces/create-calendar-result';\nimport type { CreateEventOptions } from './schemas/interfaces/create-event-options';\nimport type { CreateEventResult } from './schemas/interfaces/create-event-result';\nimport type { CreateEventWithPromptOptions } from './schemas/interfaces/create-event-with-prompt-options';\nimport type { CreateEventWithPromptResult } from './schemas/interfaces/create-event-with-prompt-result';\nimport type { CreateReminderOptions } from './schemas/interfaces/create-reminder-options';\nimport type { CreateReminderResult } from './schemas/interfaces/create-reminder-result';\nimport type { CreateRemindersListOptions } from './schemas/interfaces/create-reminders-list-options';\nimport type { CreateRemindersListResult } from './schemas/interfaces/create-reminders-list-result';\nimport type { DeleteCalendarOptions } from './schemas/interfaces/delete-calendar-options';\nimport type { DeleteEventOptions } from './schemas/interfaces/delete-event-options';\nimport type { DeleteEventWithPromptOptions } from './schemas/interfaces/delete-event-with-prompt-options';\nimport type { DeleteEventsByIdOptions } from './schemas/interfaces/delete-events-by-id-options';\nimport type { DeleteReminderOptions } from './schemas/interfaces/delete-reminder-options';\nimport type { DeleteReminderWithPromptOptions } from './schemas/interfaces/delete-reminder-with-prompt-options';\nimport type { DeleteReminderWithPromptResult } from './schemas/interfaces/delete-reminder-with-prompt-result';\nimport type { DeleteRemindersByIdOptions } from './schemas/interfaces/delete-reminders-by-id-options';\nimport type { DeleteRemindersByIdResult } from './schemas/interfaces/delete-reminders-by-id-result';\nimport type { DeleteRemindersListOptions } from './schemas/interfaces/delete-reminders-list-options';\nimport type { FetchAllCalendarSourcesResult } from './schemas/interfaces/fetch-all-calendar-sources-result';\nimport type { GetDefaultCalendarOptions } from './schemas/interfaces/get-default-calendar-options';\nimport type { GetDefaultRemindersListResult } from './schemas/interfaces/get-default-reminders-list-result';\nimport type { GetEventByIdOptions } from './schemas/interfaces/get-event-by-id-options';\nimport type { GetEventByIdResult } from './schemas/interfaces/get-event-by-id-result';\nimport type { GetReminderByIdOptions } from './schemas/interfaces/get-reminder-by-id-options';\nimport type { GetReminderByIdResult } from './schemas/interfaces/get-reminder-by-id-result';\nimport type { GetRemindersFromListsOptions } from './schemas/interfaces/get-reminders-from-lists-options';\nimport type { GetRemindersFromListsResult } from './schemas/interfaces/get-reminders-from-lists-result';\nimport type { GetRemindersListsResult } from './schemas/interfaces/get-reminders-lists-result';\nimport type { ListCalendarsResult } from './schemas/interfaces/list-calendars-result';\nimport type { ListEventsInRangeOptions } from './schemas/interfaces/list-events-in-range-options';\nimport type { ListEventsInRangeResult } from './schemas/interfaces/list-events-in-range-result';\nimport type { ModifyCalendarOptions } from './schemas/interfaces/modify-calendar-options';\nimport type { ModifyEventOptions } from './schemas/interfaces/modify-event-options';\nimport type { ModifyEventWithPromptOptions } from './schemas/interfaces/modify-event-with-prompt-options';\nimport type { ModifyReminderOptions } from './schemas/interfaces/modify-reminder-options';\nimport type { OpenCalendarOptions } from './schemas/interfaces/open-calendar-options';\nimport type { RequestPermissionOptions } from './schemas/interfaces/request-permission-options';\nimport type { SelectCalendarsWithPromptOptions } from './schemas/interfaces/select-calendars-with-prompt-options';\nimport type { SelectCalendarsWithPromptResult } from './schemas/interfaces/select-calendars-with-prompt-result';\nimport type { UpdateRemindersListOptions } from './schemas/interfaces/update-reminders-list-options';\nimport type { UpdateRemindersListResult } from './schemas/interfaces/update-reminders-list-result';\nimport type { EventEditAction } from './schemas/types/event-edit-action';\nimport type { CheckAllPermissionsResult, RequestAllPermissionsResult } from './sub-definitions/calendar-access';\nimport type { DeleteEventsByIdResult } from './sub-definitions/event-operations';\nimport { downloadIcsFile } from './web/download-ics-file';\nimport { buildEventIcs, resolveEndDate, resolveIcsFileName } from './web/ics';\n\nconst DAY_MS = 24 * 60 * 60 * 1000;\n\nexport class CapacitorCalendarWeb extends WebPlugin implements CapacitorCalendarPlugin {\n public checkPermission(_options: CheckPermissionOptions): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.checkPermission.name);\n }\n\n public checkAllPermissions(): Promise<{ result: CheckAllPermissionsResult }> {\n return this.throwUnimplemented(this.checkAllPermissions.name);\n }\n\n public requestPermission(_options: RequestPermissionOptions): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestPermission.name);\n }\n\n public createRemindersList(_options: CreateRemindersListOptions): Promise<CreateRemindersListResult> {\n return this.throwUnimplemented(this.createRemindersList.name);\n }\n\n public deleteRemindersList(_options: DeleteRemindersListOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteRemindersList.name);\n }\n\n public requestAllPermissions(): Promise<{\n result: RequestAllPermissionsResult;\n }> {\n return this.throwUnimplemented(this.requestAllPermissions.name);\n }\n\n public requestWriteOnlyCalendarAccess(): Promise<{\n result: PermissionState;\n }> {\n return this.throwUnimplemented(this.requestWriteOnlyCalendarAccess.name);\n }\n\n public requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestReadOnlyCalendarAccess.name);\n }\n\n public requestFullCalendarAccess(): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestFullCalendarAccess.name);\n }\n\n public requestFullRemindersAccess(): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestFullRemindersAccess.name);\n }\n\n public async createEventWithPrompt(options: CreateEventWithPromptOptions = {}): Promise<CreateEventWithPromptResult> {\n try {\n const confirmed = window.confirm(buildCreateEventConfirmMessage(options));\n if (!confirmed) {\n return { id: null, ics: null };\n }\n\n const createOptions = mapPromptOptionsToCreateEvent(options);\n const content = buildEventIcs(createOptions);\n const ics = new File([content], resolveIcsFileName(createOptions), {\n type: 'text/calendar;charset=utf-8',\n });\n\n if (options.autoDownloadIcsFile !== false) {\n await downloadIcsFile(ics);\n }\n\n return { id: null, ics };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return Promise.reject(new Error(message));\n }\n }\n\n public modifyEventWithPrompt(_options: ModifyEventWithPromptOptions): Promise<{ result: EventEditAction | null }> {\n return this.throwUnimplemented(this.modifyEventWithPrompt.name);\n }\n\n public async createEvent(options: CreateEventOptions): Promise<CreateEventResult> {\n try {\n const content = buildEventIcs(options);\n const ics = new File([content], resolveIcsFileName(options), {\n type: 'text/calendar;charset=utf-8',\n });\n if (options.autoDownloadIcsFile === true) {\n await downloadIcsFile(ics);\n }\n return { id: null, ics };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return Promise.reject(new Error(message));\n }\n }\n\n public commit(): Promise<void> {\n return this.throwUnimplemented(this.commit.name);\n }\n\n public modifyEvent(_options: ModifyEventOptions): Promise<void> {\n return this.throwUnimplemented(this.modifyEvent.name);\n }\n\n public selectCalendarsWithPrompt(\n _options?: SelectCalendarsWithPromptOptions,\n ): Promise<SelectCalendarsWithPromptResult> {\n return this.throwUnimplemented(this.selectCalendarsWithPrompt.name);\n }\n\n public fetchAllCalendarSources(): Promise<FetchAllCalendarSourcesResult> {\n return this.throwUnimplemented(this.fetchAllCalendarSources.name);\n }\n\n public listCalendars(): Promise<ListCalendarsResult> {\n return this.throwUnimplemented(this.listCalendars.name);\n }\n\n public fetchAllRemindersSources(): Promise<FetchAllCalendarSourcesResult> {\n return this.throwUnimplemented(this.fetchAllRemindersSources.name);\n }\n\n public getDefaultCalendar(_options?: GetDefaultCalendarOptions): Promise<{ result: Calendar | null }> {\n return this.throwUnimplemented(this.getDefaultCalendar.name);\n }\n\n public getDefaultRemindersList(): Promise<GetDefaultRemindersListResult> {\n return this.throwUnimplemented(this.getDefaultRemindersList.name);\n }\n\n public openReminders(): Promise<void> {\n return this.throwUnimplemented(this.openReminders.name);\n }\n\n public getRemindersLists(): Promise<GetRemindersListsResult> {\n return this.throwUnimplemented(this.getRemindersLists.name);\n }\n\n public openCalendar(_options?: OpenCalendarOptions): Promise<void> {\n return this.throwUnimplemented(this.openCalendar.name);\n }\n\n public createCalendar(_options: CreateCalendarOptions): Promise<CreateCalendarResult> {\n return this.throwUnimplemented(this.createCalendar.name);\n }\n\n public deleteCalendar(_options: DeleteCalendarOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteCalendar.name);\n }\n\n public createReminder(_options: CreateReminderOptions): Promise<CreateReminderResult> {\n return this.throwUnimplemented(this.createReminder.name);\n }\n\n public deleteRemindersById(_options: DeleteRemindersByIdOptions): Promise<{ result: DeleteRemindersByIdResult }> {\n return this.throwUnimplemented(this.deleteRemindersById.name);\n }\n\n public deleteReminder(_options: DeleteReminderOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteReminder.name);\n }\n\n public modifyReminder(_options: ModifyReminderOptions): Promise<void> {\n return this.throwUnimplemented(this.modifyReminder.name);\n }\n\n public getEventById(_options: GetEventByIdOptions): Promise<GetEventByIdResult> {\n return this.throwUnimplemented(this.getEventById.name);\n }\n\n public getReminderById(_options: GetReminderByIdOptions): Promise<GetReminderByIdResult> {\n return this.throwUnimplemented(this.getReminderById.name);\n }\n\n public getRemindersFromLists(_options: GetRemindersFromListsOptions): Promise<GetRemindersFromListsResult> {\n return this.throwUnimplemented(this.getRemindersFromLists.name);\n }\n\n public deleteEventsById(_options: DeleteEventsByIdOptions): Promise<{\n result: DeleteEventsByIdResult;\n }> {\n return this.throwUnimplemented(this.deleteEventsById.name);\n }\n\n public deleteEvent(_options: DeleteEventOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteEvent.name);\n }\n\n public deleteEventWithPrompt(_options: DeleteEventWithPromptOptions): Promise<{ deleted: boolean }> {\n return this.throwUnimplemented(this.deleteEventWithPrompt.name);\n }\n\n public listEventsInRange(_options: ListEventsInRangeOptions): Promise<ListEventsInRangeResult> {\n return this.throwUnimplemented(this.listEventsInRange.name);\n }\n\n public modifyCalendar(_options: ModifyCalendarOptions): Promise<void> {\n return this.throwUnimplemented(this.modifyCalendar.name);\n }\n\n public deleteReminderWithPrompt(_options: DeleteReminderWithPromptOptions): Promise<DeleteReminderWithPromptResult> {\n return this.throwUnimplemented(this.deleteReminderWithPrompt.name);\n }\n\n public updateRemindersList(_options: UpdateRemindersListOptions): Promise<UpdateRemindersListResult> {\n return this.throwUnimplemented(this.updateRemindersList.name);\n }\n\n private throwUnimplemented<T>(methodName: string): Promise<T> {\n return Promise.reject(this.unimplemented(`${methodName} is not implemented on the web.`));\n }\n}\n\nfunction mapPromptOptionsToCreateEvent(options: CreateEventWithPromptOptions): CreateEventOptions {\n return {\n alerts: options.alerts,\n availability: options.availability,\n description: options.description,\n endDate: options.endDate,\n icsFileName: options.icsFileName,\n isAllDay: options.isAllDay,\n location: options.location,\n recurrence: options.recurrence,\n startDate: options.startDate,\n title: options.title ?? '',\n url: options.url,\n };\n}\n\nfunction buildCreateEventConfirmMessage(options: CreateEventWithPromptOptions): string {\n const custom = options.promptMessage?.trim();\n if (custom != null && custom.length > 0) {\n return custom;\n }\n\n const title = normalizeConfirmTitle(options.title);\n const timeSummary = formatEventTimeSummary(options);\n return `Create event?\\n\\n${title}\\n${timeSummary}`;\n}\n\nfunction normalizeConfirmTitle(title?: string): string {\n const collapsed = (title ?? '')\n .replace(/[\\r\\n]+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n return collapsed.length > 0 ? collapsed : 'Untitled event';\n}\n\nfunction formatEventTimeSummary(options: CreateEventWithPromptOptions): string {\n const startDate = options.startDate ?? Date.now();\n const isAllDay = options.isAllDay === true;\n const endDate = resolveEndDate(startDate, options.endDate, undefined, isAllDay);\n\n if (isAllDay) {\n const startDay = formatLocalDate(startDate);\n const lastInclusiveMs = endDate - DAY_MS;\n const lastDay = formatLocalDate(lastInclusiveMs);\n if (lastDay <= startDay) {\n return `All day · ${formatDisplayDate(startDate)}`;\n }\n return `All day · ${formatDisplayDate(startDate)} – ${formatDisplayDate(lastInclusiveMs)}`;\n }\n\n return `${formatDisplayDateTime(startDate)} – ${formatDisplayDateTime(endDate)}`;\n}\n\nfunction formatLocalDate(ms: number): string {\n const date = new Date(ms);\n const fullYear = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const dayOfMonth = String(date.getDate()).padStart(2, '0');\n return `${fullYear}-${month}-${dayOfMonth}`;\n}\n\nfunction formatDisplayDate(ms: number): string {\n return new Date(ms).toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n}\n\nfunction formatDisplayDateTime(ms: number): string {\n return new Date(ms).toLocaleString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAoD5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE9E,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACnC,MAAM,QAAQ,GACZ,oFAAoF;IACpF,4GAA4G,CAAC;AAE/G,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,C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;IAC3D,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3D,OAAO,GAAG,QAAQ,IAAI,KAAK,IAAI,UAAU,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,iBAAiB,CAAC,EAAU;IACnC,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE;QAChD,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,EAAU;IACvC,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE;QAC5C,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { PermissionState } from '@capacitor/core';\nimport { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorCalendarPlugin } from './definitions';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { CheckPermissionOptions } from './schemas/interfaces/check-permission-options';\nimport type { CreateCalendarOptions } from './schemas/interfaces/create-calendar-options';\nimport type { CreateCalendarResult } from './schemas/interfaces/create-calendar-result';\nimport type { CreateEventOptions } from './schemas/interfaces/create-event-options';\nimport type { CreateEventResult } from './schemas/interfaces/create-event-result';\nimport type { CreateEventWithPromptOptions } from './schemas/interfaces/create-event-with-prompt-options';\nimport type { CreateEventWithPromptResult } from './schemas/interfaces/create-event-with-prompt-result';\nimport type { CreateReminderOptions } from './schemas/interfaces/create-reminder-options';\nimport type { CreateReminderResult } from './schemas/interfaces/create-reminder-result';\nimport type { CreateRemindersListOptions } from './schemas/interfaces/create-reminders-list-options';\nimport type { CreateRemindersListResult } from './schemas/interfaces/create-reminders-list-result';\nimport type { DeleteCalendarOptions } from './schemas/interfaces/delete-calendar-options';\nimport type { DeleteEventOptions } from './schemas/interfaces/delete-event-options';\nimport type { DeleteEventWithPromptOptions } from './schemas/interfaces/delete-event-with-prompt-options';\nimport type { DeleteEventsByIdOptions } from './schemas/interfaces/delete-events-by-id-options';\nimport type { DeleteReminderOptions } from './schemas/interfaces/delete-reminder-options';\nimport type { DeleteReminderWithPromptOptions } from './schemas/interfaces/delete-reminder-with-prompt-options';\nimport type { DeleteReminderWithPromptResult } from './schemas/interfaces/delete-reminder-with-prompt-result';\nimport type { DeleteRemindersByIdOptions } from './schemas/interfaces/delete-reminders-by-id-options';\nimport type { DeleteRemindersByIdResult } from './schemas/interfaces/delete-reminders-by-id-result';\nimport type { DeleteRemindersListOptions } from './schemas/interfaces/delete-reminders-list-options';\nimport type { FetchAllCalendarSourcesResult } from './schemas/interfaces/fetch-all-calendar-sources-result';\nimport type { GetDefaultCalendarOptions } from './schemas/interfaces/get-default-calendar-options';\nimport type { GetDefaultRemindersListResult } from './schemas/interfaces/get-default-reminders-list-result';\nimport type { GetEventByIdOptions } from './schemas/interfaces/get-event-by-id-options';\nimport type { GetEventByIdResult } from './schemas/interfaces/get-event-by-id-result';\nimport type { GetReminderByIdOptions } from './schemas/interfaces/get-reminder-by-id-options';\nimport type { GetReminderByIdResult } from './schemas/interfaces/get-reminder-by-id-result';\nimport type { GetRemindersFromListsOptions } from './schemas/interfaces/get-reminders-from-lists-options';\nimport type { GetRemindersFromListsResult } from './schemas/interfaces/get-reminders-from-lists-result';\nimport type { GetRemindersListsResult } from './schemas/interfaces/get-reminders-lists-result';\nimport type { ListCalendarsResult } from './schemas/interfaces/list-calendars-result';\nimport type { ListEventsInRangeOptions } from './schemas/interfaces/list-events-in-range-options';\nimport type { ListEventsInRangeResult } from './schemas/interfaces/list-events-in-range-result';\nimport type { ModifyCalendarOptions } from './schemas/interfaces/modify-calendar-options';\nimport type { ModifyEventOptions } from './schemas/interfaces/modify-event-options';\nimport type { ModifyEventWithPromptOptions } from './schemas/interfaces/modify-event-with-prompt-options';\nimport type { ModifyReminderOptions } from './schemas/interfaces/modify-reminder-options';\nimport type { OpenCalendarOptions } from './schemas/interfaces/open-calendar-options';\nimport type { RequestPermissionOptions } from './schemas/interfaces/request-permission-options';\nimport type { SelectCalendarsWithPromptOptions } from './schemas/interfaces/select-calendars-with-prompt-options';\nimport type { SelectCalendarsWithPromptResult } from './schemas/interfaces/select-calendars-with-prompt-result';\nimport type { StartListeningOptions } from './schemas/interfaces/start-listening-options';\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 { getCalendarDayLink } from './web/calendar-links';\nimport { downloadIcsFile } from './web/download-ics-file';\nimport { buildEventIcs, resolveEndDate, resolveIcsFileName } from './web/ics';\n\nconst DAY_MS = 24 * 60 * 60 * 1000;\nconst WEB_HINT =\n 'The web has no calendar store. Use createEvent or createIcsFile for an .ics file, ' +\n 'getCalendarLinks for web calendar links, and shareIcsFile or downloadIcsFile to hand the file to the user.';\n\nexport class CapacitorCalendarWeb extends WebPlugin implements CapacitorCalendarPlugin {\n public checkPermission(_options: CheckPermissionOptions): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.checkPermission.name);\n }\n\n public checkAllPermissions(): Promise<{ result: CheckAllPermissionsResult }> {\n return this.throwUnimplemented(this.checkAllPermissions.name);\n }\n\n public requestPermission(_options: RequestPermissionOptions): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestPermission.name);\n }\n\n public createRemindersList(_options: CreateRemindersListOptions): Promise<CreateRemindersListResult> {\n return this.throwUnimplemented(this.createRemindersList.name);\n }\n\n public deleteRemindersList(_options: DeleteRemindersListOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteRemindersList.name);\n }\n\n public requestAllPermissions(): Promise<{\n result: RequestAllPermissionsResult;\n }> {\n return this.throwUnimplemented(this.requestAllPermissions.name);\n }\n\n public requestWriteOnlyCalendarAccess(): Promise<{\n result: PermissionState;\n }> {\n return this.throwUnimplemented(this.requestWriteOnlyCalendarAccess.name);\n }\n\n public requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestReadOnlyCalendarAccess.name);\n }\n\n public requestFullCalendarAccess(): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestFullCalendarAccess.name);\n }\n\n public requestFullRemindersAccess(): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestFullRemindersAccess.name);\n }\n\n public async createEventWithPrompt(options: CreateEventWithPromptOptions = {}): Promise<CreateEventWithPromptResult> {\n try {\n const confirmed = options.skipPrompt === true || window.confirm(buildCreateEventConfirmMessage(options));\n if (!confirmed) {\n return { id: null, ics: null };\n }\n\n const createOptions = mapPromptOptionsToCreateEvent(options);\n const content = buildEventIcs(createOptions);\n const ics = new File([content], resolveIcsFileName(createOptions), {\n type: 'text/calendar;charset=utf-8',\n });\n\n if (options.autoDownloadIcsFile !== false) {\n await downloadIcsFile(ics);\n }\n\n return { id: null, ics };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return Promise.reject(new Error(message));\n }\n }\n\n public modifyEventWithPrompt(_options: ModifyEventWithPromptOptions): Promise<{ result: EventEditAction | null }> {\n return this.throwUnimplemented(this.modifyEventWithPrompt.name);\n }\n\n public async createEvent(options: CreateEventOptions): Promise<CreateEventResult> {\n try {\n const content = buildEventIcs(options);\n const ics = new File([content], resolveIcsFileName(options), {\n type: 'text/calendar;charset=utf-8',\n });\n if (options.autoDownloadIcsFile === true) {\n await downloadIcsFile(ics);\n }\n return { id: null, ics };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return Promise.reject(new Error(message));\n }\n }\n\n public commit(): Promise<void> {\n return this.throwUnimplemented(this.commit.name);\n }\n\n public modifyEvent(_options: ModifyEventOptions): Promise<void> {\n return this.throwUnimplemented(this.modifyEvent.name);\n }\n\n public selectCalendarsWithPrompt(\n _options?: SelectCalendarsWithPromptOptions,\n ): Promise<SelectCalendarsWithPromptResult> {\n return this.throwUnimplemented(this.selectCalendarsWithPrompt.name);\n }\n\n public fetchAllCalendarSources(): Promise<FetchAllCalendarSourcesResult> {\n return this.throwUnimplemented(this.fetchAllCalendarSources.name);\n }\n\n public startListening(_options: StartListeningOptions): Promise<void> {\n return this.throwUnimplemented(this.startListening.name);\n }\n\n public stopListening(): Promise<void> {\n return this.throwUnimplemented(this.stopListening.name);\n }\n\n public listCalendars(): Promise<ListCalendarsResult> {\n return this.throwUnimplemented(this.listCalendars.name);\n }\n\n public fetchAllRemindersSources(): Promise<FetchAllCalendarSourcesResult> {\n return this.throwUnimplemented(this.fetchAllRemindersSources.name);\n }\n\n public getDefaultCalendar(_options?: GetDefaultCalendarOptions): Promise<{ result: Calendar | null }> {\n return this.throwUnimplemented(this.getDefaultCalendar.name);\n }\n\n public getDefaultRemindersList(): Promise<GetDefaultRemindersListResult> {\n return this.throwUnimplemented(this.getDefaultRemindersList.name);\n }\n\n public openReminders(): Promise<void> {\n return this.throwUnimplemented(this.openReminders.name);\n }\n\n public getRemindersLists(): Promise<GetRemindersListsResult> {\n return this.throwUnimplemented(this.getRemindersLists.name);\n }\n\n public async openCalendar(options?: OpenCalendarOptions): Promise<void> {\n if (options?.provider == null) {\n return this.throwUnimplemented(this.openCalendar.name);\n }\n const url = getCalendarDayLink(options.provider, options.date ?? Date.now());\n window.open(url, '_blank', 'noopener');\n }\n\n public createCalendar(_options: CreateCalendarOptions): Promise<CreateCalendarResult> {\n return this.throwUnimplemented(this.createCalendar.name);\n }\n\n public deleteCalendar(_options: DeleteCalendarOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteCalendar.name);\n }\n\n public createReminder(_options: CreateReminderOptions): Promise<CreateReminderResult> {\n return this.throwUnimplemented(this.createReminder.name);\n }\n\n public deleteRemindersById(_options: DeleteRemindersByIdOptions): Promise<{ result: DeleteRemindersByIdResult }> {\n return this.throwUnimplemented(this.deleteRemindersById.name);\n }\n\n public deleteReminder(_options: DeleteReminderOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteReminder.name);\n }\n\n public modifyReminder(_options: ModifyReminderOptions): Promise<void> {\n return this.throwUnimplemented(this.modifyReminder.name);\n }\n\n public getEventById(_options: GetEventByIdOptions): Promise<GetEventByIdResult> {\n return this.throwUnimplemented(this.getEventById.name);\n }\n\n public getReminderById(_options: GetReminderByIdOptions): Promise<GetReminderByIdResult> {\n return this.throwUnimplemented(this.getReminderById.name);\n }\n\n public getRemindersFromLists(_options: GetRemindersFromListsOptions): Promise<GetRemindersFromListsResult> {\n return this.throwUnimplemented(this.getRemindersFromLists.name);\n }\n\n public deleteEventsById(_options: DeleteEventsByIdOptions): Promise<{\n result: DeleteEventsByIdResult;\n }> {\n return this.throwUnimplemented(this.deleteEventsById.name);\n }\n\n public deleteEvent(_options: DeleteEventOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteEvent.name);\n }\n\n public deleteEventWithPrompt(_options: DeleteEventWithPromptOptions): Promise<{ deleted: boolean }> {\n return this.throwUnimplemented(this.deleteEventWithPrompt.name);\n }\n\n public listEventsInRange(_options: ListEventsInRangeOptions): Promise<ListEventsInRangeResult> {\n return this.throwUnimplemented(this.listEventsInRange.name);\n }\n\n public modifyCalendar(_options: ModifyCalendarOptions): Promise<void> {\n return this.throwUnimplemented(this.modifyCalendar.name);\n }\n\n public deleteReminderWithPrompt(_options: DeleteReminderWithPromptOptions): Promise<DeleteReminderWithPromptResult> {\n return this.throwUnimplemented(this.deleteReminderWithPrompt.name);\n }\n\n public updateRemindersList(_options: UpdateRemindersListOptions): Promise<UpdateRemindersListResult> {\n return this.throwUnimplemented(this.updateRemindersList.name);\n }\n\n private throwUnimplemented<T>(methodName: string): Promise<T> {\n return Promise.reject(this.unimplemented(`${methodName} is not implemented on the web. ${WEB_HINT}`));\n }\n}\n\nfunction mapPromptOptionsToCreateEvent(options: CreateEventWithPromptOptions): CreateEventOptions {\n return {\n alerts: options.alerts,\n availability: options.availability,\n description: options.description,\n endDate: options.endDate,\n icsFileName: options.icsFileName,\n isAllDay: options.isAllDay,\n location: options.location,\n recurrence: options.recurrence,\n startDate: options.startDate,\n title: options.title ?? '',\n url: options.url,\n };\n}\n\nfunction buildCreateEventConfirmMessage(options: CreateEventWithPromptOptions): string {\n const custom = options.promptMessage?.trim();\n if (custom != null && custom.length > 0) {\n return custom;\n }\n\n const title = normalizeConfirmTitle(options.title);\n const timeSummary = formatEventTimeSummary(options);\n return `Create event?\\n\\n${title}\\n${timeSummary}`;\n}\n\nfunction normalizeConfirmTitle(title?: string): string {\n const collapsed = (title ?? '')\n .replace(/[\\r\\n]+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n return collapsed.length > 0 ? collapsed : 'Untitled event';\n}\n\nfunction formatEventTimeSummary(options: CreateEventWithPromptOptions): string {\n const startDate = options.startDate ?? Date.now();\n const isAllDay = options.isAllDay === true;\n const endDate = resolveEndDate(startDate, options.endDate, undefined, isAllDay);\n\n if (isAllDay) {\n const startDay = formatLocalDate(startDate);\n const lastInclusiveMs = endDate - DAY_MS;\n const lastDay = formatLocalDate(lastInclusiveMs);\n if (lastDay <= startDay) {\n return `All day · ${formatDisplayDate(startDate)}`;\n }\n return `All day · ${formatDisplayDate(startDate)} – ${formatDisplayDate(lastInclusiveMs)}`;\n }\n\n return `${formatDisplayDateTime(startDate)} – ${formatDisplayDateTime(endDate)}`;\n}\n\nfunction formatLocalDate(ms: number): string {\n const date = new Date(ms);\n const fullYear = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const dayOfMonth = String(date.getDate()).padStart(2, '0');\n return `${fullYear}-${month}-${dayOfMonth}`;\n}\n\nfunction formatDisplayDate(ms: number): string {\n return new Date(ms).toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n}\n\nfunction formatDisplayDateTime(ms: number): string {\n return new Date(ms).toLocaleString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n });\n}\n"]}
|