Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 8986b85

Browse files
Remove outlook web. No longer supports add link
1 parent 8367050 commit 8986b85

File tree

8 files changed

+15
-70
lines changed

8 files changed

+15
-70
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ The component takes the following props
217217
|className |string | |`null` |className to use on AddToCalendar container |
218218
|dropdownProps |object | |`{}` |Spread props to the dropdown or modal component you pass in to the HOC |
219219
|event |object |Yes | |Event object we use to create calendar links |
220-
|items |array of enums | |`[GOOGLE, ICAL, OUTLOOK_WEB, YAHOO]` |By default AddToCalendar renders all of these calendar links. To render a subset of these provide a list of items using the enum SHARE_SITES, which is a named import from the library |
220+
|items |array of enums | |`[GOOGLE, ICAL, OUTLOOK, YAHOO]` |By default AddToCalendar renders all of these calendar links. To render a subset of these or to list them in a different order, provide a list of items using the enum SHARE_SITES, which is a named import from the library |
221221
|linkProps |object | |`{}` |Spread props to the link components we render for each calendar item |
222222

223223
#### Event Object Shape

docs/bundle.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/enums.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exports.SHARE_SITES = void 0;
77
var SHARE_SITES = {
88
GOOGLE: 'Google',
99
ICAL: 'iCal',
10-
OUTLOOK_WEB: 'Outlook Web',
10+
OUTLOOK: 'Outlook',
1111
YAHOO: 'Yahoo'
1212
};
1313
exports.SHARE_SITES = SHARE_SITES;

lib/utils.js

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -69,41 +69,22 @@ var yahooShareUrl = function yahooShareUrl(_ref2) {
6969
return "https://calendar.yahoo.com/?v=60&view=d&type=20&title=".concat(title, "&st=").concat(startDatetime, "&dur=").concat(duration, "&desc=").concat(description, "&in_loc=").concat(location);
7070
};
7171
/**
72-
* Takes an event object and returns a Outlook Web Calendar Event URL
72+
* Takes an event object and returns an array to be downloaded as ics file
7373
* @param {string} event.description
7474
* @param {string} event.endDatetime
7575
* @param {string} event.location
7676
* @param {string} event.startDatetime
7777
* @param {string} event.title
78-
* @returns {string} Outlook Web Calendar Event URL
78+
* @returns {array} ICS Content
7979
*/
8080

8181

