@symbiote-native/calendar 0.1.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 (141) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +189 -0
  3. package/build/angular/index.d.ts +3 -0
  4. package/build/angular/index.js +3 -0
  5. package/build/angular/services/calendar-permissions.service/index.d.ts +5 -0
  6. package/build/angular/services/calendar-permissions.service/index.js +60 -0
  7. package/build/angular/services/reminders-permissions.service/index.d.ts +5 -0
  8. package/build/angular/services/reminders-permissions.service/index.js +60 -0
  9. package/build/core/attendee.d.ts +9 -0
  10. package/build/core/attendee.js +28 -0
  11. package/build/core/calendar-permission-api.d.ts +9 -0
  12. package/build/core/calendar-permission-api.js +9 -0
  13. package/build/core/calendar.d.ts +34 -0
  14. package/build/core/calendar.js +118 -0
  15. package/build/core/enums.d.ts +141 -0
  16. package/build/core/enums.js +157 -0
  17. package/build/core/event.d.ts +14 -0
  18. package/build/core/event.js +40 -0
  19. package/build/core/index.d.ts +6 -0
  20. package/build/core/index.js +6 -0
  21. package/build/core/native-module.d.ts +154 -0
  22. package/build/core/native-module.js +3 -0
  23. package/build/core/reminder.d.ts +10 -0
  24. package/build/core/reminder.js +34 -0
  25. package/build/core/types.d.ts +184 -0
  26. package/build/core/types.js +1 -0
  27. package/build/core/utils.d.ts +7 -0
  28. package/build/core/utils.js +29 -0
  29. package/build/legacy/calendar.d.ts +23 -0
  30. package/build/legacy/calendar.js +261 -0
  31. package/build/legacy/enums.d.ts +1 -0
  32. package/build/legacy/enums.js +2 -0
  33. package/build/legacy/index.d.ts +5 -0
  34. package/build/legacy/index.js +5 -0
  35. package/build/legacy/native-module.d.ts +39 -0
  36. package/build/legacy/native-module.js +3 -0
  37. package/build/legacy/permissions.d.ts +9 -0
  38. package/build/legacy/permissions.js +33 -0
  39. package/build/legacy/reminders.d.ts +6 -0
  40. package/build/legacy/reminders.js +56 -0
  41. package/build/legacy/types.d.ts +147 -0
  42. package/build/legacy/types.js +1 -0
  43. package/build/react/index.d.ts +3 -0
  44. package/build/react/index.js +3 -0
  45. package/build/react/use-calendar-permissions.d.ts +10 -0
  46. package/build/react/use-calendar-permissions.js +7 -0
  47. package/build/react/use-reminders-permissions.d.ts +8 -0
  48. package/build/react/use-reminders-permissions.js +10 -0
  49. package/build/solid/index.d.ts +3 -0
  50. package/build/solid/index.js +3 -0
  51. package/build/solid/use-calendar-permissions.d.ts +11 -0
  52. package/build/solid/use-calendar-permissions.js +7 -0
  53. package/build/solid/use-reminders-permissions.d.ts +9 -0
  54. package/build/solid/use-reminders-permissions.js +10 -0
  55. package/build/svelte/index.d.ts +3 -0
  56. package/build/svelte/index.js +3 -0
  57. package/build/svelte/use-calendar-permissions.svelte.d.ts +10 -0
  58. package/build/svelte/use-calendar-permissions.svelte.js +7 -0
  59. package/build/svelte/use-reminders-permissions.svelte.d.ts +8 -0
  60. package/build/svelte/use-reminders-permissions.svelte.js +10 -0
  61. package/build/vue/index.d.ts +3 -0
  62. package/build/vue/index.js +3 -0
  63. package/build/vue/use-calendar-permissions.d.ts +11 -0
  64. package/build/vue/use-calendar-permissions.js +7 -0
  65. package/build/vue/use-reminders-permissions.d.ts +9 -0
  66. package/build/vue/use-reminders-permissions.js +10 -0
  67. package/build-ngc/angular/index.d.ts +3 -0
  68. package/build-ngc/angular/index.js +4 -0
  69. package/build-ngc/angular/index.js.map +1 -0
  70. package/build-ngc/angular/services/calendar-permissions.service/index.d.ts +8 -0
  71. package/build-ngc/angular/services/calendar-permissions.service/index.js +17 -0
  72. package/build-ngc/angular/services/calendar-permissions.service/index.js.map +1 -0
  73. package/build-ngc/angular/services/reminders-permissions.service/index.d.ts +8 -0
  74. package/build-ngc/angular/services/reminders-permissions.service/index.js +17 -0
  75. package/build-ngc/angular/services/reminders-permissions.service/index.js.map +1 -0
  76. package/build-ngc/core/attendee.d.ts +9 -0
  77. package/build-ngc/core/attendee.js +29 -0
  78. package/build-ngc/core/attendee.js.map +1 -0
  79. package/build-ngc/core/calendar-permission-api.d.ts +9 -0
  80. package/build-ngc/core/calendar-permission-api.js +10 -0
  81. package/build-ngc/core/calendar-permission-api.js.map +1 -0
  82. package/build-ngc/core/calendar.d.ts +34 -0
  83. package/build-ngc/core/calendar.js +119 -0
  84. package/build-ngc/core/calendar.js.map +1 -0
  85. package/build-ngc/core/enums.d.ts +141 -0
  86. package/build-ngc/core/enums.js +158 -0
  87. package/build-ngc/core/enums.js.map +1 -0
  88. package/build-ngc/core/event.d.ts +14 -0
  89. package/build-ngc/core/event.js +41 -0
  90. package/build-ngc/core/event.js.map +1 -0
  91. package/build-ngc/core/index.d.ts +6 -0
  92. package/build-ngc/core/index.js +7 -0
  93. package/build-ngc/core/index.js.map +1 -0
  94. package/build-ngc/core/native-module.d.ts +154 -0
  95. package/build-ngc/core/native-module.js +4 -0
  96. package/build-ngc/core/native-module.js.map +1 -0
  97. package/build-ngc/core/reminder.d.ts +10 -0
  98. package/build-ngc/core/reminder.js +35 -0
  99. package/build-ngc/core/reminder.js.map +1 -0
  100. package/build-ngc/core/types.d.ts +184 -0
  101. package/build-ngc/core/types.js +2 -0
  102. package/build-ngc/core/types.js.map +1 -0
  103. package/build-ngc/core/utils.d.ts +7 -0
  104. package/build-ngc/core/utils.js +30 -0
  105. package/build-ngc/core/utils.js.map +1 -0
  106. package/native-link.json +29 -0
  107. package/package.json +155 -0
  108. package/src/angular/index.ts +3 -0
  109. package/src/angular/services/calendar-permissions.service/index.ts +19 -0
  110. package/src/angular/services/reminders-permissions.service/index.ts +16 -0
  111. package/src/core/attendee.ts +43 -0
  112. package/src/core/calendar-permission-api.ts +16 -0
  113. package/src/core/calendar.ts +197 -0
  114. package/src/core/enums.ts +156 -0
  115. package/src/core/event.ts +70 -0
  116. package/src/core/index.ts +18 -0
  117. package/src/core/native-module.ts +212 -0
  118. package/src/core/reminder.ts +52 -0
  119. package/src/core/types.ts +209 -0
  120. package/src/core/utils.ts +39 -0
  121. package/src/legacy/calendar.ts +401 -0
  122. package/src/legacy/enums.ts +2 -0
  123. package/src/legacy/index.ts +5 -0
  124. package/src/legacy/native-module.ts +77 -0
  125. package/src/legacy/permissions.ts +47 -0
  126. package/src/legacy/reminders.ts +98 -0
  127. package/src/legacy/types.ts +183 -0
  128. package/src/react/index.ts +3 -0
  129. package/src/react/use-calendar-permissions.ts +25 -0
  130. package/src/react/use-reminders-permissions.ts +25 -0
  131. package/src/solid/index.ts +3 -0
  132. package/src/solid/use-calendar-permissions.ts +26 -0
  133. package/src/solid/use-reminders-permissions.ts +26 -0
  134. package/src/svelte/index.ts +3 -0
  135. package/src/svelte/svelte-ambient.d.ts +3 -0
  136. package/src/svelte/svelte-compile.test-helper.ts +7 -0
  137. package/src/svelte/use-calendar-permissions.svelte.ts +25 -0
  138. package/src/svelte/use-reminders-permissions.svelte.ts +25 -0
  139. package/src/vue/index.ts +3 -0
  140. package/src/vue/use-calendar-permissions.ts +26 -0
  141. package/src/vue/use-reminders-permissions.ts +26 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 A. Prokopenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,189 @@
