@liff/calendar 2.30.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.
- package/README.md +7 -0
- package/lib/getEvents.d.ts +14 -0
- package/lib/index.cjs.js +1 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.es.js +1 -0
- package/lib/showEventCreationModal.d.ts +7 -0
- package/lib/utils.d.ts +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# `@liff/calendar`
|
|
2
|
+
|
|
3
|
+
**This package is not intended for direct usage, and should only be used via the officially supported [@line/liff](https://www.npmjs.com/package/@line/liff) package.**
|
|
4
|
+
|
|
5
|
+
## License
|
|
6
|
+
|
|
7
|
+
Using LIFF means you agree to the [LINE Developers Agreement](https://terms2.line.me/LINE_Developers_Agreement).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface CalendarEvent {
|
|
2
|
+
title: string;
|
|
3
|
+
startTime: Date;
|
|
4
|
+
endTime: Date;
|
|
5
|
+
}
|
|
6
|
+
export interface GetEventsResult {
|
|
7
|
+
events: CalendarEvent[];
|
|
8
|
+
isThirdPartyCalendarAccessGranted: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface GetEventsParams {
|
|
11
|
+
startTime: Date;
|
|
12
|
+
endTime: Date;
|
|
13
|
+
}
|
|
14
|
+
export declare function getEvents(params: GetEventsParams): Promise<GetEventsResult>;
|
package/lib/index.cjs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("@liff/use"),r=require("@liff/consts"),i=require("@liff/native-bridge"),a=require("@liff/util"),n=require("@liff/is-api-available"),o=function(e){return e instanceof Date&&!Number.isNaN(e.getTime())};function s(t){return e.__awaiter(this,void 0,void 0,function(){var s;return e.__generator(this,function(e){switch(e.label){case 0:if(n.validators["calendar.getEvents"](),!t||!o(t.startTime)||!o(t.endTime))throw a.createLiffError(r.INVALID_ARGUMENT,"'startTime' and 'endTime' must be valid Date objects");if(t.startTime.getTime()>t.endTime.getTime())throw a.createLiffError(r.INVALID_ARGUMENT,"'startTime' must not be later than 'endTime'");return[4,i.call("calendar.getEvents",{startTime:t.startTime.getTime(),endTime:t.endTime.getTime()}).catch(function(e){return a.rethrowNativeError(e,"Failed to call the calendar bridge API")})];case 1:return[2,{events:(s=e.sent()).events.map(function(e){return{title:e.title,startTime:new Date(e.startTime),endTime:new Date(e.endTime)}}),isThirdPartyCalendarAccessGranted:s.isThirdPartyCalendarAccessGranted}]}})})}function l(){return e.__awaiter(this,arguments,void 0,function(t){var s,l,d,c;return void 0===t&&(t={}),e.__generator(this,function(e){switch(e.label){case 0:if(n.validators["calendar.showEventCreationModal"](),s=t.title,l=t.startTime,d=t.endTime,c=t.isAllDay,void 0!==l&&!o(l))throw a.createLiffError(r.INVALID_ARGUMENT,"'startTime' must be a valid Date object");if(void 0!==d&&!o(d))throw a.createLiffError(r.INVALID_ARGUMENT,"'endTime' must be a valid Date object");return[4,i.call("calendar.showEventCreationModal",{title:s,mentionedDate:l?l.getTime():void 0,endTime:d?d.getTime():void 0,isAllDay:c}).catch(function(e){return a.rethrowNativeError(e,"Failed to call the calendar bridge API")})];case 1:return e.sent(),[2]}})})}var d=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e.__extends(r,t),Object.defineProperty(r.prototype,"name",{get:function(){return"calendar"},enumerable:!1,configurable:!0}),r.prototype.install=function(){return{getEvents:s,showEventCreationModal:l}},r}(t.LiffModule),c=new d;exports.CalendarModule=d,exports.getEvents=s,exports.module=c,exports.showEventCreationModal=l;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LiffModule } from '@liff/use';
|
|
2
|
+
import { getEvents } from './getEvents';
|
|
3
|
+
import { showEventCreationModal } from './showEventCreationModal';
|
|
4
|
+
export * from './getEvents';
|
|
5
|
+
export * from './showEventCreationModal';
|
|
6
|
+
export interface CalendarMethods {
|
|
7
|
+
getEvents: typeof getEvents;
|
|
8
|
+
showEventCreationModal: typeof showEventCreationModal;
|
|
9
|
+
}
|
|
10
|
+
export interface ExtendLiffCore {
|
|
11
|
+
calendar: CalendarMethods;
|
|
12
|
+
}
|
|
13
|
+
export declare class CalendarModule extends LiffModule<CalendarMethods, never, unknown> {
|
|
14
|
+
get name(): string;
|
|
15
|
+
install(): CalendarMethods;
|
|
16
|
+
}
|
|
17
|
+
export declare const module: CalendarModule;
|
package/lib/index.es.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as e,__generator as t,__extends as i}from"tslib";import{LiffModule as n}from"@liff/use";import{INVALID_ARGUMENT as r}from"@liff/consts";import{call as a}from"@liff/native-bridge";import{createLiffError as o,rethrowNativeError as s}from"@liff/util";import{validators as l}from"@liff/is-api-available";var m=function(e){return e instanceof Date&&!Number.isNaN(e.getTime())};function d(i){return e(this,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:if(l["calendar.getEvents"](),!i||!m(i.startTime)||!m(i.endTime))throw o(r,"'startTime' and 'endTime' must be valid Date objects");if(i.startTime.getTime()>i.endTime.getTime())throw o(r,"'startTime' must not be later than 'endTime'");return[4,a("calendar.getEvents",{startTime:i.startTime.getTime(),endTime:i.endTime.getTime()}).catch(function(e){return s(e,"Failed to call the calendar bridge API")})];case 1:return[2,{events:(e=t.sent()).events.map(function(e){return{title:e.title,startTime:new Date(e.startTime),endTime:new Date(e.endTime)}}),isThirdPartyCalendarAccessGranted:e.isThirdPartyCalendarAccessGranted}]}})})}function c(){return e(this,arguments,void 0,function(e){var i,n,d,c;return void 0===e&&(e={}),t(this,function(t){switch(t.label){case 0:if(l["calendar.showEventCreationModal"](),i=e.title,n=e.startTime,d=e.endTime,c=e.isAllDay,void 0!==n&&!m(n))throw o(r,"'startTime' must be a valid Date object");if(void 0!==d&&!m(d))throw o(r,"'endTime' must be a valid Date object");return[4,a("calendar.showEventCreationModal",{title:i,mentionedDate:n?n.getTime():void 0,endTime:d?d.getTime():void 0,isAllDay:c}).catch(function(e){return s(e,"Failed to call the calendar bridge API")})];case 1:return t.sent(),[2]}})})}var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"calendar"},enumerable:!1,configurable:!0}),t.prototype.install=function(){return{getEvents:d,showEventCreationModal:c}},t}(n),f=new u;export{u as CalendarModule,d as getEvents,f as module,c as showEventCreationModal};
|
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isValidDate: (value: unknown) => value is Date;
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@liff/calendar",
|
|
3
|
+
"version": "2.30.0",
|
|
4
|
+
"description": "@liff/calendar",
|
|
5
|
+
"license": "SEE LICENSE IN README.md",
|
|
6
|
+
"main": "lib/index.cjs.js",
|
|
7
|
+
"module": "lib/index.es.js",
|
|
8
|
+
"types": "lib/index.d.ts",
|
|
9
|
+
"directories": {
|
|
10
|
+
"lib": "lib"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"lib"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"registry": "https://registry.npmjs.org"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"typecheck": "tsc --noEmit",
|
|
22
|
+
"build:cdn": "rollup -c rollup.config.js",
|
|
23
|
+
"build:npm": "rollup -c rollup.config.js",
|
|
24
|
+
"build:watch": "npm run build:npm -- --watch",
|
|
25
|
+
"dev-server": "npm run build:watch",
|
|
26
|
+
"dev-server:https": "npm run build:watch",
|
|
27
|
+
"build:prerelease": "rollup -c rollup.config.prerelease.js",
|
|
28
|
+
"clean": "rm -rf ./lib ./tsconfig.tsbuildinfo"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@liff/consts": "2.30.0",
|
|
32
|
+
"@liff/is-api-available": "2.30.0",
|
|
33
|
+
"@liff/native-bridge": "2.30.0",
|
|
34
|
+
"@liff/use": "2.30.0",
|
|
35
|
+
"@liff/util": "2.30.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"tslib": "^2.3.0"
|
|
39
|
+
}
|
|
40
|
+
}
|