Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ebarooni/capacitor-calendar

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ebarooni/capacitor-calendar - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

ios/Plugin/Calendar.swift

129

dist/docs.json

@@ -15,3 +15,3 @@ {

"docs": "An object with the name of the permission",
"type": "{ alias: 'readCalendar'; }"
"type": "{ alias: keyof CalendarPermissionStatus; }"
}

@@ -75,3 +75,3 @@ ],

"docs": "An object with the name of the permission",
"type": "{ alias: 'readCalendar'; }"
"type": "{ alias: keyof CalendarPermissionStatus; }"
}

@@ -130,5 +130,5 @@ ],

"name": "createEventWithPrompt",
"signature": "() => Promise<{ result: CalendarEventActionResult; }>",
"signature": "() => Promise<{ eventCreated: boolean; }>",
"parameters": [],
"returns": "Promise<{ result: CalendarEventActionResult; }>",
"returns": "Promise<{ eventCreated: boolean; }>",
"tags": [

@@ -140,14 +140,52 @@ {

"name": "returns",
"text": ";{ result: CalendarEventActionResult }&gt;} – A promise that resolves with the result of the action."
"text": ";{ eventCreated: boolean }&gt;} – A promise that resolves with the result of the action."
},
{
"name": "example",
"text": "let result: CalendarEventActionResult;\nif (capacitor.getPlatform() === 'android') {\n const readCalendarStatus = this.requestPermission({ alias: 'readCalendar' }).result;\n if (readCalendarStatus === 'granted') {\n result = await this.createEventWithPrompt();\n } else {\n // handle the case when user rejects the permission\n }\n} else {\n result = await this.createEventWithPrompt();\n}"
"text": "let result: CalendarEventActionResult;\nif (capacitor.getPlatform() === 'android') {\n const readCalendarStatus = (await this.requestPermission({ alias: 'readCalendar' })).result;\n if (readCalendarStatus === 'granted') {\n result = await this.createEventWithPrompt();\n } else {\n // handle the case when user rejects the permission\n }\n} else {\n result = await this.createEventWithPrompt();\n}"
}
],
"docs": "Creates an event in the calendar by using the native calendar.\nOn iOS opens a native sheet and on Android opens an intent.\nThis method does not need any read or write authorization from the user on iOS. However, the entries in the Info.plist file are still needed.\nOn Android, the user has to authorize for read access.",
"complexTypes": [],
"slug": "createeventwithprompt"
},
{
"name": "selectCalendarsWithPrompt",
"signature": "(options: { displayStyle: CalendarChooserDisplayStyle; selectionStyle: CalendarChooserSelectionStyle; }) => Promise<{ result: Calendar[]; }>",
"parameters": [
{
"name": "options",
"docs": "- Options for customizing the display and selection styles of the calendar chooser.",
"type": "{ displayStyle: CalendarChooserDisplayStyle; selectionStyle: CalendarChooserSelectionStyle; }"
}
],
"returns": "Promise<{ result: Calendar[]; }>",
"tags": [
{
"name": "method",
"text": "selectCalendarsWithPrompt"
},
{
"name": "param",
"text": "options - Options for customizing the display and selection styles of the calendar chooser."
},
{
"name": "async"
},
{
"name": "returns",
"text": "A promise that resolves with an array of selected calendars,\nwhere each calendar object contains an ID and a title."
},
{
"name": "example",
"text": "if (capacitor.getPlatform() === 'ios') {\n const selectedCalendars = await selectCalendarsWithPrompt();\n console.log(selectedCalendars); // [{ id: '1', title: 'Work Calendar' }]\n}"
}
],
"docs": "Presents a prompt to the user to select calendars. This method is available only on iOS.",
"complexTypes": [
"CalendarEventActionResult"
"Calendar",
"CalendarChooserDisplayStyle",
"CalendarChooserSelectionStyle"
],
"slug": "createeventwithprompt"
"slug": "selectcalendarswithprompt"
}

@@ -177,4 +215,49 @@ ],

"type": "PermissionState"
},
{
"name": "writeCalendar",
"tags": [],
"docs": "",
"complexTypes": [
"PermissionState"
],
"type": "PermissionState"
}
]
},
{
"name": "Calendar",
"slug": "calendar",
"docs": "Represents a calendar object with an ID and title.",
"tags": [
{
"text": "Calendar",
"name": "interface"
},
{
"text": "{string} id - The unique identifier of the calendar.",
"name": "property"
},
{
"text": "{string} title - The title or name of the calendar.",
"name": "property"
}
],
"methods": [],
"properties": [
{
"name": "id",
"tags": [],
"docs": "",
"complexTypes": [],
"type": "string"
},
{
"name": "title",
"tags": [],
"docs": "",
"complexTypes": [],
"type": "string"
}
]
}

