@fullcalendar/google-calendar 7.0.0-beta.4 → 7.0.0-beta.5
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/LICENSE.md +1 -1
- package/README.md +7 -1
- package/{index.cjs → cjs/index.cjs} +8 -9
- package/esm/index.d.ts +35 -0
- package/{index.js → esm/index.js} +2 -3
- package/{index.global.js → global.js} +2 -3
- package/{index.global.min.js → global.min.js} +2 -2
- package/package.json +17 -14
- package/index.d.ts +0 -30
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -19,12 +19,18 @@ Instantiate a Calendar with the necessary plugin:
|
|
|
19
19
|
import { Calendar } from '@fullcalendar/core'
|
|
20
20
|
import googleCalendarPlugin from '@fullcalendar/google-calendar'
|
|
21
21
|
import dayGridPlugin from '@fullcalendar/daygrid'
|
|
22
|
+
import classicThemePlugin from '@fullcalendar/theme-classic'
|
|
23
|
+
|
|
24
|
+
import '@fullcalendar/core/skeleton.css'
|
|
25
|
+
import '@fullcalendar/theme-classic/theme.css'
|
|
26
|
+
import '@fullcalendar/theme-classic/palette.css'
|
|
22
27
|
|
|
23
28
|
const calendarEl = document.getElementById('calendar')
|
|
24
29
|
const calendar = new Calendar(calendarEl, {
|
|
25
30
|
plugins: [
|
|
26
31
|
googleCalendarPlugin,
|
|
27
|
-
dayGridPlugin
|
|
32
|
+
dayGridPlugin,
|
|
33
|
+
classicThemePlugin
|
|
28
34
|
],
|
|
29
35
|
initialView: 'dayGridMonth',
|
|
30
36
|
events: {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var core = require('@fullcalendar/core');
|
|
6
|
+
var internal = require('@fullcalendar/core/internal');
|
|
7
7
|
|
|
8
8
|
// TODO: expose somehow
|
|
9
9
|
const API_BASE = 'https://www.googleapis.com/calendar/v3/calendars';
|
|
@@ -36,9 +36,9 @@ const eventSourceDef = {
|
|
|
36
36
|
let { extraParams } = meta;
|
|
37
37
|
let extraParamsObj = typeof extraParams === 'function' ? extraParams() : extraParams;
|
|
38
38
|
let requestParams = buildRequestParams(arg.range, apiKey, extraParamsObj, dateEnv);
|
|
39
|
-
return
|
|
39
|
+
return internal.requestJson('GET', url, requestParams).then(([body, response]) => {
|
|
40
40
|
if (body.error) {
|
|
41
|
-
errorCallback(new
|
|
41
|
+
errorCallback(new core.JsonRequestError('Google Calendar API: ' + body.error.message, response));
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
44
|
successCallback({
|
|
@@ -83,8 +83,8 @@ function buildRequestParams(range, apiKey, extraParams, dateEnv) {
|
|
|
83
83
|
// when timezone isn't known, we don't know what the UTC offset should be, so ask for +/- 1 day
|
|
84
84
|
// from the UTC day-start to guarantee we're getting all the events
|
|
85
85
|
// (start/end will be UTC-coerced dates, so toISOString is okay)
|
|
86
|
-
startStr =
|
|
87
|
-
endStr =
|
|
86
|
+
startStr = internal.addDays(range.start, -1).toISOString();
|
|
87
|
+
endStr = internal.addDays(range.end, 1).toISOString();
|
|
88
88
|
}
|
|
89
89
|
params = Object.assign(Object.assign({}, (extraParams || {})), { key: apiKey, timeMin: startStr, timeMax: endStr, singleEvents: true, maxResults: 9999 });
|
|
90
90
|
if (dateEnv.timeZone !== 'local') {
|
|
@@ -123,15 +123,14 @@ function injectQsComponent(url, component) {
|
|
|
123
123
|
const OPTION_REFINERS = {
|
|
124
124
|
googleCalendarApiKey: String,
|
|
125
125
|
};
|
|
126
|
-
|
|
127
126
|
const EVENT_SOURCE_REFINERS = {
|
|
128
127
|
googleCalendarApiKey: String,
|
|
129
128
|
googleCalendarId: String,
|
|
130
129
|
googleCalendarApiBase: String,
|
|
131
|
-
extraParams:
|
|
130
|
+
extraParams: internal.identity,
|
|
132
131
|
};
|
|
133
132
|
|
|
134
|
-
var index =
|
|
133
|
+
var index = core.createPlugin({
|
|
135
134
|
name: '@fullcalendar/google-calendar',
|
|
136
135
|
eventSourceDefs: [eventSourceDef],
|
|
137
136
|
optionRefiners: OPTION_REFINERS,
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PluginDef } from '@fullcalendar/core';
|
|
2
|
+
import { RawOptionsFromRefiners, RefinedOptionsFromRefiners, Identity, Dictionary } from '@fullcalendar/core/internal';
|
|
3
|
+
|
|
4
|
+
declare const OPTION_REFINERS: {
|
|
5
|
+
googleCalendarApiKey: StringConstructor;
|
|
6
|
+
};
|
|
7
|
+
type GoogleCalendarOptionRefiners = typeof OPTION_REFINERS;
|
|
8
|
+
type GoogleCalendarOptions = RawOptionsFromRefiners<GoogleCalendarOptionRefiners>;
|
|
9
|
+
type GoogleCalendarOptionsRefined = RefinedOptionsFromRefiners<GoogleCalendarOptionRefiners>;
|
|
10
|
+
declare const EVENT_SOURCE_REFINERS: {
|
|
11
|
+
googleCalendarApiKey: StringConstructor;
|
|
12
|
+
googleCalendarId: StringConstructor;
|
|
13
|
+
googleCalendarApiBase: StringConstructor;
|
|
14
|
+
extraParams: Identity<Dictionary | (() => Dictionary)>;
|
|
15
|
+
};
|
|
16
|
+
type GoogleCalendarEventSourceRefiners = typeof EVENT_SOURCE_REFINERS;
|
|
17
|
+
type GoogleCalendarEventSourceOptions = RawOptionsFromRefiners<GoogleCalendarEventSourceRefiners>;
|
|
18
|
+
type GoogleCalendarEventSourceOptionsRefined = RefinedOptionsFromRefiners<GoogleCalendarEventSourceRefiners>;
|
|
19
|
+
|
|
20
|
+
declare module '@fullcalendar/core/internal' {
|
|
21
|
+
interface BaseOptions extends GoogleCalendarOptions {
|
|
22
|
+
}
|
|
23
|
+
interface BaseOptionsRefined extends GoogleCalendarOptionsRefined {
|
|
24
|
+
}
|
|
25
|
+
interface EventSourceOptions extends GoogleCalendarEventSourceOptions {
|
|
26
|
+
}
|
|
27
|
+
interface EventSourceOptionsRefined extends GoogleCalendarEventSourceOptionsRefined {
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ambient.d.ts.map
|
|
31
|
+
|
|
32
|
+
declare const _default: PluginDef;
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
34
|
+
|
|
35
|
+
export { GoogleCalendarOptions, _default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JsonRequestError, createPlugin } from '@fullcalendar/core
|
|
2
|
-
import { requestJson, addDays, identity } from '@fullcalendar/core/internal
|
|
1
|
+
import { JsonRequestError, createPlugin } from '@fullcalendar/core';
|
|
2
|
+
import { requestJson, addDays, identity } from '@fullcalendar/core/internal';
|
|
3
3
|
|
|
4
4
|
// TODO: expose somehow
|
|
5
5
|
const API_BASE = 'https://www.googleapis.com/calendar/v3/calendars';
|
|
@@ -119,7 +119,6 @@ function injectQsComponent(url, component) {
|
|
|
119
119
|
const OPTION_REFINERS = {
|
|
120
120
|
googleCalendarApiKey: String,
|
|
121
121
|
};
|
|
122
|
-
|
|
123
122
|
const EVENT_SOURCE_REFINERS = {
|
|
124
123
|
googleCalendarApiKey: String,
|
|
125
124
|
googleCalendarId: String,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar Google Calendar Plugin v7.0.0-beta.
|
|
2
|
+
FullCalendar Google Calendar Plugin v7.0.0-beta.5
|
|
3
3
|
Docs & License: https://fullcalendar.io/docs/google-calendar
|
|
4
|
-
(c)
|
|
4
|
+
(c) 2025 Adam Shaw
|
|
5
5
|
*/
|
|
6
6
|
FullCalendar.GoogleCalendar = (function (exports, core, internal) {
|
|
7
7
|
'use strict';
|
|
@@ -124,7 +124,6 @@ FullCalendar.GoogleCalendar = (function (exports, core, internal) {
|
|
|
124
124
|
const OPTION_REFINERS = {
|
|
125
125
|
googleCalendarApiKey: String,
|
|
126
126
|
};
|
|
127
|
-
|
|
128
127
|
const EVENT_SOURCE_REFINERS = {
|
|
129
128
|
googleCalendarApiKey: String,
|
|
130
129
|
googleCalendarId: String,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar Google Calendar Plugin v7.0.0-beta.
|
|
2
|
+
FullCalendar Google Calendar Plugin v7.0.0-beta.5
|
|
3
3
|
Docs & License: https://fullcalendar.io/docs/google-calendar
|
|
4
|
-
(c)
|
|
4
|
+
(c) 2025 Adam Shaw
|
|
5
5
|
*/
|
|
6
6
|
FullCalendar.GoogleCalendar=function(e,a,t){"use strict";const n={parseMeta(e){let{googleCalendarId:a}=e;return!a&&e.url&&(a=function(e){let a;if(/^[^/]+@([^/.]+\.)*(google|googlemail|gmail)\.com$/.test(e))return e;if((a=/^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^/]*)/.exec(e))||(a=/^https?:\/\/www.google.com\/calendar\/feeds\/([^/]*)/.exec(e)))return decodeURIComponent(a[1]);return null}(e.url)),a?{googleCalendarId:a,googleCalendarApiKey:e.googleCalendarApiKey,googleCalendarApiBase:e.googleCalendarApiBase,extraParams:e.extraParams}:null},fetch(e,n,r){let{dateEnv:o,options:l}=e.context,s=e.eventSource.meta,i=s.googleCalendarApiKey||l.googleCalendarApiKey;if(i){let l=function(e){let a=e.googleCalendarApiBase;a||(a="https://www.googleapis.com/calendar/v3/calendars");return a+"/"+encodeURIComponent(e.googleCalendarId)+"/events"}(s),{extraParams:d}=s,g="function"==typeof d?d():d,c=function(e,a,n,r){let o,l,s;r.canComputeOffset?(l=r.formatIso(e.start),s=r.formatIso(e.end)):(l=t.addDays(e.start,-1).toISOString(),s=t.addDays(e.end,1).toISOString());o=Object.assign(Object.assign({},n||{}),{key:a,timeMin:l,timeMax:s,singleEvents:!0,maxResults:9999}),"local"!==r.timeZone&&(o.timeZone=r.timeZone);return o}(e.range,i,g,o);return t.requestJson("GET",l,c).then(([e,t])=>{var o,l;e.error?r(new a.JsonRequestError("Google Calendar API: "+e.error.message,t)):n({rawEvents:(o=e.items,l=c.timeZone,o.map(e=>function(e,a){let t=e.htmlLink||null;t&&a&&(t=function(e,a){return e.replace(/(\?.*?)?(#|$)/,(e,t,n)=>(t?t+"&":"?")+a+n)}(t,"ctz="+a));return{id:e.id,title:e.summary,start:e.start.dateTime||e.start.date,end:e.end.dateTime||e.end.date,url:t,location:e.location,description:e.description,attachments:e.attachments||[],extendedProps:(e.extendedProperties||{}).shared||{}}}(e,l))),response:t})},r)}r(new Error("Specify a googleCalendarApiKey. See https://fullcalendar.io/docs/google-calendar"))}};const r={googleCalendarApiKey:String},o={googleCalendarApiKey:String,googleCalendarId:String,googleCalendarApiBase:String,extraParams:t.identity};var l=a.createPlugin({name:"@fullcalendar/google-calendar",eventSourceDefs:[n],optionRefiners:r,eventSourceRefiners:o});return a.globalPlugins.push(l),e.default=l,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,FullCalendar.Internal);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullcalendar/google-calendar",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.5",
|
|
4
4
|
"title": "FullCalendar Google Calendar Plugin",
|
|
5
5
|
"description": "Display events from a public Google Calendar feed",
|
|
6
6
|
"homepage": "https://fullcalendar.io/docs/google-calendar",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"google-calendar"
|
|
13
13
|
],
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@fullcalendar/core": "7.0.0-beta.
|
|
15
|
+
"@fullcalendar/core": "7.0.0-beta.5"
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|
|
18
18
|
"bugs": "https://fullcalendar.io/reporting-bugs",
|
|
@@ -27,21 +27,24 @@
|
|
|
27
27
|
"email": "arshaw@arshaw.com",
|
|
28
28
|
"url": "http://arshaw.com/"
|
|
29
29
|
},
|
|
30
|
-
"copyright": "
|
|
31
|
-
"types": "./index.d.ts",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"unpkg": "./
|
|
35
|
-
"jsdelivr": "./
|
|
30
|
+
"copyright": "2025 Adam Shaw",
|
|
31
|
+
"types": "./esm/index.d.ts",
|
|
32
|
+
"module": "./esm/index.js",
|
|
33
|
+
"main": "./cjs/index.cjs",
|
|
34
|
+
"unpkg": "./global.min.js",
|
|
35
|
+
"jsdelivr": "./global.min.js",
|
|
36
36
|
"exports": {
|
|
37
37
|
"./package.json": "./package.json",
|
|
38
|
-
"./index.cjs": "./index.cjs",
|
|
39
|
-
"./index.js": "./index.js",
|
|
40
38
|
".": {
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
"import": {
|
|
40
|
+
"types": "./esm/index.d.ts",
|
|
41
|
+
"default": "./esm/index.js"
|
|
42
|
+
},
|
|
43
|
+
"require": "./cjs/index.cjs"
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"sideEffects":
|
|
46
|
+
"sideEffects": [
|
|
47
|
+
"./global.js",
|
|
48
|
+
"./global.min.js"
|
|
49
|
+
]
|
|
47
50
|
}
|
package/index.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { PluginDef } from '@fullcalendar/core';
|
|
2
|
-
import { Identity, Dictionary } from '@fullcalendar/core/internal';
|
|
3
|
-
|
|
4
|
-
declare const OPTION_REFINERS: {
|
|
5
|
-
googleCalendarApiKey: StringConstructor;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
declare const EVENT_SOURCE_REFINERS: {
|
|
9
|
-
googleCalendarApiKey: StringConstructor;
|
|
10
|
-
googleCalendarId: StringConstructor;
|
|
11
|
-
googleCalendarApiBase: StringConstructor;
|
|
12
|
-
extraParams: Identity<Dictionary | (() => Dictionary)>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type ExtraOptionRefiners = typeof OPTION_REFINERS;
|
|
16
|
-
type ExtraEventSourceRefiners = typeof EVENT_SOURCE_REFINERS;
|
|
17
|
-
declare module '@fullcalendar/core/internal' {
|
|
18
|
-
interface BaseOptionRefiners extends ExtraOptionRefiners {
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
declare module '@fullcalendar/core/internal' {
|
|
22
|
-
interface EventSourceRefiners extends ExtraEventSourceRefiners {
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=ambient.d.ts.map
|
|
26
|
-
|
|
27
|
-
declare const _default: PluginDef;
|
|
28
|
-
//# sourceMappingURL=index.d.ts.map
|
|
29
|
-
|
|
30
|
-
export { _default as default };
|