1
+ # @symbiote-native/calendar
2
+
3
+ Add a meeting to the user's calendar, list what is on this week, set a reminder, or hand the user
4
+ the system's own event dialog. One API for every [SymbioteNative](../../README.md) adapter (React,
5
+ Vue, Svelte, Solid and Angular).
6
+
7
+ It wraps [`expo-calendar`](https://github.com/expo/expo/tree/main/packages/expo-calendar)
8
+ (calendar, event, reminder and attendee CRUD, plus the OS event dialogs) the same way
9
+ [`@symbiote-native/print`](../print) wraps its upstream: `expo-modules-core` is a direct
10
+ dependency and the upstream JS is hand-ported into `core/`. See the `symbiote-expo-native-module`
11
+ project skill for the full mechanism.
12
+
13
+ **Both of upstream's API surfaces are ported, matching Expo's own layout exactly**: the modern
14
+ `SharedObject`-class `ExpoCalendar`/`ExpoCalendarEvent`/`ExpoCalendarReminder`/
15
+ `ExpoCalendarAttendee` API (default entry, mirroring upstream's own default `Calendar.ts`) and
16
+ the legacy function-based API (`/legacy` subpath, mirroring upstream's `legacy/Calendar.ts`).
17
+ Method names, the static-vs-module-level-function split, and per-field platform availability all
18
+ match upstream's real source (`src/Calendar.ts` and `src/legacy/Calendar.ts` at sdk-57) directly.
19
+
20
+ ## Install
21
+
22
+ **New app:**
23
+
24
+ ```bash
25
+ npx @symbiote-native/cli new my-app --calendar
26
+ ```
27
+
28
+ **Existing SymbioteNative app:**
29
+
30
+ ```bash
31
+ npx @symbiote-native/cli add --calendar
32
+ ```
33
+
34
+ Either way: installs `@symbiote-native/calendar` and wires the native autolinking
35
+ automatically, see [`@symbiote-native/cli`](../cli).
36
+
37
+ <details>
38
+ <summary>Manual install (no CLI - installing and wiring native autolinking by hand)</summary>
39
+
40
+ ```bash
41
+ npm install @symbiote-native/calendar
42
+ ```
43
+
44
+ `expo-calendar` and `expo-modules-core` come along as regular, pinned dependencies, never
45
+ install either yourself, and never add the `expo` meta-package to this project.
46
+
47
+ ### Required one-time step: native autolinking wiring
48
+
49
+ Same one-time app wiring every `expo-modules-core` package shares, see
50
+ [`@symbiote-native/print`'s README](../print/README.md#required-one-time-step-native-autolinking-wiring)
51
+ for the full table; nothing package-specific here.
52
+
53
+ ### Permissions and config plugin
54
+
55
+ `native-link.json` declares:
56
+
57
+ - **Android**: `READ_CALENDAR`/`WRITE_CALENDAR` permissions. Both native modules are registered
58
+ and genuinely called by our JS: `ExpoCalendar` (legacy surface, `/legacy` subpath) and
59
+ `CalendarNext` (modern surface, default entry).
60
+ - **iOS**: `NSCalendarsUsageDescription`, `NSRemindersUsageDescription`,
61
+ `NSRemindersFullAccessUsageDescription`, `NSCalendarsFullAccessUsageDescription` (custom
62
+ wording; reword to fit the app).
63
+
64
+ **Not modeled** (upstream's config plugin's `writeOnlyAccess` opt-in, which swaps
65
+ `NSCalendarsFullAccessUsageDescription` for `NSCalendarsWriteOnlyAccessUsageDescription`): this
66
+ manifest format has no iOS equivalent of Android's `optionalManifestBundles` for a plist-key swap.
67
+ If write-only calendar access (iOS 17+) is needed, add
68
+ `NSCalendarsWriteOnlyAccessUsageDescription` to the app's own Info.plist by hand and drop
69
+ `NSCalendarsFullAccessUsageDescription`.
70
+
71
+ </details>
72
+
73
+ ## Platform availability (modern API)
74
+
75
+ | Member | iOS | Android |
76
+ |---|---|---|
77
+ | `ExpoCalendar` CRUD (`createEvent`/`update`/`addEventWithForm`/`delete`), `listEvents` | yes | yes |
78
+ | `getDefaultCalendarSync`/`presentPicker`/`getSourcesSync` (module-level) | yes | no |
79
+ | `calendar.createReminder`/`listReminders` | yes | no |
80
+ | `event.createAttendee` | no | yes |
81
+ | `event.getOccurrenceSync`/`getAttendees`/`update`/`delete` | yes | yes |
82
+ | `ExpoCalendarReminder` (whole class) | yes | no - no-op class, no properties/methods |
83
+ | `ExpoCalendarAttendee` (whole class) | no - no-op class | yes |
84
+ | `getCalendarPermissions`/`requestCalendarPermissions` (module-level) | yes | yes |
85
+ | `getRemindersPermissions`/`requestRemindersPermissions` (module-level) | yes | no |
86
+
87
+ An iOS-only or Android-only member throws `UnavailabilityError` on the other platform, or is
88
+ absent from the native ambient - check for presence before calling if the call site must run on
89
+ both.
90
+
91
+ ## What's not ported
92
+
93
+ Nothing from `expo-calendar`'s public surface. The legacy `requestPermissionsAsync` is kept as the
94
+ deprecated alias upstream ships: it warns and calls `requestCalendarPermissionsAsync`.
95
+
96
+ ## Permission hooks
97
+
98
+ `useCalendarPermissions`/`useRemindersPermissions` are ported to every adapter (originally
99
+ dropped as React-only, since reversed):
100
+
101
+ - React/Vue/Solid: `createPermissionHook` from `@symbiote-native/{react,vue,solid}`, a tuple
102
+ `[status, request, get]`.
103
+ - Svelte: `createPermissionHook` from `@symbiote-native/svelte/runes/create-permission-hook`, a
104
+ boxed getter `{status, requestPermission, getPermission}`.
105
+ - Angular: `CalendarPermissionsService`/`RemindersPermissionsService`, `connect(): Signal<...>`.
106
+
107
+ ## Shape
108
+
109
+ ```
110
+ src/core/ modern SharedObject API (default entry)
111
+ enums.ts every enum (EntityTypes, Frequency, Availability, ...)
112
+ types.ts ICalendarInput/Patch, IEventInput/Patch, IAttendeeInput/Patch, ...
113
+ utils.ts stringifyDateValues, getNullableDetailsFields
114
+ native-module.ts declare class ambients for the 4 SharedObject classes + module fns
115
+ calendar.ts ExpoCalendar class + module-level functions (getCalendars, ...)
116
+ event.ts ExpoCalendarEvent - instance CRUD/attendee methods, static get()
117
+ attendee.ts ExpoCalendarAttendee (android-only surface)
118
+ reminder.ts ExpoCalendarReminder (ios-only surface)
119
+ src/legacy/ legacy function-based API (/legacy subpath)
120
+ enums.ts re-exports src/core/enums.ts - upstream shares one enum source too
121
+ types.ts ICalendar, IEvent, IReminder, IAttendee, IRecurrenceRule, ...
122
+ native-module.ts requireNativeModule('ExpoCalendar')
123
+ calendar.ts every *Async free function (getCalendarsAsync, createEventAsync, ...)
124
+ src/angular/ @symbiote-native/calendar/angular
125
+ ```
126
+
127
+ `./react`, `./vue`, `./svelte`, and `./solid` are `exports`-map aliases straight onto
128
+ `src/core/`. `./legacy` aliases onto `src/legacy/`; there is no separate Angular build for it,
129
+ matching `@symbiote-native/file-system`'s and `@symbiote-native/media-library`'s dual-surface
130
+ precedent.
131
+
132
+ Every wrapper class extends its native `SharedObject` base directly
133
+ (`class ExpoCalendarEvent extends expoCalendarNext.ExpoCalendarEvent`), overriding only the
134
+ methods upstream itself overrides (Date stringification, `getNullableDetailsFields`, prototype
135
+ upgrade of a returned native instance, or a platform guard) - everything else (like
136
+ `openInCalendar`/`editInCalendar`) is inherited from the native ambient untouched, exactly as
137
+ upstream leaves it. A module-level `upgradeToX(native)` helper reassigns a returned native
138
+ instance's prototype in place (`Object.setPrototypeOf`) rather than calling `new` on the native
139
+ class, since Android's Kotlin throws on direct construction of `ExpoCalendar`/`ExpoCalendarEvent`.
140
+
141
+ ## Use it
142
+
143
+ ```ts
144
+ // modern surface (default)
145
+ import { ExpoCalendar, requestCalendarPermissions } from '@symbiote-native/calendar';
146
+
147
+ await requestCalendarPermissions();
148
+ const calendar = await ExpoCalendar.get(calendarId);
149
+ const event = await calendar.createEvent({
150
+ title: 'Standup',
151
+ startDate: new Date(),
152
+ endDate: new Date(Date.now() + 30 * 60_000),
153
+ });
154
+ await event.update({ notes: 'Daily sync' });
155
+ ```
156
+
157
+ ```ts
158
+ // legacy surface
159
+ import { createEventAsync, requestCalendarPermissionsAsync } from '@symbiote-native/calendar/legacy';
160
+
161
+ await requestCalendarPermissionsAsync();
162
+ const eventId = await createEventAsync(calendarId, {
163
+ title: 'Standup',
164
+ startDate: new Date(),
165
+ endDate: new Date(Date.now() + 30 * 60_000),
166
+ });
167
+ ```
168
+
169
+ ## Common questions
170
+
171
+ - **`getCalendars()` or `createEvent` fails or returns nothing.** Call `requestCalendarPermissions()`
172
+ first and check `granted` (Android: `READ_CALENDAR` and `WRITE_CALENDAR`, added for you).
173
+ - **The system event dialog does not appear on iOS, no error.** iOS checks permission before showing
174
+ it: ask first, then call `addEventWithForm`.
175
+ - **Default calendar.** `getDefaultCalendarSync()` is iOS only; on Android list calendars and pick.
176
+ - **Reminders on Android.** iOS only.
177
+ - **Write-only access.** `requestCalendarPermissions(true)` on iOS 17+; swap the Info.plist string by
178
+ hand (see Permissions above).
179
+
180
+ Sources: [Expo docs: Calendar](https://docs.expo.dev/versions/v56.0.0/sdk/calendar-legacy/),
181
+ [expo/expo#36001](https://github.com/expo/expo/issues/36001),
182
+ [expo/expo#4991](https://github.com/expo/expo/issues/4991),
183
+ [expo/expo#48186](https://github.com/expo/expo/pull/48186).
184
+
185
+ ## Test it
186
+
187
+ ```bash
188
+ pnpm vitest run packages/calendar
189
+ ```
@@ -0,0 +1,3 @@
1
+ export * from '../core';
2
+ export { CalendarPermissionsService } from './services/calendar-permissions.service';
3
+ export { RemindersPermissionsService } from './services/reminders-permissions.service';
@@ -0,0 +1,3 @@
1
+ export * from '../core/index.js';
2
+ export { CalendarPermissionsService } from './services/calendar-permissions.service/index.js';
3
+ export { RemindersPermissionsService } from './services/reminders-permissions.service/index.js';
@@ -0,0 +1,5 @@
1
+ import { PermissionsServiceBase } from '@symbiote-native/angular';
2
+ import type { PermissionResponse } from 'expo-modules-core';
3
+ export declare class CalendarPermissionsService extends PermissionsServiceBase<PermissionResponse, boolean> {
4
+ constructor();
5
+ }
@@ -0,0 +1,60 @@
1
+ // Angular twin of `../../react`'s `useCalendarPermissions`, `get`/`request` take `writeOnly`
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ import { Injectable } from '@angular/core';
37
+ import { PermissionsServiceBase } from '@symbiote-native/angular';
38
+ import { getCalendarPermissions, requestCalendarPermissions, } from '../../../core/calendar.js';
39
+ let CalendarPermissionsService = (() => {
40
+ let _classDecorators = [Injectable({ providedIn: 'root' })];
41
+ let _classDescriptor;
42
+ let _classExtraInitializers = [];
43
+ let _classThis;
44
+ let _classSuper = PermissionsServiceBase;
45
+ var CalendarPermissionsService = class extends _classSuper {
46
+ static { _classThis = this; }
47
+ static {
48
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
49
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
50
+ CalendarPermissionsService = _classThis = _classDescriptor.value;
51
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
52
+ __runInitializers(_classThis, _classExtraInitializers);
53
+ }
54
+ constructor() {
55
+ super(getCalendarPermissions, requestCalendarPermissions);
56
+ }
57
+ };
58
+ return CalendarPermissionsService = _classThis;
59
+ })();
60
+ export { CalendarPermissionsService };
@@ -0,0 +1,5 @@
1
+ import { PermissionsServiceBase } from '@symbiote-native/angular';
2
+ import type { PermissionResponse } from 'expo-modules-core';
3
+ export declare class RemindersPermissionsService extends PermissionsServiceBase<PermissionResponse> {
4
+ constructor();
5
+ }
@@ -0,0 +1,60 @@
1
+ // Angular twin of `../../react`'s `useRemindersPermissions`
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ import { Injectable } from '@angular/core';
37
+ import { PermissionsServiceBase } from '@symbiote-native/angular';
38
+ import { getRemindersPermissions, requestRemindersPermissions, } from '../../../core/calendar.js';
39
+ let RemindersPermissionsService = (() => {
40
+ let _classDecorators = [Injectable({ providedIn: 'root' })];
41
+ let _classDescriptor;
42
+ let _classExtraInitializers = [];
43
+ let _classThis;
44
+ let _classSuper = PermissionsServiceBase;
45
+ var RemindersPermissionsService = class extends _classSuper {
46
+ static { _classThis = this; }
47
+ static {
48
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
49
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
50
+ RemindersPermissionsService = _classThis = _classDescriptor.value;
51
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
52
+ __runInitializers(_classThis, _classExtraInitializers);
53
+ }
54
+ constructor() {
55
+ super(getRemindersPermissions, requestRemindersPermissions);
56
+ }
57
+ };
58
+ return RemindersPermissionsService = _classThis;
59
+ })();
60
+ export { RemindersPermissionsService };
@@ -0,0 +1,9 @@
1
+ import { expoCalendarNext } from './native-module';
2
+ import type { NativeExpoCalendarAttendee } from './native-module';
3
+ import type { IAttendeePatch } from './types';
4
+ /** @platform android - iOS registers this class with no properties or methods. */
5
+ export declare class ExpoCalendarAttendee extends expoCalendarNext.ExpoCalendarAttendee {
6
+ update(details: IAttendeePatch): Promise<void>;
7
+ delete(): Promise<void>;
8
+ }
9
+ export declare function upgradeToExpoCalendarAttendee(native: NativeExpoCalendarAttendee): ExpoCalendarAttendee;
@@ -0,0 +1,28 @@
1
+ import { UnavailabilityError } from 'expo-modules-core';
2
+ import { expoCalendarNext } from './native-module.js';
3
+ import { getNullableDetailsFields, stringifyDateValues } from './utils.js';
4
+ /** @platform android - iOS registers this class with no properties or methods. */
5
+ export class ExpoCalendarAttendee extends expoCalendarNext.ExpoCalendarAttendee {
6
+ async update(details) {
7
+ if (!super.update) {
8
+ throw new UnavailabilityError('ExpoCalendarAttendee', 'update');
9
+ }
10
+ return super.update(stringifyDateValues(details), getNullableDetailsFields(details));
11
+ }
12
+ async delete() {
13
+ if (!super.delete) {
14
+ throw new UnavailabilityError('ExpoCalendarAttendee', 'delete');
15
+ }
16
+ return super.delete();
17
+ }
18
+ }
19
+ function isExpoCalendarAttendee(value) {
20
+ return value instanceof ExpoCalendarAttendee;
21
+ }
22
+ export function upgradeToExpoCalendarAttendee(native) {
23
+ Object.setPrototypeOf(native, ExpoCalendarAttendee.prototype);
24
+ if (!isExpoCalendarAttendee(native)) {
25
+ throw new Error('unreachable - just reassigned the prototype to ExpoCalendarAttendee');
26
+ }
27
+ return native;
28
+ }
@@ -0,0 +1,9 @@
1
+ import { splitWriteOnlyPermissionOptions } from '@symbiote-native/engine';
2
+ export type ICalendarPermissionMethodOptions = {
3
+ writeOnly?: boolean;
4
+ };
5
+ export declare const calendarPermissionMethods: {
6
+ getMethod: (options?: ICalendarPermissionMethodOptions) => Promise<import("expo-modules-core").PermissionResponse>;
7
+ requestMethod: (options?: ICalendarPermissionMethodOptions) => Promise<import("expo-modules-core").PermissionResponse>;
8
+ };
9
+ export declare const splitCalendarPermissionOptions: typeof splitWriteOnlyPermissionOptions;
@@ -0,0 +1,9 @@
1
+ // `methods` every adapter's `useCalendarPermissions` binds to the shared
2
+ // `@symbiote-native/{react,vue,solid,svelte}` `createPermissionHook` factory
3
+ import { getCalendarPermissions, requestCalendarPermissions } from './calendar.js';
4
+ import { splitWriteOnlyPermissionOptions } from '@symbiote-native/engine';
5
+ export const calendarPermissionMethods = {
6
+ getMethod: (options) => getCalendarPermissions(options?.writeOnly),
7
+ requestMethod: (options) => requestCalendarPermissions(options?.writeOnly),
8
+ };
9
+ export const splitCalendarPermissionOptions = splitWriteOnlyPermissionOptions;
@@ -0,0 +1,34 @@
1
+ import type { PermissionResponse } from 'expo-modules-core';
2
+ import { expoCalendarNext } from './native-module';
3
+ import type { IAddEventWithFormOptions, ICalendarInput, ICalendarPatch, IDialogEventResult, IEventInput, IReminderInput, ISource } from './types';
4
+ import type { EntityTypes } from './enums';
5
+ import { ExpoCalendarEvent } from './event';
6
+ import { ExpoCalendarReminder } from './reminder';
7
+ export declare class ExpoCalendar extends expoCalendarNext.ExpoCalendar {
8
+ createEvent(details: IEventInput): Promise<ExpoCalendarEvent>;
9
+ /** @platform ios */
10
+ createReminder(details: IReminderInput): Promise<ExpoCalendarReminder>;
11
+ listEvents(startDate: Date, endDate: Date): Promise<ExpoCalendarEvent[]>;
12
+ /** @platform ios */
13
+ listReminders(startDate?: string | Date | null, endDate?: string | Date | null, status?: string | null): Promise<ExpoCalendarReminder[]>;
14
+ update(details: ICalendarPatch): Promise<void>;
15
+ addEventWithForm(options?: IAddEventWithFormOptions): Promise<IDialogEventResult>;
16
+ delete(): Promise<void>;
17
+ static get(calendarId: string): Promise<ExpoCalendar>;
18
+ }
19
+ /** @platform ios - Android has no single system-managed default calendar. */
20
+ export declare function getDefaultCalendarSync(): ExpoCalendar;
21
+ export declare function getCalendars(entityType?: EntityTypes): Promise<ExpoCalendar[]>;
22
+ export declare function createCalendar(details?: ICalendarInput): Promise<ExpoCalendar>;
23
+ /** @platform ios */
24
+ export declare function presentPicker(): Promise<ExpoCalendar | null>;
25
+ /** Searches events across several calendars at once - use `calendar.listEvents()` for one. */
26
+ export declare function listEvents(calendars: (string | ExpoCalendar)[], startDate: Date, endDate: Date): Promise<ExpoCalendarEvent[]>;
27
+ export declare function requestCalendarPermissions(writeOnly?: boolean): Promise<PermissionResponse>;
28
+ export declare function getCalendarPermissions(writeOnly?: boolean): Promise<PermissionResponse>;
29
+ /** @platform ios */
30
+ export declare function requestRemindersPermissions(): Promise<PermissionResponse>;
31
+ /** @platform ios */
32
+ export declare function getRemindersPermissions(): Promise<PermissionResponse>;
33
+ /** @platform ios - Android has no first-class calendar-sources API. */
34
+ export declare function getSourcesSync(): ISource[];
@@ -0,0 +1,118 @@
1
+ import { UnavailabilityError } from 'expo-modules-core';
2
+ import { expoCalendarNext } from './native-module.js';
3
+ import { stringifyDateValues, stringifyIfDate } from './utils.js';
4
+ import { ExpoCalendarEvent, upgradeToExpoCalendarEvent } from './event.js';
5
+ import { ExpoCalendarReminder, upgradeToExpoCalendarReminder, } from './reminder.js';
6
+ export class ExpoCalendar extends expoCalendarNext.ExpoCalendar {
7
+ async createEvent(details) {
8
+ return upgradeToExpoCalendarEvent(await super.createEvent(stringifyDateValues(details)));
9
+ }
10
+ /** @platform ios */
11
+ async createReminder(details) {
12
+ if (!super.createReminder) {
13
+ throw new UnavailabilityError('ExpoCalendar', 'createReminder');
14
+ }
15
+ return upgradeToExpoCalendarReminder(await super.createReminder(stringifyDateValues(details)));
16
+ }
17
+ async listEvents(startDate, endDate) {
18
+ if (!startDate) {
19
+ throw new Error('listEvents must be called with a startDate (date) to search for events');
20
+ }
21
+ if (!endDate) {
22
+ throw new Error('listEvents must be called with an endDate (date) to search for events');
23
+ }
24
+ const events = await super.listEvents(stringifyIfDate(startDate), stringifyIfDate(endDate));
25
+ return events.map(upgradeToExpoCalendarEvent);
26
+ }
27
+ /** @platform ios */
28
+ async listReminders(startDate = null, endDate = null, status = null) {
29
+ if (!super.listReminders) {
30
+ throw new UnavailabilityError('ExpoCalendar', 'listReminders');
31
+ }
32
+ const reminders = await super.listReminders(startDate, endDate, status);
33
+ return reminders.map(upgradeToExpoCalendarReminder);
34
+ }
35
+ async update(details) {
36
+ return super.update(stringifyDateValues(details));
37
+ }
38
+ async addEventWithForm(options) {
39
+ if (!super.addEventWithForm) {
40
+ throw new UnavailabilityError('ExpoCalendar', 'addEventWithForm');
41
+ }
42
+ return super.addEventWithForm(options && stringifyDateValues(options));
43
+ }
44
+ async delete() {
45
+ return super.delete();
46
+ }
47
+ static async get(calendarId) {
48
+ return upgradeToExpoCalendar(await expoCalendarNext.getCalendarById(calendarId));
49
+ }
50
+ }
51
+ function isExpoCalendar(value) {
52
+ return value instanceof ExpoCalendar;
53
+ }
54
+ function upgradeToExpoCalendar(native) {
55
+ Object.setPrototypeOf(native, ExpoCalendar.prototype);
56
+ if (!isExpoCalendar(native)) {
57
+ throw new Error('unreachable - just reassigned the prototype to ExpoCalendar');
58
+ }
59
+ return native;
60
+ }
61
+ /** @platform ios - Android has no single system-managed default calendar. */
62
+ export function getDefaultCalendarSync() {
63
+ if (!expoCalendarNext.getDefaultCalendarSync) {
64
+ throw new UnavailabilityError('Calendar', 'getDefaultCalendarSync');
65
+ }
66
+ return upgradeToExpoCalendar(expoCalendarNext.getDefaultCalendarSync());
67
+ }
68
+ export async function getCalendars(entityType) {
69
+ if (!expoCalendarNext.getCalendars) {
70
+ throw new UnavailabilityError('Calendar', 'getCalendars');
71
+ }
72
+ const calendars = await expoCalendarNext.getCalendars(entityType ?? null);
73
+ return calendars.map(upgradeToExpoCalendar);
74
+ }
75
+ export async function createCalendar(details = {}) {
76
+ return upgradeToExpoCalendar(await expoCalendarNext.createCalendar(details));
77
+ }
78
+ /** @platform ios */
79
+ export async function presentPicker() {
80
+ if (!expoCalendarNext.presentPicker) {
81
+ throw new UnavailabilityError('Calendar', 'presentPicker');
82
+ }
83
+ const calendar = await expoCalendarNext.presentPicker();
84
+ return calendar ? upgradeToExpoCalendar(calendar) : null;
85
+ }
86
+ /** Searches events across several calendars at once - use `calendar.listEvents()` for one. */
87
+ export async function listEvents(calendars, startDate, endDate) {
88
+ const calendarIds = calendars.map(calendar => typeof calendar === 'string' ? calendar : calendar.id);
89
+ const events = await expoCalendarNext.listEvents(calendarIds, stringifyIfDate(startDate), stringifyIfDate(endDate));
90
+ return events.map(upgradeToExpoCalendarEvent);
91
+ }
92
+ export async function requestCalendarPermissions(writeOnly) {
93
+ return expoCalendarNext.requestCalendarPermissions(writeOnly);
94
+ }
95
+ export async function getCalendarPermissions(writeOnly) {
96
+ return expoCalendarNext.getCalendarPermissions(writeOnly);
97
+ }
98
+ /** @platform ios */
99
+ export async function requestRemindersPermissions() {
100
+ if (!expoCalendarNext.requestRemindersPermissions) {
101
+ throw new UnavailabilityError('Calendar', 'requestRemindersPermissions');
102
+ }
103
+ return expoCalendarNext.requestRemindersPermissions();
104
+ }
105
+ /** @platform ios */
106
+ export async function getRemindersPermissions() {
107
+ if (!expoCalendarNext.getRemindersPermissions) {
108
+ throw new UnavailabilityError('Calendar', 'getRemindersPermissions');
109
+ }
110
+ return expoCalendarNext.getRemindersPermissions();
111
+ }
112
+ /** @platform ios - Android has no first-class calendar-sources API. */
113
+ export function getSourcesSync() {
114
+ if (!expoCalendarNext.getSourcesSync) {
115
+ throw new UnavailabilityError('Calendar', 'getSourcesSync');
116
+ }
117
+ return expoCalendarNext.getSourcesSync();
118
+ }