82-
var outlookWebUrl = function outlookWebUrl(_ref3) {
82+
var buildShareFile = function buildShareFile(_ref3) {
8383
var description = _ref3.description,
8484
endDatetime = _ref3.endDatetime,
8585
location = _ref3.location,
8686
startDatetime = _ref3.startDatetime,
8787
title = _ref3.title;
88-
return "https://outlook.live.com/owa/?rru=addevent&startdt=".concat(startDatetime, "&enddt=").concat(endDatetime, "&subject=").concat(title, "&location=").concat(location, "&body=").concat(description, "&allday=false&uid=123&path=/calendar/view/Month");
89-
};
90-
/**
91-
* Takes an event object and returns an array to be downloaded as ics file
92-
* @param {string} event.description
93-
* @param {string} event.endDatetime
94-
* @param {string} event.location
95-
* @param {string} event.startDatetime
96-
* @param {string} event.title
97-
* @returns {array} ICS Content
98-
*/
99-
100-
101-
var buildShareFile = function buildShareFile(_ref4) {
102-
var description = _ref4.description,
103-
endDatetime = _ref4.endDatetime,
104-
location = _ref4.location,
105-
startDatetime = _ref4.startDatetime,
106-
title = _ref4.title;
10788
var content = ['BEGIN:VCALENDAR', 'VERSION:2.0', 'BEGIN:VEVENT', "URL:".concat(document.URL), "DTSTART:".concat(startDatetime), "DTEND:".concat(endDatetime), "SUMMARY:".concat(title), "DESCRIPTION:".concat(description), "LOCATION:".concat(location), 'END:VEVENT', 'END:VCALENDAR'].join('\n');
10889
return isMobile() ? "data:text/calendar;charset=utf8".concat(content) : content;
10990
};
@@ -120,13 +101,13 @@ var buildShareFile = function buildShareFile(_ref4) {
120101
*/
121102

122103

123-
var buildShareUrl = function buildShareUrl(_ref5, type) {
124-
var description = _ref5.description,
125-
duration = _ref5.duration,
126-
endDatetime = _ref5.endDatetime,
127-
location = _ref5.location,
128-
startDatetime = _ref5.startDatetime,
129-
title = _ref5.title;
104+
var buildShareUrl = function buildShareUrl(_ref4, type) {
105+
var description = _ref4.description,
106+
duration = _ref4.duration,
107+
endDatetime = _ref4.endDatetime,
108+
location = _ref4.location,
109+
startDatetime = _ref4.startDatetime,
110+
title = _ref4.title;
130111
var encodeURI = type !== _enums.SHARE_SITES.ICAL;
131112
var data = {
132113
description: encodeURI ? encodeURIComponent(description) : description,
@@ -144,9 +125,6 @@ var buildShareUrl = function buildShareUrl(_ref5, type) {
144125
case _enums.SHARE_SITES.YAHOO:
145126
return yahooShareUrl(data);
146127

147-
case _enums.SHARE_SITES.OUTLOOK_WEB:
148-
return outlookWebUrl(data);
149-
150128
default:
151129
return buildShareFile(data);
152130
}

lib/utils.test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ describe('buildShareUrl', function () {
3030
var result = (0, _utils.buildShareUrl)(testEvent, _enums.SHARE_SITES.YAHOO);
3131
expect(result).toEqual('https://calendar.yahoo.com/?v=60&view=d&type=20&title=Super%20Fun%20Event&st=20150126T000000Z&dur=0200&desc=Description%20of%20event.%20Going%20to%20have%20a%20lot%20of%20fun%20doing%20things%20that%20we%20scheduled%20ahead%20of%20time.&in_loc=NYC');
3232
});
33-
it('returns a proper Outlook Web share URL', function () {
34-
var result = (0, _utils.buildShareUrl)(testEvent, _enums.SHARE_SITES.OUTLOOK_WEB);
35-
expect(result).toEqual('https://outlook.live.com/owa/?rru=addevent&startdt=20150126T000000Z&enddt=20150126T020000Z&subject=Super%20Fun%20Event&location=NYC&body=Description%20of%20event.%20Going%20to%20have%20a%20lot%20of%20fun%20doing%20things%20that%20we%20scheduled%20ahead%20of%20time.&allday=false&uid=123&path=/calendar/view/Month');
36-
});
3733
it('returns a proper iCal content object', function () {
3834
var result = (0, _utils.buildShareUrl)(testEvent, _enums.SHARE_SITES.ICAL);
3935
expect(result).toEqual('BEGIN:VCALENDAR\nVERSION:2.0\nBEGIN:VEVENT\nURL:about:blank\nDTSTART:20150126T000000Z\nDTEND:20150126T020000Z\nSUMMARY:Super Fun Event\nDESCRIPTION:Description of event. Going to have a lot of fun doing things that we scheduled ahead of time.\nLOCATION:NYC\nEND:VEVENT\nEND:VCALENDAR');

src/lib/enums.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const SHARE_SITES = {
22
GOOGLE: 'Google',
33
ICAL: 'iCal',
4-
OUTLOOK_WEB: 'Outlook Web',
4+
OUTLOOK: 'Outlook',
55
YAHOO: 'Yahoo',
66
};

src/lib/utils.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,6 @@ const yahooShareUrl = ({
5757
startDatetime
5858
}&dur=${duration}&desc=${description}&in_loc=${location}`;
5959

60-
/**
61-
* Takes an event object and returns a Outlook Web Calendar Event URL
62-
* @param {string} event.description
63-
* @param {string} event.endDatetime
64-
* @param {string} event.location
65-
* @param {string} event.startDatetime
66-
* @param {string} event.title
67-
* @returns {string} Outlook Web Calendar Event URL
68-
*/
69-
const outlookWebUrl = ({
70-
description,
71-
endDatetime,
72-
location,
73-
startDatetime,
74-
title,
75-
}) =>
76-
`https://outlook.live.com/owa/?rru=addevent&startdt=${startDatetime}&enddt=${
77-
endDatetime
78-
}&subject=${title}&location=${location}&body=${
79-
description
80-
}&allday=false&uid=123&path=/calendar/view/Month`;
81-
8260
/**
8361
* Takes an event object and returns an array to be downloaded as ics file
8462
* @param {string} event.description
@@ -143,8 +121,6 @@ export const buildShareUrl = (
143121
return googleShareUrl(data);
144122
case SHARE_SITES.YAHOO:
145123
return yahooShareUrl(data);
146-
case SHARE_SITES.OUTLOOK_WEB:
147-
return outlookWebUrl(data);
148124
default:
149125
return buildShareFile(data);
150126
}

src/lib/utils.test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ describe('buildShareUrl', () => {
2828
expect(result).toEqual('https://calendar.yahoo.com/?v=60&view=d&type=20&title=Super%20Fun%20Event&st=20150126T000000Z&dur=0200&desc=Description%20of%20event.%20Going%20to%20have%20a%20lot%20of%20fun%20doing%20things%20that%20we%20scheduled%20ahead%20of%20time.&in_loc=NYC')
2929
});
3030

31-
it('returns a proper Outlook Web share URL', () => {
32-
const result = buildShareUrl(testEvent, SHARE_SITES.OUTLOOK_WEB);
33-
expect(result).toEqual('https://outlook.live.com/owa/?rru=addevent&startdt=20150126T000000Z&enddt=20150126T020000Z&subject=Super%20Fun%20Event&location=NYC&body=Description%20of%20event.%20Going%20to%20have%20a%20lot%20of%20fun%20doing%20things%20that%20we%20scheduled%20ahead%20of%20time.&allday=false&uid=123&path=/calendar/view/Month');
34-
});
35-
3631
it('returns a proper iCal content object', () => {
3732
const result = buildShareUrl(testEvent, SHARE_SITES.ICAL);
3833
expect(result).toEqual('BEGIN:VCALENDAR\nVERSION:2.0\nBEGIN:VEVENT\nURL:about:blank\nDTSTART:20150126T000000Z\nDTEND:20150126T020000Z\nSUMMARY:Super Fun Event\nDESCRIPTION:Description of event. Going to have a lot of fun doing things that we scheduled ahead of time.\nLOCATION:NYC\nEND:VEVENT\nEND:VCALENDAR');

0 commit comments

Comments
 (0)