@@ -184,22 +267,30 @@ ],

{
"name": "CalendarEventActionResult",
"slug": "calendareventactionresult",
"name": "CalendarChooserDisplayStyle",
"slug": "calendarchooserdisplaystyle",
"members": [
{
"name": "Saved",
"value": "'saved'",
"name": "ALL_CALENDARS",
"tags": [],
"docs": ""
"docs": "Display all calendars available for selection."
},
{
"name": "Canceled",
"value": "'canceled'",
"name": "WRITABLE_CALENDARS_ONLY",
"tags": [],
"docs": ""
"docs": "Display only writable calendars available for selection."
}
]
},
{
"name": "CalendarChooserSelectionStyle",
"slug": "calendarchooserselectionstyle",
"members": [
{
"name": "SINGLE",
"tags": [],
"docs": "Allows only a single selection in the calendar chooser."
},
{
"name": "Error",
"value": "'error'",
"name": "MULTIPLE",
"tags": [],
"docs": ""
"docs": "Allows multiple selections in the calendar chooser."
}

@@ -206,0 +297,0 @@ ]

import type { PermissionState } from '@capacitor/core';
/**
* Enum for the possible results of actions performed on a calendar event.
* "saved" for completion of an operation. "Canceled" for a canceled process and "error"
* for when something went wrong.
*
* Enum representing the selection style for the calendar chooser.
* @readonly
* @enum
*/
export declare enum CalendarEventActionResult {
Saved = "saved",
Canceled = "canceled",
Error = "error"
export declare enum CalendarChooserSelectionStyle {
/**
* Allows only a single selection in the calendar chooser.
*/
SINGLE = 0,
/**
* Allows multiple selections in the calendar chooser.
*/
MULTIPLE = 1
}
/**
* Enum representing the display styles for the calendar chooser.
* @enum
*/
export declare enum CalendarChooserDisplayStyle {
/**
* Display all calendars available for selection.
*/
ALL_CALENDARS = 0,
/**
* Display only writable calendars available for selection.
*/
WRITABLE_CALENDARS_ONLY = 1
}
/**
* Represents a calendar object with an ID and title.
*
* @interface Calendar
* @property {string} id - The unique identifier of the calendar.
* @property {string} title - The title or name of the calendar.
*/
export interface Calendar {
id: string;
title: string;
}
/**
* Describes the permission status for reading from the calendar.

@@ -21,2 +49,3 @@ *

readCalendar: PermissionState;
writeCalendar: PermissionState;
}

@@ -78,7 +107,7 @@ export interface CapacitorCalendarPlugin {

* @method
* @returns {Promise&lt;{ result: CalendarEventActionResult }&gt;} – A promise that resolves with the result of the action.
* @returns {Promise&lt;{ eventCreated: boolean }&gt;} – A promise that resolves with the result of the action.
* @example
* let result: CalendarEventActionResult;
* if (capacitor.getPlatform() === 'android') {
* const readCalendarStatus = this.requestPermission({ alias: 'readCalendar' }).result;
* const readCalendarStatus = (await this.requestPermission({ alias: 'readCalendar' })).result;
* if (readCalendarStatus === 'granted') {

@@ -94,4 +123,24 @@ * result = await this.createEventWithPrompt();

createEventWithPrompt(): Promise<{
result: CalendarEventActionResult;
eventCreated: boolean;
}>;
/**
* Presents a prompt to the user to select calendars. This method is available only on iOS.
*
* @method selectCalendarsWithPrompt
* @param {object} options - Options for customizing the display and selection styles of the calendar chooser.
* @async
* @returns { Promise<{ result: Calendar[] }> } A promise that resolves with an array of selected calendars,
* where each calendar object contains an ID and a title.
* @example
* if (capacitor.getPlatform() === 'ios') {
* const selectedCalendars = await selectCalendarsWithPrompt();
* console.log(selectedCalendars); // [{ id: '1', title: 'Work Calendar' }]
* }
*/
selectCalendarsWithPrompt(options: {
displayStyle: CalendarChooserDisplayStyle;
selectionStyle: CalendarChooserSelectionStyle;
}): Promise<{
result: Calendar[];
}>;
}

38

dist/esm/definitions.js
/**
* Enum for the possible results of actions performed on a calendar event.
* "saved" for completion of an operation. "Canceled" for a canceled process and "error"
* for when something went wrong.
*
* Enum representing the selection style for the calendar chooser.
* @readonly
* @enum
*/
export var CalendarEventActionResult;
(function (CalendarEventActionResult) {
CalendarEventActionResult["Saved"] = "saved";
CalendarEventActionResult["Canceled"] = "canceled";
CalendarEventActionResult["Error"] = "error";
})(CalendarEventActionResult || (CalendarEventActionResult = {}));
export var CalendarChooserSelectionStyle;
(function (CalendarChooserSelectionStyle) {
/**
* Allows only a single selection in the calendar chooser.
*/
CalendarChooserSelectionStyle[CalendarChooserSelectionStyle["SINGLE"] = 0] = "SINGLE";
/**
* Allows multiple selections in the calendar chooser.
*/
CalendarChooserSelectionStyle[CalendarChooserSelectionStyle["MULTIPLE"] = 1] = "MULTIPLE";
})(CalendarChooserSelectionStyle || (CalendarChooserSelectionStyle = {}));
/**
* Enum representing the display styles for the calendar chooser.
* @enum
*/
export var CalendarChooserDisplayStyle;
(function (CalendarChooserDisplayStyle) {
/**
* Display all calendars available for selection.
*/
CalendarChooserDisplayStyle[CalendarChooserDisplayStyle["ALL_CALENDARS"] = 0] = "ALL_CALENDARS";
/**
* Display only writable calendars available for selection.
*/
CalendarChooserDisplayStyle[CalendarChooserDisplayStyle["WRITABLE_CALENDARS_ONLY"] = 1] = "WRITABLE_CALENDARS_ONLY";
})(CalendarChooserDisplayStyle || (CalendarChooserDisplayStyle = {}));
//# sourceMappingURL=definitions.js.map
import { PermissionState, WebPlugin } from '@capacitor/core';
import { CapacitorCalendarPlugin, CalendarEventActionResult, CalendarPermissionStatus } from './definitions';
import { CapacitorCalendarPlugin, CalendarPermissionStatus, Calendar } from './definitions';
export declare class CapacitorCalendarWeb extends WebPlugin implements CapacitorCalendarPlugin {

@@ -17,4 +17,7 @@ checkPermission(_options: {

createEventWithPrompt(): Promise<{
result: CalendarEventActionResult;
eventCreated: boolean;
}>;
selectCalendarsWithPrompt(): Promise<{
result: Calendar[];
}>;
}

@@ -18,3 +18,6 @@ import { WebPlugin } from '@capacitor/core';

}
selectCalendarsWithPrompt() {
throw this.unimplemented(`${this.createEventWithPrompt.name} is not implemented on the web`);
}
}
//# sourceMappingURL=web.js.map

@@ -8,14 +8,32 @@ 'use strict';

/**
* Enum for the possible results of actions performed on a calendar event.
* "saved" for completion of an operation. "Canceled" for a canceled process and "error"
* for when something went wrong.
*
* Enum representing the selection style for the calendar chooser.
* @readonly
* @enum
*/
exports.CalendarEventActionResult = void 0;
(function (CalendarEventActionResult) {
CalendarEventActionResult["Saved"] = "saved";
CalendarEventActionResult["Canceled"] = "canceled";
CalendarEventActionResult["Error"] = "error";
})(exports.CalendarEventActionResult || (exports.CalendarEventActionResult = {}));
exports.CalendarChooserSelectionStyle = void 0;
(function (CalendarChooserSelectionStyle) {
/**
* Allows only a single selection in the calendar chooser.
*/
CalendarChooserSelectionStyle[CalendarChooserSelectionStyle["SINGLE"] = 0] = "SINGLE";
/**
* Allows multiple selections in the calendar chooser.
*/
CalendarChooserSelectionStyle[CalendarChooserSelectionStyle["MULTIPLE"] = 1] = "MULTIPLE";
})(exports.CalendarChooserSelectionStyle || (exports.CalendarChooserSelectionStyle = {}));
/**
* Enum representing the display styles for the calendar chooser.
* @enum
*/
exports.CalendarChooserDisplayStyle = void 0;
(function (CalendarChooserDisplayStyle) {
/**
* Display all calendars available for selection.
*/
CalendarChooserDisplayStyle[CalendarChooserDisplayStyle["ALL_CALENDARS"] = 0] = "ALL_CALENDARS";
/**
* Display only writable calendars available for selection.
*/
CalendarChooserDisplayStyle[CalendarChooserDisplayStyle["WRITABLE_CALENDARS_ONLY"] = 1] = "WRITABLE_CALENDARS_ONLY";
})(exports.CalendarChooserDisplayStyle || (exports.CalendarChooserDisplayStyle = {}));

@@ -42,2 +60,5 @@ const CapacitorCalendar = core.registerPlugin('CapacitorCalendar', {

}
selectCalendarsWithPrompt() {
throw this.unimplemented(`${this.createEventWithPrompt.name} is not implemented on the web`);
}
}

@@ -44,0 +65,0 @@

@@ -5,14 +5,32 @@ var capacitorCapacitorCalendar = (function (exports, core) {

/**
* Enum for the possible results of actions performed on a calendar event.
* "saved" for completion of an operation. "Canceled" for a canceled process and "error"
* for when something went wrong.
*
* Enum representing the selection style for the calendar chooser.
* @readonly
* @enum
*/
exports.CalendarEventActionResult = void 0;
(function (CalendarEventActionResult) {
CalendarEventActionResult["Saved"] = "saved";
CalendarEventActionResult["Canceled"] = "canceled";
CalendarEventActionResult["Error"] = "error";
})(exports.CalendarEventActionResult || (exports.CalendarEventActionResult = {}));
exports.CalendarChooserSelectionStyle = void 0;
(function (CalendarChooserSelectionStyle) {
/**
* Allows only a single selection in the calendar chooser.
*/
CalendarChooserSelectionStyle[CalendarChooserSelectionStyle["SINGLE"] = 0] = "SINGLE";
/**
* Allows multiple selections in the calendar chooser.
*/
CalendarChooserSelectionStyle[CalendarChooserSelectionStyle["MULTIPLE"] = 1] = "MULTIPLE";
})(exports.CalendarChooserSelectionStyle || (exports.CalendarChooserSelectionStyle = {}));
/**
* Enum representing the display styles for the calendar chooser.
* @enum
*/
exports.CalendarChooserDisplayStyle = void 0;
(function (CalendarChooserDisplayStyle) {
/**
* Display all calendars available for selection.
*/
CalendarChooserDisplayStyle[CalendarChooserDisplayStyle["ALL_CALENDARS"] = 0] = "ALL_CALENDARS";
/**
* Display only writable calendars available for selection.
*/
CalendarChooserDisplayStyle[CalendarChooserDisplayStyle["WRITABLE_CALENDARS_ONLY"] = 1] = "WRITABLE_CALENDARS_ONLY";
})(exports.CalendarChooserDisplayStyle || (exports.CalendarChooserDisplayStyle = {}));

@@ -39,2 +57,5 @@ const CapacitorCalendar = core.registerPlugin('CapacitorCalendar', {

}
selectCalendarsWithPrompt() {
throw this.unimplemented(`${this.createEventWithPrompt.name} is not implemented on the web`);
}
}

@@ -41,0 +62,0 @@

{
"name": "@ebarooni/capacitor-calendar",
"version": "0.1.0",
"version": "0.2.0",
"description": "The Capacitor Calendar Plugin exposes functionalities for interacting with the calendar of iOS and Android devices.",

@@ -31,3 +31,3 @@ "main": "dist/plugin.cjs.js",

],
"homepage": "https://github.com/ebarooni/capacitor-calendar",
"homepage": "https://capacitor-calendar.pages.dev",
"scripts": {

@@ -34,0 +34,0 @@ "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",

@@ -10,10 +10,5 @@ <h1 align="center">CapacitorCalendar</h1>

<p align="center">
<a href="https://capacitor-calendar.netlify.app/"><strong>https://capacitor-calendar.netlify.app</strong></a>
<a href="https://capacitor-calendar.pages.dev/"><strong>https://capacitor-calendar.pages.dev</strong></a>
<br>
</p>
<p align="center">
<a href="https://app.netlify.com/sites/capacitor-calendar/deploys">
<img src="https://api.netlify.com/api/v1/badges/0f1a6d09-740f-4f52-889c-38ff57d11380/deploy-status" alt="Netlify Status">
</a>&nbsp;
</p>

@@ -23,3 +18,3 @@ ## Table of Contents

- [Demo](#demo--click-for-details-)
- [Upcoming Features](#upcoming-features)
- [MVP](#mvp)
- [Support Range](#support-range)

@@ -40,8 +35,9 @@ - [Install](#install)

## Upcoming Features
## MVP
- [ ] Create calendar events without native prompts
- [ ] Create reminders (iOS)
- [ ] Find calendar events
- [ ] Delete calendar events
- ✅ Choose calendars with prompt (only supported on iOS)
- ⌛ Create calendar events without native prompts
- ⌛️ Create reminders (only supported on iOS)
- ⌛️ Find calendar events
- ⌛️ Delete calendar events

@@ -79,2 +75,3 @@ ## Support Range

* [`createEventWithPrompt()`](#createeventwithprompt)
* [`selectCalendarsWithPrompt(...)`](#selectcalendarswithprompt)
* [Interfaces](#interfaces)

@@ -97,5 +94,5 @@ * [Type Aliases](#type-aliases)

| Param | Type | Description |
| ------------- | --------------------------------------- | ----------------------------------------- |
| **`options`** | <code>{ alias: 'readCalendar'; }</code> | An object with the name of the permission |
| Param | Type | Description |
| ------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------- |
| **`options`** | <code>{ alias: keyof <a href="#calendarpermissionstatus">CalendarPermissionStatus</a>; }</code> | An object with the name of the permission |

@@ -129,5 +126,5 @@ **Returns:** <code>Promise&lt;{ result: <a href="#permissionstate">PermissionState</a>; }&gt;</code>

| Param | Type | Description |
| ------------- | --------------------------------------- | ----------------------------------------- |
| **`options`** | <code>{ alias: 'readCalendar'; }</code> | An object with the name of the permission |
| Param | Type | Description |
| ------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------- |
| **`options`** | <code>{ alias: keyof <a href="#calendarpermissionstatus">CalendarPermissionStatus</a>; }</code> | An object with the name of the permission |

@@ -155,3 +152,3 @@ **Returns:** <code>Promise&lt;{ result: <a href="#permissionstate">PermissionState</a>; }&gt;</code>

```typescript
createEventWithPrompt() => Promise<{ result: CalendarEventActionResult; }>
createEventWithPrompt() => Promise<{ eventCreated: boolean; }>
```

@@ -164,3 +161,3 @@

**Returns:** <code>Promise&lt;{ result: <a href="#calendareventactionresult">CalendarEventActionResult</a>; }&gt;</code>
**Returns:** <code>Promise&lt;{ eventCreated: boolean; }&gt;</code>

@@ -170,2 +167,19 @@ --------------------

### selectCalendarsWithPrompt(...)
```typescript
selectCalendarsWithPrompt(options: { displayStyle: CalendarChooserDisplayStyle; selectionStyle: CalendarChooserSelectionStyle; }) => Promise<{ result: Calendar[]; }>
```
Presents a prompt to the user to select calendars. This method is available only on iOS.
| Param | Type | Description |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| **`options`** | <code>{ displayStyle: <a href="#calendarchooserdisplaystyle">CalendarChooserDisplayStyle</a>; selectionStyle: <a href="#calendarchooserselectionstyle">CalendarChooserSelectionStyle</a>; }</code> | - Options for customizing the display and selection styles of the calendar chooser. |
**Returns:** <code>Promise&lt;{ result: Calendar[]; }&gt;</code>
--------------------
### Interfaces

@@ -178,7 +192,18 @@

| Prop | Type |
| ------------------ | ----------------------------------------------------------- |
| **`readCalendar`** | <code><a href="#permissionstate">PermissionState</a></code> |
| Prop | Type |
| ------------------- | ----------------------------------------------------------- |
| **`readCalendar`** | <code><a href="#permissionstate">PermissionState</a></code> |
| **`writeCalendar`** | <code><a href="#permissionstate">PermissionState</a></code> |
#### Calendar
Represents a calendar object with an ID and title.
| Prop | Type |
| ----------- | ------------------- |
| **`id`** | <code>string</code> |
| **`title`** | <code>string</code> |
### Type Aliases

@@ -195,10 +220,17 @@

#### CalendarEventActionResult
#### CalendarChooserDisplayStyle
| Members | Value |
| -------------- | ----------------------- |
| **`Saved`** | <code>'saved'</code> |
| **`Canceled`** | <code>'canceled'</code> |
| **`Error`** | <code>'error'</code> |
| Members | Description |
| ----------------------------- | -------------------------------------------------------- |
| **`ALL_CALENDARS`** | Display all calendars available for selection. |
| **`WRITABLE_CALENDARS_ONLY`** | Display only writable calendars available for selection. |
#### CalendarChooserSelectionStyle
| Members | Description |
| -------------- | ------------------------------------------------------- |
| **`SINGLE`** | Allows only a single selection in the calendar chooser. |
| **`MULTIPLE`** | Allows multiple selections in the calendar chooser. |
</docgen-api>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc