From 99d04388fe57e2c3303387ab821c04a99b2381e6 Mon Sep 17 00:00:00 2001 From: Eugene Hlushko Date: Sat, 14 Mar 2020 18:45:13 +0200 Subject: [PATCH] chore(deps) migrate to react ^16.3 (#23) --- dist/vote.bundle.js | 2 +- package-lock.json | 99 +++++++++++++++++++++------- package.json | 4 +- src/components/dropdown/dropdown.jsx | 2 +- src/components/wrapper/wrapper.jsx | 6 -- webpack.dist.babel.js | 7 +- 6 files changed, 80 insertions(+), 40 deletions(-) diff --git a/dist/vote.bundle.js b/dist/vote.bundle.js index 618c1d4..0d75071 100644 --- a/dist/vote.bundle.js +++ b/dist/vote.bundle.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.vote=t(require("react")):e.vote=t(e.React)}(window,(function(e){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=5)}([function(t,n){t.exports=e},function(e,t,n){e.exports=n(20)()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=n(0),i=(o=r)&&o.__esModule?o:{default:o};n(12);var a={small:10,large:16,huge:19};t.default=function(e){var t=e.type,n=e.size,o=void 0===n?"small":n;!function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}(e,["type","size"]);return i.default.createElement("svg",{className:"currency-icon",width:a[o],height:a[o],viewBox:"0 0 78 78"},i.default.createElement("g",{className:"currency-icon--"+t},i.default.createElement("polygon",{points:"5 19.6258065 38.4980127 0 73 19.6258065 73 57.3677419 38.5 78 5 57.3677419"})))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],n=this.props.topic;this.props.onVote(n.id,e.name,t,e.currency,e.score)}},{key:"_edit",value:function(e){this.setState({editing:!0})}},{key:"_changeTitle",value:function(e){this.setState({title:e.target.value})}},{key:"_changeDescription",value:function(e){this.setState({description:e.target.value})}},{key:"_changeSettings",value:function(e){e.label;var t=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}(e,["label"]),n=this.props.topic;this.props.onChangeSettings(n.id,t)}},{key:"_saveChanges",value:function(e){var t=this,n=this.props.topic,o=this.state,r=o.title,i=o.description;this.props.onChangeSettings(n.id,{title:r,description:i}).then((function(e){e&&t.setState({editing:!1})}))}}]),t}(r.default.Component);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;tt&&(h[n]=o)}))})),a.default.createElement("div",{className:v},a.default.createElement("div",{className:v+"__top"},a.default.createElement("h1",{className:v+"__title"},"Vote and Prioritize"),a.default.createElement(c.default,{loading:o||r||n,userData:d,possibleVotes:p&&p.possibleVotes,refresh:this._refresh.bind(this),startLogin:this._api.startLogin})),a.default.createElement("p",{className:v+"__description"},"This mini-application allows you to browse and vote on new features for webpack. Log in with your GitHub credentials and you will notice that you have a certain amount of points/influence that can be used to vote for or against any of the features listed below. The following two sections describe the different types of influence and how they can be attained."),a.default.createElement("div",{className:v+"__influences"},a.default.createElement(u.default,{className:v+"__influence-section",type:"normal"}),a.default.createElement(u.default,{className:v+"__influence-section",type:"golden"})),p&&a.default.createElement("ul",{className:v+"__topics"},p.items.map((function(t){return a.default.createElement("li",{key:t.id},a.default.createElement(l.default,{user:d,admin:p.isAdmin,topic:t,votes:p.possibleVotes,onVote:e._vote.bind(e),onChangeSettings:e._changeTopicSettings.bind(e)}))}))),p&&p.isAdmin?a.default.createElement("div",{className:v+"__new"},this.state.newTopics.map((function(t){return a.default.createElement(f.default,{key:t,id:t,onCreate:e._createTopic.bind(e)})})),a.default.createElement("a",{className:v+"__add",onClick:this._addTopic.bind(this)},"Add a new topic...")):null)):a.default.createElement("div",null,"Your browser is not supported.")}},{key:"componentDidMount",value:function(){var e=this.state,t=e.selfInfo,n=e.listInfo;this._supportedBrowser&&(this._api.isLoginActive()?(this.setState({isLoginActive:!0}),this._api.continueLogin().then((function(e){window.localStorage.voteAppToken=e}))):(t||this._updateUser(),n||this._updateList()))}},{key:"componentWillReceiveProps",value:function(e){this._supportedBrowser&&this._updateList(e)}},{key:"_updateUser",value:function(){var e=this,t=localStorage.voteAppToken;t&&(this.setState({isFetchingSelf:!0}),this._api.getSelf(t).then((function(t){e.setState({selfInfo:t})})).catch((function(t){console.error("Failed to fetch user information: ",t),e.setState({selfInfo:null})})).then((function(){e.setState({isFetchingSelf:!1})})))}},{key:"_updateList",value:function(){var e=this,t=this.state.list,n=localStorage.voteAppToken;this.setState({isFetchingList:!0}),this._api.getList(n,t).then((function(t){e.setState({listInfo:t})})).catch((function(t){console.error("Failed to fetch topic list: ",t),e.setState({listInfo:null})})).then((function(){e.setState({isFetchingList:!1})}))}},{key:"_addTopic",value:function(){this.setState({newTopics:[].concat(y(this.state.newTopics),[(0,s.default)()])})}},{key:"_createTopic",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=this.state,a=i.list,s=i.listInfo,u=localStorage,c=u.voteAppToken;return this._api.createItem(c,a,n,r).then((function(n){return t.setState({newTopics:t.state.newTopics.filter((function(t){return t!==e})),listInfo:s&&o({},s,{items:[].concat(y(s.items),[n])})}),!0}))}},{key:"_changeTopicSettings",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=localStorage,r=o.voteAppToken;return this._api.configItem(r,e,n).then((function(){return t._updateList()})).then((function(){return!0}))}},{key:"_refresh",value:function(){this._updateUser(),this._updateList()}},{key:"_vote",value:function(e,t,n,o,r){var i=this,a=localStorage.voteAppToken;n&&(this._localVote(e,t,n,o,r),this._api.vote(a,e,t,n).catch((function(a){console.error(a),i._localVote(e,t,-n,o,r)})).then((function(){i.setState({isVoting:i.state.isVoting-1})})))}},{key:"_localVote",value:function(e,t,n,r,i){var a=this,s=this.state,u=s.listInfo,c=s.selfInfo;this.setState({isVoting:this.state.isVoting+1,listInfo:u&&o({},u,{items:this._updateByProperty(u.items,"id",e,(function(e){return o({},e,{votes:a._updateByProperty(e.votes,"name",t,(function(e){return o({},e,{votes:e.votes+n})})),userVotes:a._updateByProperty(e.userVotes,"name",t,(function(e){return o({},e,{votes:e.votes+n})})),score:e.score+i*n})}))}),selfInfo:c&&o({},c,{currencies:this._updateByProperty(c.currencies,"name",r,(function(e){return o({},e,{used:e.used+n,remaining:e.remaining-n})}))})})}},{key:"_updateByProperty",value:function(e,t,n,o){return e.map((function(e){return e[t]===n?o(e):e}))}}]),t}(a.default.Component);t.default=b},function(e,t,n){var o=n(7),r=n(9);e.exports=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||o)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var s=0;s<16;++s)t[i+s]=a[s];return t||r(a)}},function(e,t,n){(function(t){var n,o=t.crypto||t.msCrypto;if(o&&o.getRandomValues){var r=new Uint8Array(16);n=function(){return o.getRandomValues(r),r}}if(!n){var i=new Array(16);n=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}e.exports=n}).call(this,n(8))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){for(var n=[],o=0;o<256;++o)n[o]=(o+256).toString(16).substr(1);e.exports=function(e,t){var o=t||0,r=n;return r[e[o++]]+r[e[o++]]+r[e[o++]]+r[e[o++]]+"-"+r[e[o++]]+r[e[o++]]+"-"+r[e[o++]]+r[e[o++]]+"-"+r[e[o++]]+r[e[o++]]+"-"+r[e[o++]]+r[e[o++]]+r[e[o++]]+r[e[o++]]+r[e[o++]]+r[e[o++]]}},function(e,t){!function(e){"use strict";if(!e.fetch){var t="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,o="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),r="FormData"in e,i="ArrayBuffer"in e;if(i)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=function(e){return e&&DataView.prototype.isPrototypeOf(e)},u=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};h.prototype.append=function(e,t){e=f(e),t=d(t);var n=this.map[e];this.map[e]=n?n+","+t:t},h.prototype.delete=function(e){delete this.map[f(e)]},h.prototype.get=function(e){return e=f(e),this.has(e)?this.map[e]:null},h.prototype.has=function(e){return this.map.hasOwnProperty(f(e))},h.prototype.set=function(e,t){this.map[f(e)]=d(t)},h.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},h.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),p(e)},h.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),p(e)},h.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),p(e)},n&&(h.prototype[Symbol.iterator]=h.prototype.entries);var c=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},_.call(g.prototype),_.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},E.error=function(){var e=new E(null,{status:0,statusText:""});return e.type="error",e};var l=[301,302,303,307,308];E.redirect=function(e,t){if(-1===l.indexOf(t))throw new RangeError("Invalid status code");return new E(null,{status:t,headers:{location:e}})},e.Headers=h,e.Request=g,e.Response=E,e.fetch=function(e,t){return new Promise((function(n,r){var i=new g(e,t),a=new XMLHttpRequest;a.onload=function(){var e,t,o={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new h,e.split(/\r?\n/).forEach((function(e){var n=e.split(":"),o=n.shift().trim();if(o){var r=n.join(":").trim();t.append(o,r)}})),t)};o.url="responseURL"in a?a.responseURL:o.headers.get("X-Request-URL");var r="response"in a?a.response:a.responseText;n(new E(r,o))},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request failed"))},a.open(i.method,i.url,!0),"include"===i.credentials&&(a.withCredentials=!0),"responseType"in a&&o&&(a.responseType="blob"),i.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),a.send(void 0===i._bodyInit?null:i._bodyInit)}))},e.fetch.polyfill=!0}function f(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function d(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function m(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function y(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function v(e){var t=new FileReader,n=y(t);return t.readAsArrayBuffer(e),n}function b(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(o&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(r&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(i&&o&&s(e))this._bodyArrayBuffer=b(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!i||!ArrayBuffer.prototype.isPrototypeOf(e)&&!u(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=b(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=m(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?m(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var e,t,n,o=m(this);if(o)return o;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=y(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),o=0;o-1?o:n),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),o=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(o),decodeURIComponent(r))}})),t}function E(e,t){t||(t={}),this.type="default",this.status="status"in t?t.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=i(n(0)),r=i(n(2));function i(e){return e&&e.__esModule?e:{default:e}}n(13);var a="influence";t.default=function(e){return"normal"===e.type?o.default.createElement("section",{className:a},o.default.createElement("h2",{className:a+"__header"},"Influence  ",o.default.createElement(r.default,{size:"huge",type:"influence"})),o.default.createElement("p",{className:a+"__description"},o.default.createElement("em",null,"Influence")," is a unit of measure based on time you have been a member on GitHub. However, from 2017 on you will recieve one influence per day.")):o.default.createElement("section",{className:a},o.default.createElement("h2",{className:a+"__header"},"Golden Influence  ",o.default.createElement(r.default,{size:"huge",type:"goldenInfluence"})),o.default.createElement("p",{className:a+"__description"},o.default.createElement("em",null,"Golden Influence")," is equal to 100 ",o.default.createElement("i",null,"normal influence"),". Golden Influence is obtained by being a backer or sponsor on our ",o.default.createElement("a",{href:"https://opencollective.com/webpack"},"Open Collective page"),"."))}},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n=0||(r[n]=e[n]);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,["minRows","maxRows","onHeightChange","useCacheForDOMMeasurements","inputRef"]));return t.style=s({},t.style,{height:this.state.height}),Math.max(t.style.maxHeight||1/0,this.state.maxHeight)0&&void 0!==arguments[0]?arguments[0]:"",t=""+Math.random();e.includes("webpack.js.org")?(window.localStorage.githubState=t,window.location="https://github.com/login/oauth/authorize?client_id=4d355e2799cb8926c665&scope=user:email&state="+t+"&allow_signup=false&redirect_uri="+encodeURIComponent(e)):alert("You can't login with GitHub OAuth on localhost. Please pass the `development` prop to the `Wrapper` in order to use `api.dev`.");return Promise.resolve()},t.continueLogin=function(){var e=/^\?code=([^&]*)&state=([^&]*)/.exec(window.location.search);if(e)return(t=e[1],n=e[2],n!==window.localStorage.githubState?Promise.reject(new Error("Request state doesn't match (Login was triggered by 3rd party)")):(delete window.localStorage.githubState,fetch(o+"/login",{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({code:t,state:n})}).then((function(e){return e.json()})).then(r).then((function(e){if(!e.token)throw new Error("No token received from API");return e.token})))).then((function(e){return setTimeout((function(){var e=window.location.href;window.location=e.substr(0,e.length-window.location.search.length)}),100),e}));var t,n;return Promise.resolve()},t.getSelf=function(e){return fetch(o+"/self?token="+e,{mode:"cors"}).then((function(e){return e.json()})).then(r)},t.getList=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"todo";return fetch(o+"/list/"+t+(e?"?token="+e:""),{mode:"cors"}).then((function(e){return e.json()})).then(r)},t.createItem=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"todo",n=arguments[2],i=arguments[3];return fetch(o+"/list/"+t+"?token="+e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n,description:i})}).then((function(e){return e.json()})).then(r)},t.vote=function(e,t,n,i){return fetch(o+"/vote/"+t+"/"+n+"?token="+e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:i})}).then((function(e){return e.json()})).then(r).then((function(e){return!0}))},t.configItem=function(e,t,n){return fetch(o+"/config/"+t+"?token="+e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:n})}).then((function(e){return e.json()})).then(r).then((function(e){return!0}))};var o="https://oswils44oj.execute-api.us-east-1.amazonaws.com/production/";function r(e){if(!e)throw new Error("No result received");if(e.errorMessage)throw new Error(e.errorMessage);return e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:"todo",n="developer"===e,o=s[t];return c(500).then((function(){return{name:t,displayName:"Development Mode: "+t,description:"These items are simply for testing functionality...",lockable:!0,deletable:!0,archivable:!0,isAdmin:!0,possibleVotes:o.possibleVotes,items:s[t].items.map((function(e){var t=o.possibleVotes.map((function(t){return{name:t.name,votes:(e[t.name]||0)+Math.floor(100*Math.random())}})),r=o.possibleVotes.map((function(e,n){return e.score*t[n].votes})).reduce((function(e,t){return e+t}),0);return{id:e.id,list:e.list,title:e.title,locked:e.locked||!1,archived:e.archived||!1,description:e.description,votes:t,userVotes:n?o.possibleVotes.map((function(t){return{name:t.name,votes:e[t.name]||0}})):void 0,score:r}})).sort((function(e,t){return t.score-e.score}))}}))},t.createItem=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"todo",n=arguments[2],r=arguments[3];if("developer"!==e)return Promise.reject(new Error("Not logged in as developer"));var i={id:Math.random()+"",list:t,title:n,description:r};return u[i.id]=i,s[t].items.push(i),c(500).then((function(){return o({},i,{score:0,votes:s[t].possibleVotes.map((function(e){return{name:e.name,votes:0}})),userVotes:s[t].possibleVotes.map((function(e){return{name:e.name,votes:0}}))})}))},t.vote=function(e,t,n,o){if("developer"!==e)return Promise.reject(new Error("Not logged in as developer"));var i=u[t].list,a=s[i].possibleVotes.filter((function(e){return e.name===n}))[0];return a.currency&&(r[a.currency]+=o),u[t][n]=(u[t][n]||0)+o,c(500).then((function(){return!0}))},t.configItem=function(e,t,n){var o=u[t];return"developer"!==e?Promise.reject(new Error("Not logged in as developer")):(Object.assign(o,n),c(500).then((function(){return!0})))};var r={influence:100,goldenInfluence:100},i=1e3,a=300,s={todo:{possibleVotes:[{name:"influence",currency:"influence",score:1,color:"blue"},{name:"golden",currency:"goldenInfluence",score:100,color:"#bfa203"}],items:[{id:"1234",list:"todo",title:"Some Feature",description:"Mauris et sem a risus pharetra suscipit. Fusce gravida purus non nisi pulvinar, non lobortis tortor vehicula. Mauris at dui a ex vestibulum condimentum id sit amet nisl. Nam finibus ornare laoreet. Duis ultrices sollicitudin quam eu vulputate. Sed ac ante odio. Mauris fermentum vel tortor sit amet iaculis.",influence:15},{id:"2345",list:"todo",title:"Review Stuff",description:"Cras libero libero, elementum eu laoreet nec, convallis sit amet sem. Donec ut diam dignissim, hendrerit ante id, congue felis. In hac habitasse platea dictumst. Donec sit amet tellus et neque auctor consequat. Cras porta finibus turpis, id auctor lectus.",golden:20},{id:"3456",list:"todo",title:"Another Feature",description:"Curabitur pharetra facilisis mauris. Integer interdum venenatis metus quis dictum. Cras aliquet erat ut risus vestibulum, sed tincidunt enim maximus. Cras tincidunt vulputate ante vitae tincidunt. Cras quis erat eu augue aliquam pretium nec sit amet magna. Etiam nisi nunc, blandit vel hendrerit et, suscipit finibus nunc.",golden:20}]}},u={1234:s.todo.items[0],2345:s.todo.items[1],3456:s.todo.items[2]};function c(e){return new Promise((function(t){setTimeout(t,e)}))}},function(e,t,n){}])})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.vote=t(require("react")):e.vote=t(e.React)}(window,(function(e){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=5)}([function(t,n){t.exports=e},function(e,t,n){e.exports=n(20)()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=n(0),i=(o=r)&&o.__esModule?o:{default:o};n(12);var a={small:10,large:16,huge:19};t.default=function(e){var t=e.type,n=e.size,o=void 0===n?"small":n;!function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}(e,["type","size"]);return i.default.createElement("svg",{className:"currency-icon",width:a[o],height:a[o],viewBox:"0 0 78 78"},i.default.createElement("g",{className:"currency-icon--"+t},i.default.createElement("polygon",{points:"5 19.6258065 38.4980127 0 73 19.6258065 73 57.3677419 38.5 78 5 57.3677419"})))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],n=this.props.topic;this.props.onVote(n.id,e.name,t,e.currency,e.score)}},{key:"_edit",value:function(e){this.setState({editing:!0})}},{key:"_changeTitle",value:function(e){this.setState({title:e.target.value})}},{key:"_changeDescription",value:function(e){this.setState({description:e.target.value})}},{key:"_changeSettings",value:function(e){e.label;var t=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}(e,["label"]),n=this.props.topic;this.props.onChangeSettings(n.id,t)}},{key:"_saveChanges",value:function(e){var t=this,n=this.props.topic,o=this.state,r=o.title,i=o.description;this.props.onChangeSettings(n.id,{title:r,description:i}).then((function(e){e&&t.setState({editing:!1})}))}}]),t}(r.default.Component);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;tt&&(h[n]=o)}))})),a.default.createElement("div",{className:v},a.default.createElement("div",{className:v+"__top"},a.default.createElement("h1",{className:v+"__title"},"Vote and Prioritize"),a.default.createElement(c.default,{loading:o||r||n,userData:d,possibleVotes:p&&p.possibleVotes,refresh:this._refresh.bind(this),startLogin:this._api.startLogin})),a.default.createElement("p",{className:v+"__description"},"This mini-application allows you to browse and vote on new features for webpack. Log in with your GitHub credentials and you will notice that you have a certain amount of points/influence that can be used to vote for or against any of the features listed below. The following two sections describe the different types of influence and how they can be attained."),a.default.createElement("div",{className:v+"__influences"},a.default.createElement(u.default,{className:v+"__influence-section",type:"normal"}),a.default.createElement(u.default,{className:v+"__influence-section",type:"golden"})),p&&a.default.createElement("ul",{className:v+"__topics"},p.items.map((function(t){return a.default.createElement("li",{key:t.id},a.default.createElement(l.default,{user:d,admin:p.isAdmin,topic:t,votes:p.possibleVotes,onVote:e._vote.bind(e),onChangeSettings:e._changeTopicSettings.bind(e)}))}))),p&&p.isAdmin?a.default.createElement("div",{className:v+"__new"},this.state.newTopics.map((function(t){return a.default.createElement(f.default,{key:t,id:t,onCreate:e._createTopic.bind(e)})})),a.default.createElement("a",{className:v+"__add",onClick:this._addTopic.bind(this)},"Add a new topic...")):null)):a.default.createElement("div",null,"Your browser is not supported.")}},{key:"componentDidMount",value:function(){var e=this.state,t=e.selfInfo,n=e.listInfo;this._supportedBrowser&&(this._api.isLoginActive()?(this.setState({isLoginActive:!0}),this._api.continueLogin().then((function(e){window.localStorage.voteAppToken=e}))):(t||this._updateUser(),n||this._updateList()))}},{key:"_updateUser",value:function(){var e=this,t=localStorage.voteAppToken;t&&(this.setState({isFetchingSelf:!0}),this._api.getSelf(t).then((function(t){e.setState({selfInfo:t})})).catch((function(t){console.error("Failed to fetch user information: ",t),e.setState({selfInfo:null})})).then((function(){e.setState({isFetchingSelf:!1})})))}},{key:"_updateList",value:function(){var e=this,t=this.state.list,n=localStorage.voteAppToken;this.setState({isFetchingList:!0}),this._api.getList(n,t).then((function(t){e.setState({listInfo:t})})).catch((function(t){console.error("Failed to fetch topic list: ",t),e.setState({listInfo:null})})).then((function(){e.setState({isFetchingList:!1})}))}},{key:"_addTopic",value:function(){this.setState({newTopics:[].concat(y(this.state.newTopics),[(0,s.default)()])})}},{key:"_createTopic",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=this.state,a=i.list,s=i.listInfo,u=localStorage,c=u.voteAppToken;return this._api.createItem(c,a,n,r).then((function(n){return t.setState({newTopics:t.state.newTopics.filter((function(t){return t!==e})),listInfo:s&&o({},s,{items:[].concat(y(s.items),[n])})}),!0}))}},{key:"_changeTopicSettings",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=localStorage,r=o.voteAppToken;return this._api.configItem(r,e,n).then((function(){return t._updateList()})).then((function(){return!0}))}},{key:"_refresh",value:function(){this._updateUser(),this._updateList()}},{key:"_vote",value:function(e,t,n,o,r){var i=this,a=localStorage.voteAppToken;n&&(this._localVote(e,t,n,o,r),this._api.vote(a,e,t,n).catch((function(a){console.error(a),i._localVote(e,t,-n,o,r)})).then((function(){i.setState({isVoting:i.state.isVoting-1})})))}},{key:"_localVote",value:function(e,t,n,r,i){var a=this,s=this.state,u=s.listInfo,c=s.selfInfo;this.setState({isVoting:this.state.isVoting+1,listInfo:u&&o({},u,{items:this._updateByProperty(u.items,"id",e,(function(e){return o({},e,{votes:a._updateByProperty(e.votes,"name",t,(function(e){return o({},e,{votes:e.votes+n})})),userVotes:a._updateByProperty(e.userVotes,"name",t,(function(e){return o({},e,{votes:e.votes+n})})),score:e.score+i*n})}))}),selfInfo:c&&o({},c,{currencies:this._updateByProperty(c.currencies,"name",r,(function(e){return o({},e,{used:e.used+n,remaining:e.remaining-n})}))})})}},{key:"_updateByProperty",value:function(e,t,n,o){return e.map((function(e){return e[t]===n?o(e):e}))}}]),t}(a.default.Component);t.default=b},function(e,t,n){var o=n(7),r=n(9);e.exports=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||o)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var s=0;s<16;++s)t[i+s]=a[s];return t||r(a)}},function(e,t,n){(function(t){var n,o=t.crypto||t.msCrypto;if(o&&o.getRandomValues){var r=new Uint8Array(16);n=function(){return o.getRandomValues(r),r}}if(!n){var i=new Array(16);n=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}e.exports=n}).call(this,n(8))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){for(var n=[],o=0;o<256;++o)n[o]=(o+256).toString(16).substr(1);e.exports=function(e,t){var o=t||0,r=n;return r[e[o++]]+r[e[o++]]+r[e[o++]]+r[e[o++]]+"-"+r[e[o++]]+r[e[o++]]+"-"+r[e[o++]]+r[e[o++]]+"-"+r[e[o++]]+r[e[o++]]+"-"+r[e[o++]]+r[e[o++]]+r[e[o++]]+r[e[o++]]+r[e[o++]]+r[e[o++]]}},function(e,t){!function(e){"use strict";if(!e.fetch){var t="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,o="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),r="FormData"in e,i="ArrayBuffer"in e;if(i)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=function(e){return e&&DataView.prototype.isPrototypeOf(e)},u=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};h.prototype.append=function(e,t){e=f(e),t=d(t);var n=this.map[e];this.map[e]=n?n+","+t:t},h.prototype.delete=function(e){delete this.map[f(e)]},h.prototype.get=function(e){return e=f(e),this.has(e)?this.map[e]:null},h.prototype.has=function(e){return this.map.hasOwnProperty(f(e))},h.prototype.set=function(e,t){this.map[f(e)]=d(t)},h.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},h.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),p(e)},h.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),p(e)},h.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),p(e)},n&&(h.prototype[Symbol.iterator]=h.prototype.entries);var c=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},g.call(_.prototype),g.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},E.error=function(){var e=new E(null,{status:0,statusText:""});return e.type="error",e};var l=[301,302,303,307,308];E.redirect=function(e,t){if(-1===l.indexOf(t))throw new RangeError("Invalid status code");return new E(null,{status:t,headers:{location:e}})},e.Headers=h,e.Request=_,e.Response=E,e.fetch=function(e,t){return new Promise((function(n,r){var i=new _(e,t),a=new XMLHttpRequest;a.onload=function(){var e,t,o={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new h,e.split(/\r?\n/).forEach((function(e){var n=e.split(":"),o=n.shift().trim();if(o){var r=n.join(":").trim();t.append(o,r)}})),t)};o.url="responseURL"in a?a.responseURL:o.headers.get("X-Request-URL");var r="response"in a?a.response:a.responseText;n(new E(r,o))},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request failed"))},a.open(i.method,i.url,!0),"include"===i.credentials&&(a.withCredentials=!0),"responseType"in a&&o&&(a.responseType="blob"),i.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),a.send(void 0===i._bodyInit?null:i._bodyInit)}))},e.fetch.polyfill=!0}function f(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function d(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function m(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function y(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function v(e){var t=new FileReader,n=y(t);return t.readAsArrayBuffer(e),n}function b(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(o&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(r&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(i&&o&&s(e))this._bodyArrayBuffer=b(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!i||!ArrayBuffer.prototype.isPrototypeOf(e)&&!u(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=b(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=m(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?m(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var e,t,n,o=m(this);if(o)return o;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=y(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),o=0;o-1?o:n),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),o=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(o),decodeURIComponent(r))}})),t}function E(e,t){t||(t={}),this.type="default",this.status="status"in t?t.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=i(n(0)),r=i(n(2));function i(e){return e&&e.__esModule?e:{default:e}}n(13);var a="influence";t.default=function(e){return"normal"===e.type?o.default.createElement("section",{className:a},o.default.createElement("h2",{className:a+"__header"},"Influence  ",o.default.createElement(r.default,{size:"huge",type:"influence"})),o.default.createElement("p",{className:a+"__description"},o.default.createElement("em",null,"Influence")," is a unit of measure based on time you have been a member on GitHub. However, from 2017 on you will recieve one influence per day.")):o.default.createElement("section",{className:a},o.default.createElement("h2",{className:a+"__header"},"Golden Influence  ",o.default.createElement(r.default,{size:"huge",type:"goldenInfluence"})),o.default.createElement("p",{className:a+"__description"},o.default.createElement("em",null,"Golden Influence")," is equal to 100 ",o.default.createElement("i",null,"normal influence"),". Golden Influence is obtained by being a backer or sponsor on our ",o.default.createElement("a",{href:"https://opencollective.com/webpack"},"Open Collective page"),"."))}},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n=0||(r[n]=e[n]);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,["minRows","maxRows","onHeightChange","useCacheForDOMMeasurements","inputRef"]));return t.style=s({},t.style,{height:this.state.height}),Math.max(t.style.maxHeight||1/0,this.state.maxHeight)0&&void 0!==arguments[0]?arguments[0]:"",t=""+Math.random();e.includes("webpack.js.org")?(window.localStorage.githubState=t,window.location="https://github.com/login/oauth/authorize?client_id=4d355e2799cb8926c665&scope=user:email&state="+t+"&allow_signup=false&redirect_uri="+encodeURIComponent(e)):alert("You can't login with GitHub OAuth on localhost. Please pass the `development` prop to the `Wrapper` in order to use `api.dev`.");return Promise.resolve()},t.continueLogin=function(){var e=/^\?code=([^&]*)&state=([^&]*)/.exec(window.location.search);if(e)return(t=e[1],n=e[2],n!==window.localStorage.githubState?Promise.reject(new Error("Request state doesn't match (Login was triggered by 3rd party)")):(delete window.localStorage.githubState,fetch(o+"/login",{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({code:t,state:n})}).then((function(e){return e.json()})).then(r).then((function(e){if(!e.token)throw new Error("No token received from API");return e.token})))).then((function(e){return setTimeout((function(){var e=window.location.href;window.location=e.substr(0,e.length-window.location.search.length)}),100),e}));var t,n;return Promise.resolve()},t.getSelf=function(e){return fetch(o+"/self?token="+e,{mode:"cors"}).then((function(e){return e.json()})).then(r)},t.getList=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"todo";return fetch(o+"/list/"+t+(e?"?token="+e:""),{mode:"cors"}).then((function(e){return e.json()})).then(r)},t.createItem=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"todo",n=arguments[2],i=arguments[3];return fetch(o+"/list/"+t+"?token="+e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n,description:i})}).then((function(e){return e.json()})).then(r)},t.vote=function(e,t,n,i){return fetch(o+"/vote/"+t+"/"+n+"?token="+e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:i})}).then((function(e){return e.json()})).then(r).then((function(e){return!0}))},t.configItem=function(e,t,n){return fetch(o+"/config/"+t+"?token="+e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:n})}).then((function(e){return e.json()})).then(r).then((function(e){return!0}))};var o="https://oswils44oj.execute-api.us-east-1.amazonaws.com/production/";function r(e){if(!e)throw new Error("No result received");if(e.errorMessage)throw new Error(e.errorMessage);return e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:"todo",n="developer"===e,o=s[t];return c(500).then((function(){return{name:t,displayName:"Development Mode: "+t,description:"These items are simply for testing functionality...",lockable:!0,deletable:!0,archivable:!0,isAdmin:!0,possibleVotes:o.possibleVotes,items:s[t].items.map((function(e){var t=o.possibleVotes.map((function(t){return{name:t.name,votes:(e[t.name]||0)+Math.floor(100*Math.random())}})),r=o.possibleVotes.map((function(e,n){return e.score*t[n].votes})).reduce((function(e,t){return e+t}),0);return{id:e.id,list:e.list,title:e.title,locked:e.locked||!1,archived:e.archived||!1,description:e.description,votes:t,userVotes:n?o.possibleVotes.map((function(t){return{name:t.name,votes:e[t.name]||0}})):void 0,score:r}})).sort((function(e,t){return t.score-e.score}))}}))},t.createItem=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"todo",n=arguments[2],r=arguments[3];if("developer"!==e)return Promise.reject(new Error("Not logged in as developer"));var i={id:Math.random()+"",list:t,title:n,description:r};return u[i.id]=i,s[t].items.push(i),c(500).then((function(){return o({},i,{score:0,votes:s[t].possibleVotes.map((function(e){return{name:e.name,votes:0}})),userVotes:s[t].possibleVotes.map((function(e){return{name:e.name,votes:0}}))})}))},t.vote=function(e,t,n,o){if("developer"!==e)return Promise.reject(new Error("Not logged in as developer"));var i=u[t].list,a=s[i].possibleVotes.filter((function(e){return e.name===n}))[0];return a.currency&&(r[a.currency]+=o),u[t][n]=(u[t][n]||0)+o,c(500).then((function(){return!0}))},t.configItem=function(e,t,n){var o=u[t];return"developer"!==e?Promise.reject(new Error("Not logged in as developer")):(Object.assign(o,n),c(500).then((function(){return!0})))};var r={influence:100,goldenInfluence:100},i=1e3,a=300,s={todo:{possibleVotes:[{name:"influence",currency:"influence",score:1,color:"blue"},{name:"golden",currency:"goldenInfluence",score:100,color:"#bfa203"}],items:[{id:"1234",list:"todo",title:"Some Feature",description:"Mauris et sem a risus pharetra suscipit. Fusce gravida purus non nisi pulvinar, non lobortis tortor vehicula. Mauris at dui a ex vestibulum condimentum id sit amet nisl. Nam finibus ornare laoreet. Duis ultrices sollicitudin quam eu vulputate. Sed ac ante odio. Mauris fermentum vel tortor sit amet iaculis.",influence:15},{id:"2345",list:"todo",title:"Review Stuff",description:"Cras libero libero, elementum eu laoreet nec, convallis sit amet sem. Donec ut diam dignissim, hendrerit ante id, congue felis. In hac habitasse platea dictumst. Donec sit amet tellus et neque auctor consequat. Cras porta finibus turpis, id auctor lectus.",golden:20},{id:"3456",list:"todo",title:"Another Feature",description:"Curabitur pharetra facilisis mauris. Integer interdum venenatis metus quis dictum. Cras aliquet erat ut risus vestibulum, sed tincidunt enim maximus. Cras tincidunt vulputate ante vitae tincidunt. Cras quis erat eu augue aliquam pretium nec sit amet magna. Etiam nisi nunc, blandit vel hendrerit et, suscipit finibus nunc.",golden:20}]}},u={1234:s.todo.items[0],2345:s.todo.items[1],3456:s.todo.items[2]};function c(e){return new Promise((function(t){setTimeout(t,e)}))}},function(e,t,n){}])})); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index cd941c7..51aee9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3170,17 +3170,6 @@ "sha.js": "^2.4.8" } }, - "create-react-class": { - "version": "15.6.2", - "resolved": "https://registry.npmjs.org/create-react-class/-/create-react-class-15.6.2.tgz", - "integrity": "sha1-zx7RXxKq1/FO9fLf4F5sQvke8Co=", - "dev": true, - "requires": { - "fbjs": "^0.8.9", - "loose-envify": "^1.3.1", - "object-assign": "^4.1.1" - } - }, "cross-spawn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", @@ -12786,30 +12775,82 @@ } }, "react": { - "version": "15.6.2", - "resolved": "https://registry.npmjs.org/react/-/react-15.6.2.tgz", - "integrity": "sha1-26BDSrQ5z+gvEI8PURZjkIF5qnI=", + "version": "16.13.0", + "resolved": "https://registry.npmjs.org/react/-/react-16.13.0.tgz", + "integrity": "sha512-TSavZz2iSLkq5/oiE7gnFzmURKZMltmi193rm5HEoUDAXpzT9Kzw6oNZnGoai/4+fUnm7FqS5dwgUL34TujcWQ==", "dev": true, "requires": { - "create-react-class": "^15.6.0", - "fbjs": "^0.8.9", "loose-envify": "^1.1.0", - "object-assign": "^4.1.0", - "prop-types": "^15.5.10" + "object-assign": "^4.1.1", + "prop-types": "^15.6.2" + }, + "dependencies": { + "prop-types": { + "version": "15.7.2", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", + "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", + "dev": true, + "requires": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.8.1" + }, + "dependencies": { + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + } + } + } } }, "react-dom": { - "version": "15.6.2", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-15.6.2.tgz", - "integrity": "sha1-Qc+t9pO3V/rycIRDodH9WgK+9zA=", + "version": "16.13.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.13.0.tgz", + "integrity": "sha512-y09d2c4cG220DzdlFkPTnVvGTszVvNpC73v+AaLGLHbkpy3SSgvYq8x0rNwPJ/Rk/CicTNgk0hbHNw1gMEZAXg==", "dev": true, "requires": { - "fbjs": "^0.8.9", "loose-envify": "^1.1.0", - "object-assign": "^4.1.0", - "prop-types": "^15.5.10" + "object-assign": "^4.1.1", + "prop-types": "^15.6.2", + "scheduler": "^0.19.0" + }, + "dependencies": { + "prop-types": { + "version": "15.7.2", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", + "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", + "dev": true, + "requires": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.8.1" + }, + "dependencies": { + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + } + } + } } }, + "react-is": { + "version": "16.13.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.0.tgz", + "integrity": "sha512-GFMtL0vHkiBv9HluwNZTggSn/sCyEt9n02aM0dSAjGGyqyNlAyftYm4phPxdvCigG15JreC5biwxCgTAJZ7yAA==", + "dev": true + }, "react-textarea-autosize": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/react-textarea-autosize/-/react-textarea-autosize-5.2.1.tgz", @@ -13736,6 +13777,16 @@ "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "dev": true }, + "scheduler": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.0.tgz", + "integrity": "sha512-xowbVaTPe9r7y7RUejcK73/j8tt2jfiyTednOvHbA8JoClvMYCp+r8QegLwK/n8zWQAtZb1fFnER4XLBZXrCxA==", + "dev": true, + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1" + } + }, "schema-utils": { "version": "0.4.7", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz", diff --git a/package.json b/package.json index 5cb2486..37c52eb 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,8 @@ "node-sass": "^4.13.1", "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss-loader": "^2.1.6", - "react": "^15.5.4", - "react-dom": "^15.5.4", + "react": "^16.13.0", + "react-dom": "^16.13.0", "sass-loader": "^6.0.3", "standard-version": "^4.2.0", "style-loader": "^1.1.3", diff --git a/src/components/dropdown/dropdown.jsx b/src/components/dropdown/dropdown.jsx index b50a9b1..c1607b5 100644 --- a/src/components/dropdown/dropdown.jsx +++ b/src/components/dropdown/dropdown.jsx @@ -50,7 +50,7 @@ export default class Dropdown extends React.Component { ); } - componentWillMount() { + componentDidMount() { if ( document ) { document.addEventListener( 'click', diff --git a/src/components/wrapper/wrapper.jsx b/src/components/wrapper/wrapper.jsx index a983a91..a85f5f9 100644 --- a/src/components/wrapper/wrapper.jsx +++ b/src/components/wrapper/wrapper.jsx @@ -139,12 +139,6 @@ export default class Wrapper extends React.Component { } } - componentWillReceiveProps(props) { - if ( !this._supportedBrowser ) return; - - this._updateList(props); - } - /** * Fetch user information and available influence * diff --git a/webpack.dist.babel.js b/webpack.dist.babel.js index b278aeb..7680f4a 100644 --- a/webpack.dist.babel.js +++ b/webpack.dist.babel.js @@ -13,14 +13,9 @@ export default env => Merge(CommonConfig(env), { commonjs2: 'react', commonjs: 'react', amd: 'react' - }, - 'react-dom': { - root: 'ReactDOM', - commonjs2: 'react-dom', - commonjs: 'react-dom', - amd: 'react-dom' } }, + plugins: [ new OptimizeCssAssetsPlugin({ assetNameRegExp: /\.min\.css$/g,