Socket
Socket
Sign inDemoInstall

@theankur/react-add-to-calendar

Package Overview
Dependencies
9
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.5 to 0.1.7

dist/react-add-to-calendar.css.map

211

dist/react-add-to-calendar.js

@@ -10,3 +10,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

root["ReactAddToCalendar"] = factory(root["React"], root["moment"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_6__) {
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_8__) {
return /******/ (function(modules) { // webpackBootstrap

@@ -74,3 +74,3 @@ /******/ // The module cache

var _helpers = __webpack_require__(5);
var _helpers = __webpack_require__(7);

@@ -382,8 +382,17 @@ var _helpers2 = _interopRequireDefault(_helpers);

if (false) {
var ReactIs = require('react-is');
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);
module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);
} else {

@@ -409,8 +418,6 @@ // By explicitly using `prop-types` you are opting into new production behavior.

var ReactPropTypesSecret = __webpack_require__(4);
var emptyFunction = __webpack_require__(4);
var invariant = __webpack_require__(5);
var ReactPropTypesSecret = __webpack_require__(6);
function emptyFunction() {}
function emptyFunctionWithReset() {}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
module.exports = function() {

@@ -422,3 +429,4 @@ function shim(props, propName, componentName, location, propFullName, secret) {

}
var err = new Error(
invariant(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +

@@ -428,4 +436,2 @@ 'Use PropTypes.checkPropTypes() to call them. ' +

);
err.name = 'Invariant Violation';
throw err;
};

@@ -450,3 +456,2 @@ shim.isRequired = shim;

element: shim,
elementType: shim,
instanceOf: getShim,

@@ -458,8 +463,6 @@ node: shim,

shape: getShim,
exact: getShim,
checkPropTypes: emptyFunctionWithReset,
resetWarningCache: emptyFunction
exact: getShim
};
ReactPropTypes.checkPropTypes = emptyFunction;
ReactPropTypes.PropTypes = ReactPropTypes;

@@ -475,2 +478,4 @@

"use strict";
/**

@@ -481,6 +486,103 @@ * Copyright (c) 2013-present, Facebook, Inc.

* LICENSE file in the root directory of this source tree.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var validateFormat = function validateFormat(format) {};
if (false) {
validateFormat = function validateFormat(format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
/***/ }),
/* 6 */
/***/ (function(module, exports) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';

@@ -492,3 +594,3 @@

/***/ }),
/* 5 */
/* 7 */
/***/ (function(module, exports, __webpack_require__) {

@@ -504,3 +606,3 @@

var _moment = __webpack_require__(6);
var _moment = __webpack_require__(8);

@@ -531,2 +633,7 @@ var _moment2 = _interopRequireDefault(_moment);

}, {
key: "formatUntilDate",
value: function formatUntilDate(date) {
return _moment2.default.utc(date).format("YYYYMMDD");
}
}, {
key: "calculateDuration",

@@ -544,3 +651,3 @@ value: function calculateDuration(startTime, endTime) {

return Math.floor(duration.asHours()) + _moment2.default.utc(difference).format(":mm");
return String(Math.floor(duration.asHours())).padStart(2, "0") + _moment2.default.utc(difference).format("mm");
}

@@ -550,4 +657,38 @@ }, {

value: function buildUrl(event, type, isCrappyIE) {
var _this = this;
var calendarUrl = "";
var buildRecurringEvent = function buildRecurringEvent() {
if (!event.recurring.google) return '';
if (typeof event.recurring.google === 'string') {
return event.recurring.google;
}
var googleRecurring = event.recurring.google;
var recur = "RRULE:FREQ=" + googleRecurring.repeat + ";INTERVAL=" + (googleRecurring.interval || 1) + ";WKST=" + (googleRecurring.weekStart || 'SU');
if (googleRecurring.count) {
recur = recur + ";COUNT=" + googleRecurring.count;
}
if (event.recurring.until) {
recur = recur + ";UNTIL=" + _this.formatUntilDate(event.recurring.until);
}
if (googleRecurring.byDay) {
recur = recur + ";BYDAY=" + googleRecurring.byDay;
}
if (googleRecurring.byMonth) {
recur = recur + ";BYMONTH=" + googleRecurring.byMonth;
}
return recur.toUpperCase();
};
var buildYahooRecurringEvent = function buildYahooRecurringEvent() {
if (!event.recurring.yahoo) return '';
if (typeof event.recurring.yahoo === 'string') {
return event.recurring;
}
var recur = "&RPAT=" + event.recurring.yahoo.repeat + "&REND=" + _this.formatUntilDate(event.recurring.until);
return recur;
};
// allow mobile browsers to open the gmail data URI within native calendar app

@@ -562,2 +703,5 @@ // type = (type == "google" && this.isMobile()) ? "outlook" : type;

calendarUrl += "/" + this.formatTime(event.endTime);
if (event.recurring && event.recurring.google) {
calendarUrl += "&recur=" + buildRecurringEvent();
}
calendarUrl += "&location=" + encodeURIComponent(event.location);

@@ -571,8 +715,11 @@ calendarUrl += "&text=" + encodeURIComponent(event.title);

var duration = this.calculateDuration(event.startTime, event.endTime);
calendarUrl = "https://calendar.yahoo.com/?v=60&view=d&type=20";
calendarUrl += "&title=" + encodeURIComponent(event.title);
calendarUrl += "&st=" + this.formatTime(event.startTime);
calendarUrl += "&dur=" + duration;
calendarUrl += "&desc=" + encodeURIComponent(event.description);
calendarUrl = "https://calendar.yahoo.com/?v=60&view=d&TYPE=21";
calendarUrl += "&TITLE=" + encodeURIComponent(event.title);
calendarUrl += "&ST=" + this.formatTime(event.startTime);
calendarUrl += "&DUR=" + duration;
calendarUrl += "&DESC=" + encodeURIComponent(event.description);
calendarUrl += "&in_loc=" + encodeURIComponent(event.location);
if (event.recurring && event.recurring.yahoo) {
calendarUrl += buildYahooRecurringEvent();
}
break;

@@ -593,4 +740,12 @@

default:
calendarUrl = ["BEGIN:VCALENDAR", "VERSION:2.0", "BEGIN:VEVENT", "URL:" + document.URL, "DTSTART:" + this.formatTime(event.startTime), "DTEND:" + this.formatTime(event.endTime), "SUMMARY:" + event.title, "DESCRIPTION:" + event.description, "LOCATION:" + event.location, "END:VEVENT", "END:VCALENDAR"].join("\n");
calendarUrl = ["BEGIN:VCALENDAR", "VERSION:2.0", "BEGIN:VEVENT", "URL:" + document.URL, "DTSTART:" + this.formatTime(event.startTime), "DTEND:" + this.formatTime(event.endTime), "SUMMARY:" + event.title, "DESCRIPTION:" + event.description, "LOCATION:" + event.location];
if (event.recurring) {
calendarUrl = calendarUrl.concat([buildRecurringEvent()]);
}
calendarUrl = calendarUrl.concat(["END:VEVENT", "END:VCALENDAR"]);
calendarUrl = calendarUrl.join("\n");
if (!isCrappyIE && this.isMobile()) {

@@ -625,6 +780,6 @@ calendarUrl = encodeURI("data:text/calendar;charset=utf8," + calendarUrl);

/***/ }),
/* 6 */
/* 8 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_6__;
module.exports = __WEBPACK_EXTERNAL_MODULE_8__;

@@ -631,0 +786,0 @@ /***/ })

