@liff/calendar 2.30.0 → 2.31.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.
@@ -2,6 +2,7 @@ export interface CalendarEvent {
2
2
  title: string;
3
3
  startTime: Date;
4
4
  endTime: Date;
5
+ isAllDay: boolean;
5
6
  }
6
7
  export interface GetEventsResult {
7
8
  events: CalendarEvent[];
package/lib/index.cjs.js CHANGED
@@ -1 +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;
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 l(t){return e.__awaiter(this,void 0,void 0,function(){var l;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:(l=e.sent()).events.map(function(e){var t;return{title:e.title,startTime:new Date(e.startTime),endTime:new Date(e.endTime),isAllDay:null!==(t=e.isAllDay)&&void 0!==t&&t}}),isThirdPartyCalendarAccessGranted:l.isThirdPartyCalendarAccessGranted}]}})})}function s(){return e.__awaiter(this,arguments,void 0,function(t){var l,s,d,u;return void 0===t&&(t={}),e.__generator(this,function(e){switch(e.label){case 0:if(n.validators["calendar.showEventCreationModal"](),l=t.title,s=t.startTime,d=t.endTime,u=t.isAllDay,void 0!==s&&!o(s))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:l,mentionedDate:s?s.getTime():void 0,endTime:d?d.getTime():void 0,isAllDay:u}).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:l,showEventCreationModal:s}},r}(t.LiffModule),u=new d;exports.CalendarModule=d,exports.getEvents=l,exports.module=u,exports.showEventCreationModal=s;
package/lib/index.es.js CHANGED
@@ -1 +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};
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 l}from"@liff/util";import{validators as s}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(s["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 l(e,"Failed to call the calendar bridge API")})];case 1:return[2,{events:(e=t.sent()).events.map(function(e){var t;return{title:e.title,startTime:new Date(e.startTime),endTime:new Date(e.endTime),isAllDay:null!==(t=e.isAllDay)&&void 0!==t&&t}}),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(s["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 l(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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liff/calendar",
3
- "version": "2.30.0",
3
+ "version": "2.31.0",
4
4
  "description": "@liff/calendar",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "main": "lib/index.cjs.js",
@@ -28,11 +28,11 @@
28
28
  "clean": "rm -rf ./lib ./tsconfig.tsbuildinfo"
29
29
  },
30
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"
31
+ "@liff/consts": "2.31.0",
32
+ "@liff/is-api-available": "2.31.0",
33
+ "@liff/native-bridge": "2.31.0",
34
+ "@liff/use": "2.31.0",
35
+ "@liff/util": "2.31.0"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "tslib": "^2.3.0"