2

dist/react-add-to-calendar.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("moment")):"function"==typeof define&&define.amd?define(["react","moment"],t):"object"==typeof exports?exports.ReactAddToCalendar=t(require("react"),require("moment")):e.ReactAddToCalendar=t(e.React,e.moment)}(this,function(e,t){return function(e){function t(n){if(o[n])return o[n].exports;var a=o[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),l=o(1),c=n(l),d=o(2),u=n(d),p=o(5),m=n(p),f=new m.default,h=function(e){function t(e){a(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return o.state={optionsOpen:e.optionsOpen||!1,isCrappyIE:!1},o.toggleCalendarDropdown=o.toggleCalendarDropdown.bind(o),o.handleDropdownLinkClick=o.handleDropdownLinkClick.bind(o),o}return i(t,e),s(t,[{key:"componentWillMount",value:function(){String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.indexOf(e,t)===t});var e=!1;"undefined"!=typeof window&&window.navigator.msSaveOrOpenBlob&&window.Blob&&(e=!0),this.setState({isCrappyIE:e})}},{key:"toggleCalendarDropdown",value:function(e){var t=!this.state.optionsOpen;t?document.addEventListener("click",this.toggleCalendarDropdown,!1):document.removeEventListener("click",this.toggleCalendarDropdown),this.props.toggleDropdown&&this.props.toggleDropdown(t,(e||{}).currentTarget),this.setState({optionsOpen:t})}},{key:"handleDropdownLinkClick",value:function(e){e.preventDefault();var t=e.currentTarget.getAttribute("href");if(f.isMobile()||!t.startsWith("data")&&!t.startsWith("BEGIN"))window.open(t,"_blank");else{var o="download.ics",n=new Blob([t],{type:"text/calendar;charset=utf-8"});if(this.state.isCrappyIE)window.navigator.msSaveOrOpenBlob(n,o);else{var a=document.createElement("a");a.href=window.URL.createObjectURL(n),a.setAttribute("download",o),document.body.appendChild(a),a.click(),document.body.removeChild(a)}}this.toggleCalendarDropdown()}},{key:"renderDropdown",value:function(){var e=this,t=this,o=this.props.listElement||function(e){return c.default.createElement("ul",e,e.children)},n=this.props.listItems.map(function(o){var n=Object.keys(o)[0],a=o[n],r=e.props.listItemElement||function(e){return c.default.createElement("li",e,e.children)},i=null;if(t.props.displayItemIcons)if(e.props.listItemsIcon&&(i=e.props.listItemsIcon.filter(function(e){return Object.keys(e)[0]===n}).shift()),i)i=i[n];else{var s="outlook"===n||"outlookcom"===n?"windows":n;i=c.default.createElement("i",{className:"fa fa-"+s})}return c.default.createElement(r,{key:f.getRandomKey()},c.default.createElement("a",{className:n+"-link",onClick:t.handleDropdownLinkClick,href:f.buildUrl(t.props.event,n,t.state.isCrappyIE),target:"_blank"},i,a))});return c.default.createElement("div",{className:this.props.dropdownClass},c.default.createElement(o,null,n))}},{key:"renderButton",value:function(){var e=this.props.buttonLabel,t=null,o=Object.keys(this.props.buttonTemplate),n=this.props.buttonElement||function(e){return c.default.createElement("a",e,e.children)};if("textOnly"!==o[0]){var a=this.props.buttonTemplate[o],r="react-add-to-calendar__icon--"===this.props.buttonIconClass?""+this.props.buttonIconClass+a:this.props.buttonIconClass,i=this.props.useFontAwesomeIcons?"fa fa-":"",s="caret"===o[0]?this.state.optionsOpen?"caret-up":"caret-down":o[0],l=r+" "+i+s;t=c.default.createElement("i",{className:l}),e="right"===a?c.default.createElement("span",null,e+" ",t):c.default.createElement("span",null,t," "+e)}var d=this.state.optionsOpen?this.props.buttonClassClosed+" "+this.props.buttonClassOpen:this.props.buttonClassClosed;return c.default.createElement("div",{className:this.props.buttonWrapperClass},c.default.createElement(n,{className:d,onClick:this.toggleCalendarDropdown},e))}},{key:"render",value:function(){var e=null;this.state.optionsOpen&&(e=this.renderDropdown());var t=null;return this.props.event&&(t=this.renderButton()),c.default.createElement("div",{className:this.props.rootClass},t,e)}}]),t}(c.default.Component);t.default=h,h.displayName="Add To Calendar",h.propTypes={buttonClassClosed:u.default.string,buttonClassOpen:u.default.string,buttonLabel:u.default.string,buttonTemplate:u.default.object,buttonIconClass:u.default.string,useFontAwesomeIcons:u.default.bool,buttonWrapperClass:u.default.string,buttonElement:u.default.element,displayItemIcons:u.default.bool,optionsOpen:u.default.bool,dropdownClass:u.default.string,event:u.default.shape({title:u.default.string,description:u.default.string,location:u.default.string,startTime:u.default.string,endTime:u.default.string}).isRequired,listElement:u.default.element,listItemElement:u.default.element,listItems:u.default.arrayOf(u.default.object),listItemsIcon:u.default.arrayOf(u.default.object),rootClass:u.default.string,toggleDropdown:u.default.func},h.defaultProps={buttonClassClosed:"react-add-to-calendar__button",buttonClassOpen:"react-add-to-calendar__button--light",buttonLabel:"Add to My Calendar",buttonTemplate:{caret:"right"},buttonIconClass:"react-add-to-calendar__icon--",useFontAwesomeIcons:!0,buttonWrapperClass:"react-add-to-calendar__wrapper",displayItemIcons:!0,optionsOpen:!1,dropdownClass:"react-add-to-calendar__dropdown",event:{title:"Sample Event",description:"This is the sample event provided as an example only",location:"Portland, OR",startTime:"2016-09-16T20:15:00-04:00",endTime:"2016-09-16T21:45:00-04:00"},listItems:[{apple:"Apple Calendar"},{google:"Google"},{outlook:"Outlook"},{outlookcom:"Outlook.com"},{yahoo:"Yahoo"}],rootClass:"react-add-to-calendar"}},function(t,o){t.exports=e},function(e,t,o){e.exports=o(3)()},function(e,t,o){"use strict";function n(){}function a(){}var r=o(4);a.resetWarningCache=n,e.exports=function(){function e(e,t,o,n,a,i){if(i!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var o={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:n};return o.PropTypes=o,o}},function(e,t){"use strict";var o="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=o},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),i=o(6),s=n(i),l=function(){function e(){a(this,e)}return r(e,[{key:"getRandomKey",value:function(){var e=Math.floor(999999999999*Math.random()).toString();return(new Date).getTime().toString()+"_"+e}},{key:"formatTime",value:function(e){var t=s.default.utc(e).format("YYYYMMDDTHHmmssZ");return t.replace("+00:00","Z")}},{key:"calculateDuration",value:function(e,t){var o=s.default.utc(t).format("DD/MM/YYYY HH:mm:ss"),n=s.default.utc(e).format("DD/MM/YYYY HH:mm:ss"),a=(0,s.default)(o,"DD/MM/YYYY HH:mm:ss").diff((0,s.default)(n,"DD/MM/YYYY HH:mm:ss")),r=s.default.duration(a);return Math.floor(r.asHours())+s.default.utc(a).format(":mm")}},{key:"buildUrl",value:function(e,t,o){var n="";switch(t){case"google":n="https://calendar.google.com/calendar/render",n+="?action=TEMPLATE",n+="&dates="+this.formatTime(e.startTime),n+="/"+this.formatTime(e.endTime),n+="&location="+encodeURIComponent(e.location),n+="&text="+encodeURIComponent(e.title),n+="&details="+encodeURIComponent(e.description);break;case"yahoo":var a=this.calculateDuration(e.startTime,e.endTime);n="https://calendar.yahoo.com/?v=60&view=d&type=20",n+="&title="+encodeURIComponent(e.title),n+="&st="+this.formatTime(e.startTime),n+="&dur="+a,n+="&desc="+encodeURIComponent(e.description),n+="&in_loc="+encodeURIComponent(e.location);break;case"outlookcom":n="https://outlook.live.com/owa/?rru=addevent",n+="&startdt="+this.formatTime(e.startTime),n+="&enddt="+this.formatTime(e.endTime),n+="&subject="+encodeURIComponent(e.title),n+="&location="+encodeURIComponent(e.location),n+="&body="+encodeURIComponent(e.description),n+="&allday=false",n+="&uid="+this.getRandomKey(),n+="&path=/calendar/view/Month";break;default:n=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT","URL:"+document.URL,"DTSTART:"+this.formatTime(e.startTime),"DTEND:"+this.formatTime(e.endTime),"SUMMARY:"+e.title,"DESCRIPTION:"+e.description,"LOCATION:"+e.location,"END:VEVENT","END:VCALENDAR"].join("\n"),!o&&this.isMobile()&&(n=encodeURI("data:text/calendar;charset=utf8,"+n))}return n}},{key:"isMobile",value:function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(window.navigator.userAgent||window.navigator.vendor||window.opera),e}}]),e}();t.default=l},function(e,o){e.exports=t}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("moment")):"function"==typeof define&&define.amd?define(["react","moment"],t):"object"==typeof exports?exports.ReactAddToCalendar=t(require("react"),require("moment")):e.ReactAddToCalendar=t(e.React,e.moment)}(this,function(e,t){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(1),u=o(l),c=n(2),d=o(c),p=n(7),f=o(p),m=new f.default,h=function(e){function t(e){r(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={optionsOpen:e.optionsOpen||!1,isCrappyIE:!1},n.toggleCalendarDropdown=n.toggleCalendarDropdown.bind(n),n.handleDropdownLinkClick=n.handleDropdownLinkClick.bind(n),n}return i(t,e),s(t,[{key:"componentWillMount",value:function(){String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.indexOf(e,t)===t});var e=!1;"undefined"!=typeof window&&window.navigator.msSaveOrOpenBlob&&window.Blob&&(e=!0),this.setState({isCrappyIE:e})}},{key:"toggleCalendarDropdown",value:function(e){var t=!this.state.optionsOpen;t?document.addEventListener("click",this.toggleCalendarDropdown,!1):document.removeEventListener("click",this.toggleCalendarDropdown),this.props.toggleDropdown&&this.props.toggleDropdown(t,(e||{}).currentTarget),this.setState({optionsOpen:t})}},{key:"handleDropdownLinkClick",value:function(e){e.preventDefault();var t=e.currentTarget.getAttribute("href");if(m.isMobile()||!t.startsWith("data")&&!t.startsWith("BEGIN"))window.open(t,"_blank");else{var n="download.ics",o=new Blob([t],{type:"text/calendar;charset=utf-8"});if(this.state.isCrappyIE)window.navigator.msSaveOrOpenBlob(o,n);else{var r=document.createElement("a");r.href=window.URL.createObjectURL(o),r.setAttribute("download",n),document.body.appendChild(r),r.click(),document.body.removeChild(r)}}this.toggleCalendarDropdown()}},{key:"renderDropdown",value:function(){var e=this,t=this,n=this.props.listElement||function(e){return u.default.createElement("ul",e,e.children)},o=this.props.listItems.map(function(n){var o=Object.keys(n)[0],r=n[o],a=e.props.listItemElement||function(e){return u.default.createElement("li",e,e.children)},i=null;if(t.props.displayItemIcons)if(e.props.listItemsIcon&&(i=e.props.listItemsIcon.filter(function(e){return Object.keys(e)[0]===o}).shift()),i)i=i[o];else{var s="outlook"===o||"outlookcom"===o?"windows":o;i=u.default.createElement("i",{className:"fa fa-"+s})}return u.default.createElement(a,{key:m.getRandomKey()},u.default.createElement("a",{className:o+"-link",onClick:t.handleDropdownLinkClick,href:m.buildUrl(t.props.event,o,t.state.isCrappyIE),target:"_blank"},i,r))});return u.default.createElement("div",{className:this.props.dropdownClass},u.default.createElement(n,null,o))}},{key:"renderButton",value:function(){var e=this.props.buttonLabel,t=null,n=Object.keys(this.props.buttonTemplate),o=this.props.buttonElement||function(e){return u.default.createElement("a",e,e.children)};if("textOnly"!==n[0]){var r=this.props.buttonTemplate[n],a="react-add-to-calendar__icon--"===this.props.buttonIconClass?""+this.props.buttonIconClass+r:this.props.buttonIconClass,i=this.props.useFontAwesomeIcons?"fa fa-":"",s="caret"===n[0]?this.state.optionsOpen?"caret-up":"caret-down":n[0],l=a+" "+i+s;t=u.default.createElement("i",{className:l}),e="right"===r?u.default.createElement("span",null,e+" ",t):u.default.createElement("span",null,t," "+e)}var c=this.state.optionsOpen?this.props.buttonClassClosed+" "+this.props.buttonClassOpen:this.props.buttonClassClosed;return u.default.createElement("div",{className:this.props.buttonWrapperClass},u.default.createElement(o,{className:c,onClick:this.toggleCalendarDropdown},e))}},{key:"render",value:function(){var e=null;this.state.optionsOpen&&(e=this.renderDropdown());var t=null;return this.props.event&&(t=this.renderButton()),u.default.createElement("div",{className:this.props.rootClass},t,e)}}]),t}(u.default.Component);t.default=h,h.displayName="Add To Calendar",h.propTypes={buttonClassClosed:d.default.string,buttonClassOpen:d.default.string,buttonLabel:d.default.string,buttonTemplate:d.default.object,buttonIconClass:d.default.string,useFontAwesomeIcons:d.default.bool,buttonWrapperClass:d.default.string,buttonElement:d.default.element,displayItemIcons:d.default.bool,optionsOpen:d.default.bool,dropdownClass:d.default.string,event:d.default.shape({title:d.default.string,description:d.default.string,location:d.default.string,startTime:d.default.string,endTime:d.default.string}).isRequired,listElement:d.default.element,listItemElement:d.default.element,listItems:d.default.arrayOf(d.default.object),listItemsIcon:d.default.arrayOf(d.default.object),rootClass:d.default.string,toggleDropdown:d.default.func},h.defaultProps={buttonClassClosed:"react-add-to-calendar__button",buttonClassOpen:"react-add-to-calendar__button--light",buttonLabel:"Add to My Calendar",buttonTemplate:{caret:"right"},buttonIconClass:"react-add-to-calendar__icon--",useFontAwesomeIcons:!0,buttonWrapperClass:"react-add-to-calendar__wrapper",displayItemIcons:!0,optionsOpen:!1,dropdownClass:"react-add-to-calendar__dropdown",event:{title:"Sample Event",description:"This is the sample event provided as an example only",location:"Portland, OR",startTime:"2016-09-16T20:15:00-04:00",endTime:"2016-09-16T21:45:00-04:00"},listItems:[{apple:"Apple Calendar"},{google:"Google"},{outlook:"Outlook"},{outlookcom:"Outlook.com"},{yahoo:"Yahoo"}],rootClass:"react-add-to-calendar"}},function(t,n){t.exports=e},function(e,t,n){e.exports=n(3)()},function(e,t,n){"use strict";var o=n(4),r=n(5),a=n(6);e.exports=function(){function e(e,t,n,o,i,s){s!==a&&r(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=o,n.PropTypes=n,n}},function(e,t){"use strict";function n(e){return function(){return e}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function o(e,t,n,o,a,i,s,l){if(r(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,a,i,s,l],d=0;u=new Error(t.replace(/%s/g,function(){return c[d++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}var r=function(e){};e.exports=o},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(8),s=o(i),l=function(){function e(){r(this,e)}return a(e,[{key:"getRandomKey",value:function(){var e=Math.floor(999999999999*Math.random()).toString();return(new Date).getTime().toString()+"_"+e}},{key:"formatTime",value:function(e){var t=s.default.utc(e).format("YYYYMMDDTHHmmssZ");return t.replace("+00:00","Z")}},{key:"formatUntilDate",value:function(e){return s.default.utc(e).format("YYYYMMDD")}},{key:"calculateDuration",value:function(e,t){var n=s.default.utc(t).format("DD/MM/YYYY HH:mm:ss"),o=s.default.utc(e).format("DD/MM/YYYY HH:mm:ss"),r=(0,s.default)(n,"DD/MM/YYYY HH:mm:ss").diff((0,s.default)(o,"DD/MM/YYYY HH:mm:ss")),a=s.default.duration(r);return String(Math.floor(a.asHours())).padStart(2,"0")+s.default.utc(r).format("mm")}},{key:"buildUrl",value:function(e,t,n){var o=this,r="",a=function(){if(!e.recurring.google)return"";if("string"==typeof e.recurring.google)return e.recurring.google;var t=e.recurring.google,n="RRULE:FREQ="+t.repeat+";INTERVAL="+(t.interval||1)+";WKST="+(t.weekStart||"SU");return t.count&&(n=n+";COUNT="+t.count),e.recurring.until&&(n=n+";UNTIL="+o.formatUntilDate(e.recurring.until)),t.byDay&&(n=n+";BYDAY="+t.byDay),t.byMonth&&(n=n+";BYMONTH="+t.byMonth),n.toUpperCase()},i=function(){if(!e.recurring.yahoo)return"";if("string"==typeof e.recurring.yahoo)return e.recurring;var t="&RPAT="+e.recurring.yahoo.repeat+"&REND="+o.formatUntilDate(e.recurring.until);return t};switch(t){case"google":r="https://calendar.google.com/calendar/render",r+="?action=TEMPLATE",r+="&dates="+this.formatTime(e.startTime),r+="/"+this.formatTime(e.endTime),e.recurring&&e.recurring.google&&(r+="&recur="+a()),r+="&location="+encodeURIComponent(e.location),r+="&text="+encodeURIComponent(e.title),r+="&details="+encodeURIComponent(e.description);break;case"yahoo":var s=this.calculateDuration(e.startTime,e.endTime);r="https://calendar.yahoo.com/?v=60&view=d&TYPE=21",r+="&TITLE="+encodeURIComponent(e.title),r+="&ST="+this.formatTime(e.startTime),r+="&DUR="+s,r+="&DESC="+encodeURIComponent(e.description),r+="&in_loc="+encodeURIComponent(e.location),e.recurring&&e.recurring.yahoo&&(r+=i());break;case"outlookcom":r="https://outlook.live.com/owa/?rru=addevent",r+="&startdt="+this.formatTime(e.startTime),r+="&enddt="+this.formatTime(e.endTime),r+="&subject="+encodeURIComponent(e.title),r+="&location="+encodeURIComponent(e.location),r+="&body="+encodeURIComponent(e.description),r+="&allday=false",r+="&uid="+this.getRandomKey(),r+="&path=/calendar/view/Month";break;default:r=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT","URL:"+document.URL,"DTSTART:"+this.formatTime(e.startTime),"DTEND:"+this.formatTime(e.endTime),"SUMMARY:"+e.title,"DESCRIPTION:"+e.description,"LOCATION:"+e.location],e.recurring&&(r=r.concat([a()])),r=r.concat(["END:VEVENT","END:VCALENDAR"]),r=r.join("\n"),!n&&this.isMobile()&&(r=encodeURI("data:text/calendar;charset=utf8,"+r))}return r}},{key:"isMobile",value:function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(window.navigator.userAgent||window.navigator.vendor||window.opera),e}}]),e}();t.default=l},function(e,n){e.exports=t}])});

@@ -6,32 +6,51 @@ // Type definitions for react-add-to-calendar 0.1

// TypeScript Version: 2.8
import * as React from 'react'
import * as React from "react";
export interface GoogleRecurring {
repeat: string;
interval?: number;
weekStart?: string;
count?: number;
byDay?: number | string;
byMonth?: number | string;
}
export interface YahooRecurring {
repeat: string;
}
export interface Recurring {
google?: string | GoogleRecurring;
yahoo?: string | YahooRecurring;
until?: Date;
}
export interface AddToCalendarEvent {
title?: string;
description?: string;
location?: string;
startTime?: string | Date;
endTime?: string | Date;
title?: string;
description?: string;
location?: string;
startTime?: string | Date;
endTime?: string | Date;
recurring?: string | Recurring;
}
export interface AddToCalendarProps {
buttonClassClosed?: string;
buttonClassOpen?: string;
buttonLabel?: string;
buttonTemplate?: any;
buttonIconClass?: string;
useFontAwesomeIcons?: boolean;
buttonWrapperClass?: string;
buttonElement?: React.ComponentType<any>;
displayItemIcons?: boolean;
optionsOpen?: boolean;
dropdownClass?: string;
event: AddToCalendarEvent;
listElement?: React.ComponentType<any>;
listItemElement?: React.ComponentType<any>;
listItems?: any[];
listItemsIcon?: any[];
rootClass?: string;
toggleDropdown: (showOptions: boolean, target?: HTMLElement) => void
buttonClassClosed?: string;
buttonClassOpen?: string;
buttonLabel?: string;
buttonTemplate?: any;
buttonIconClass?: string;
useFontAwesomeIcons?: boolean;
buttonWrapperClass?: string;
buttonElement?: React.ComponentType<any>;
displayItemIcons?: boolean;
optionsOpen?: boolean;
dropdownClass?: string;
event: AddToCalendarEvent;
listElement?: React.ComponentType<any>;
listItemElement?: React.ComponentType<any>;
listItems?: any[];
listItemsIcon?: any[];
rootClass?: string;
toggleDropdown: (showOptions: boolean, target?: HTMLElement) => void;
}

@@ -38,0 +57,0 @@

@@ -35,2 +35,7 @@ "use strict";

}, {
key: "formatUntilDate",
value: function formatUntilDate(date) {
return _moment2.default.utc(date).format("YYYYMMDD");
}
}, {
key: "calculateDuration",

@@ -48,3 +53,3 @@ value: function calculateDuration(startTime, endTime) {

return Math.floor(duration.asHours()) + _moment2.default.utc(difference).format(":mm");
return String(Math.floor(duration.asHours())).padStart(2, "0") + _moment2.default.utc(difference).format("mm");
}

@@ -54,4 +59,38 @@ }, {

value: function buildUrl(event, type, isCrappyIE) {
var _this = this;
var calendarUrl = "";
var buildRecurringEvent = function buildRecurringEvent() {
if (!event.recurring.google) return '';
if (typeof event.recurring.google === 'string') {
return event.recurring.google;
}
var googleRecurring = event.recurring.google;
var recur = "RRULE:FREQ=" + googleRecurring.repeat + ";INTERVAL=" + (googleRecurring.interval || 1) + ";WKST=" + (googleRecurring.weekStart || 'SU');
if (googleRecurring.count) {
recur = recur + ";COUNT=" + googleRecurring.count;
}
if (event.recurring.until) {
recur = recur + ";UNTIL=" + _this.formatUntilDate(event.recurring.until);
}
if (googleRecurring.byDay) {
recur = recur + ";BYDAY=" + googleRecurring.byDay;
}
if (googleRecurring.byMonth) {
recur = recur + ";BYMONTH=" + googleRecurring.byMonth;
}
return recur.toUpperCase();
};
var buildYahooRecurringEvent = function buildYahooRecurringEvent() {
if (!event.recurring.yahoo) return '';
if (typeof event.recurring.yahoo === 'string') {
return event.recurring;
}
var recur = "&RPAT=" + event.recurring.yahoo.repeat + "&REND=" + _this.formatUntilDate(event.recurring.until);
return recur;
};
// allow mobile browsers to open the gmail data URI within native calendar app

@@ -66,2 +105,5 @@ // type = (type == "google" && this.isMobile()) ? "outlook" : type;

calendarUrl += "/" + this.formatTime(event.endTime);
if (event.recurring && event.recurring.google) {
calendarUrl += "&recur=" + buildRecurringEvent();
}
calendarUrl += "&location=" + encodeURIComponent(event.location);

@@ -75,8 +117,11 @@ calendarUrl += "&text=" + encodeURIComponent(event.title);

var duration = this.calculateDuration(event.startTime, event.endTime);
calendarUrl = "https://calendar.yahoo.com/?v=60&view=d&type=20";
calendarUrl += "&title=" + encodeURIComponent(event.title);
calendarUrl += "&st=" + this.formatTime(event.startTime);
calendarUrl += "&dur=" + duration;
calendarUrl += "&desc=" + encodeURIComponent(event.description);
calendarUrl = "https://calendar.yahoo.com/?v=60&view=d&TYPE=21";
calendarUrl += "&TITLE=" + encodeURIComponent(event.title);
calendarUrl += "&ST=" + this.formatTime(event.startTime);
calendarUrl += "&DUR=" + duration;
calendarUrl += "&DESC=" + encodeURIComponent(event.description);
calendarUrl += "&in_loc=" + encodeURIComponent(event.location);
if (event.recurring && event.recurring.yahoo) {
calendarUrl += buildYahooRecurringEvent();
}
break;

@@ -97,4 +142,12 @@

default:
calendarUrl = ["BEGIN:VCALENDAR", "VERSION:2.0", "BEGIN:VEVENT", "URL:" + document.URL, "DTSTART:" + this.formatTime(event.startTime), "DTEND:" + this.formatTime(event.endTime), "SUMMARY:" + event.title, "DESCRIPTION:" + event.description, "LOCATION:" + event.location, "END:VEVENT", "END:VCALENDAR"].join("\n");
calendarUrl = ["BEGIN:VCALENDAR", "VERSION:2.0", "BEGIN:VEVENT", "URL:" + document.URL, "DTSTART:" + this.formatTime(event.startTime), "DTEND:" + this.formatTime(event.endTime), "SUMMARY:" + event.title, "DESCRIPTION:" + event.description, "LOCATION:" + event.location];
if (event.recurring) {
calendarUrl = calendarUrl.concat([buildRecurringEvent()]);
}
calendarUrl = calendarUrl.concat(["END:VEVENT", "END:VCALENDAR"]);
calendarUrl = calendarUrl.join("\n");
if (!isCrappyIE && this.isMobile()) {

@@ -101,0 +154,0 @@ calendarUrl = encodeURI("data:text/calendar;charset=utf8," + calendarUrl);

@@ -5,3 +5,3 @@ {

"description": "A simple and reusable add to calendar button component for React",
"version": "0.1.5",
"version": "0.1.7",
"license": "MIT",

@@ -56,7 +56,8 @@ "homepage": "https://github.com/jasonsalzman/react-add-to-calendar",

"grunt-cli": "^1.2.0",
"grunt-contrib-sass": "1.0.0",
"grunt-contrib-sass": "^2.0.0",
"grunt-contrib-watch": "1.0.0",
"grunt-eslint": "^19.0.0",
"grunt-karma": "^2.0.0",
"grunt-scss-lint": "^0.5.0",
"grunt-sass": "^3.1.0",
"grunt-sass-lint": "^0.2.4",
"grunt-webpack": "^1.0.18",

@@ -79,3 +80,2 @@ "highlight.js": "^9.11.0",

"mocha-jsdom": "^1.1.0",
"node-sass": "^4.7.2",
"prop-types": "^15.5.10",

@@ -86,3 +86,3 @@ "react": "^16.2.0",

"react-transform-hmr": "^1.0.4",
"sass-loader": "^4.1.1",
"sass": "^1.22.10",
"sinon": "^1.17.7",

@@ -93,3 +93,4 @@ "style-loader": "^0.18.0",

"webpack-dev-server": "^1.16.4",
"webpack-hot-middleware": "^2.18.0"
"webpack-hot-middleware": "^2.18.0",
"sass-loader": "^7.2.0"
},

@@ -96,0 +97,0 @@ "peerDependencies": {

@@ -17,3 +17,3 @@ # React Add to Calendar Button

```
npm install react-add-to-calendar --save
npm install @theankur/react-add-to-calendar --save
```

@@ -24,20 +24,30 @@

```js
import React from 'react';
import AddToCalendar from 'react-add-to-calendar';
import React from "react";
import AddToCalendar from "react-add-to-calendar";
class Example extends React.Component {
static displayName = 'Example';
static displayName = "Example";
state = {
event: {
title: 'Sample Event',
description: 'This is the sample event provided as an example only',
location: 'Portland, OR',
startTime: '2016-09-16T20:15:00-04:00',
endTime: '2016-09-16T21:45:00-04:00'
}
title: "Sample Event",
description: "This is the sample event provided as an example only",
location: "Portland, OR",
startTime: "2021-03-16T20:15:00-04:00",
endTime: "2021-03-16T21:45:00-04:00",
recurring: {
google: {
repeat: "weekly",
byDay: "TU,WE",
},
yahoo: {
repeat: "1WK",
},
until: "2022-10-10",
},
},
};
render() {
return <AddToCalendar event={this.state.event}/>;
};
return <AddToCalendar event={this.state.event} />;
}
}

@@ -71,2 +81,3 @@ ```

Latest compatible versions:
- React 16.2.0 or newer

@@ -78,3 +89,3 @@

Unfortunately it is difficult to support legacy browsers while maintaining the ability to develop new features in the future. For IE9 support, it is known that the [classlist polyfill](https://www.npmjs.com/package/classlist-polyfill) is needed, but this may change or break at any point in the future.
Unfortunately it is difficult to support legacy browsers while maintaining the ability to develop new features in the future. For IE9 support, it is known that the [classlist polyfill](https://www.npmjs.com/package/classlist-polyfill) is needed, but this may change or break at any point in the future.

@@ -85,5 +96,6 @@ ## Local Development

You can run `npm test` to execute the test suite and linters. To help you develop the component I’ve set up some tests that covers the basic functionality (can be found in `/tests`). I highly recommend you add tests when you’re adding new functionality.
You can run `npm test` to execute the test suite and linters. To help you develop the component I’ve set up some tests that covers the basic functionality (can be found in `/tests`). I highly recommend you add tests when you’re adding new functionality.
### The examples
The examples are hosted within the docs folder and are ran in the simple add that loads the Add to Calendar button. To extend the examples with a new example, you can simply duplicate one of the existing examples and change the unique properties of your example.

@@ -90,0 +102,0 @@

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc