scrivito-news-reader
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("scrivito"),require("axios")):"function"==typeof define&&define.amd?define(["react","scrivito","axios"],t):"object"==typeof exports?exports["scrivito-news-api"]=t(require("react"),require("scrivito"),require("axios")):e["scrivito-news-api"]=t(e.react,e.scrivito,e.axios)}(window,function(e,t,n){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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=3)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t,n){"use strict";n.r(t);var r=n(1),i=(r.provideWidgetClass("NewsApiWidget",{attributes:{listType:["enum",{values:["card","list"]}],entries:"string",apiKey:"string",category:["enum",{values:["business","entertainment","general","health","science","sports","technology"]}]}}),n(0)),a=n(2),o=n.n(a);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var f=function(e){function t(e){var n,r,i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,(n=!(i=c(t).call(this,e))||"object"!==l(i)&&"function"!=typeof i?u(r):i).widget=n.props.widget,n._category=n.widget.get("category"),n.entries=n.widget.get("entries"),n.handleChange=n.handleChange.bind(u(n)),n.handleChangeEntries=n.handleChangeEntries.bind(u(n)),n.state={items:[],value:n._category,entries:n.entries},n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(t,i["Component"]),n=t,(r=[{key:"componentDidMount",value:function(){var e=this,t=this.state.value,n=this.state.entries;o.a.get("https://newsapi.org/v2/top-headlines?category=".concat(t,"&pageSize=").concat(n,"&country=de&apiKey=").concat(this.widget.get("apiKey"))).then(function(e){return e.data}).then(function(t){e.setState({items:t.articles})})}},{key:"handleChange",value:function(e){var t=this;this.setState({value:e.target.value});var n=e.target.value,r=this.state.entries;o.a.get("https://newsapi.org/v2/top-headlines?category=".concat(n,"&pageSize=").concat(r,"&country=de&apiKey=").concat(this.widget.get("apiKey"))).then(function(e){return e.data}).then(function(e){t.setState({items:e.articles})})}},{key:"handleChangeEntries",value:function(e){var t=this;this.setState({entries:e.target.value});var n=this.state.value,r=e.target.value;o.a.get("https://newsapi.org/v2/top-headlines?category=".concat(n,"&pageSize=").concat(r,"&country=de&apiKey=").concat(this.widget.get("apiKey"))).then(function(e){return e.data}).then(function(e){t.setState({items:e.articles})})}},{key:"render",value:function(){return i.createElement("div",null,i.createElement("label",null,"Number of entries"),i.createElement("select",{value:this.state.entries,onChange:this.handleChangeEntries,multiple:!1},i.createElement("option",{value:"5"},"5"),i.createElement("option",{value:"10"},"10"),i.createElement("option",{value:"15"},"15")),i.createElement("label",null,"Categories"),i.createElement("select",{value:this.state.category,onChange:this.handleChange,multiple:!1},i.createElement("option",{value:"business"},"Business"),i.createElement("option",{value:"entertainment"},"Entertainment"),i.createElement("option",{value:"general"},"General"),i.createElement("option",{value:"health"},"Health"),i.createElement("option",{value:"science"},"Science"),i.createElement("option",{value:"sports"},"Sports"),i.createElement("option",{value:"technology"},"Technology")),i.createElement("div",{className:"article"},this.state.items.map(function(e,t){return e.url.startsWith("https")?i.createElement("div",{className:"media",key:t},i.createElement("a",{target:"_blank",className:"d-md-inline",href:"".concat(e.url)},i.createElement("img",{className:"img-responsive rectangle mr-3",src:"".concat(e.urlToImage)})),i.createElement("div",{className:"media-body",key:t},i.createElement("a",{target:"_blank",href:"".concat(e.url)},i.createElement("div",null,e.source.name," "),i.createElement("h1",{className:"h5 m-0 p-0"},i.createElement("b",null,e.title)),i.createElement("p",{className:"m-0 p-0 h5"},e.description)))):null})))}}])&&s(n.prototype,r),a&&s(n,a),t}();r.provideComponent("NewsApiWidget",f),r.provideEditingConfig("NewsApiWidget",{title:"Newsapi Import",attributes:{listType:{title:"List type",values:[{value:"card",title:"List of cards"},{value:"list",title:"Simple list"}]},entries:{title:"Entries",description:"Number of entries. Default: 5"},apiKey:{title:"API-Key",description:"Your API-Key from newsapi.org"},category:{title:"Category",description:"Default: General",values:[{value:"business",title:"Business"},{value:"entertainment",title:"Entertainment"},{value:"general",title:"General"},{value:"health",title:"Health"},{value:"science",title:"Science"},{value:"sports",title:"Sports"},{value:"technology",title:"Technology"}]}},properties:["listType","entries","category","apiKey"],initialContent:{listType:"card",category:"general",entries:"5"}})}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("scrivito"),require("axios")):"function"==typeof define&&define.amd?define(["react","scrivito","axios"],t):"object"==typeof exports?exports["scrivito-news-api"]=t(require("react"),require("scrivito"),require("axios")):e["scrivito-news-api"]=t(e.react,e.scrivito,e.axios)}(window,function(e,t,n){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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=3)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t,n){"use strict";n.r(t);var r=n(1),i=(r.provideWidgetClass("NewsApiWidget",{attributes:{listType:["enum",{values:["card","list"]}],entries:"string",apiKey:"string",category:["enum",{values:["business","entertainment","general","health","science","sports","technology"]}]}}),n(0)),a=n(2),o=n.n(a);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var f=function(e){function t(e){var n,r,i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,(n=!(i=c(t).call(this,e))||"object"!==l(i)&&"function"!=typeof i?u(r):i).widget=n.props.widget,n._category=n.widget.get("category"),n.entries=n.widget.get("entries"),n.handleChange=n.handleChange.bind(u(n)),n.handleChangeEntries=n.handleChangeEntries.bind(u(n)),n.state={items:[],value:n._category,entries:n.entries},n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(t,i["Component"]),n=t,(r=[{key:"componentDidMount",value:function(){var e=this,t=this.state.value,n=this.state.entries;o.a.get("https://newsapi.org/v2/top-headlines?category=".concat(t,"&pageSize=").concat(n,"&country=de&apiKey=").concat(this.widget.get("apiKey"))).then(function(e){return e.data}).then(function(t){e.setState({items:t.articles})})}},{key:"handleChange",value:function(e){var t=this;this.setState({value:e.target.value});var n=e.target.value,r=this.state.entries;o.a.get("https://newsapi.org/v2/top-headlines?category=".concat(n,"&pageSize=").concat(r,"&country=de&apiKey=").concat(this.widget.get("apiKey"))).then(function(e){return e.data}).then(function(e){t.setState({items:e.articles})})}},{key:"handleChangeEntries",value:function(e){var t=this;this.setState({entries:e.target.value});var n=this.state.value,r=e.target.value;o.a.get("https://newsapi.org/v2/top-headlines?category=".concat(n,"&pageSize=").concat(r,"&country=de&apiKey=").concat(this.widget.get("apiKey"))).then(function(e){return e.data}).then(function(e){t.setState({items:e.articles})})}},{key:"render",value:function(){return i.createElement("div",null,i.createElement("label",null,"Number of entries: "),i.createElement("select",{value:this.state.entries,onChange:this.handleChangeEntries,multiple:!1},i.createElement("option",{value:"5"},"5"),i.createElement("option",{value:"10"},"10"),i.createElement("option",{value:"15"},"15")),i.createElement("label",null,"Categories: "),i.createElement("select",{value:this.state.category,onChange:this.handleChange,multiple:!1},i.createElement("option",{value:"business"},"Business"),i.createElement("option",{value:"entertainment"},"Entertainment"),i.createElement("option",{value:"general"},"General"),i.createElement("option",{value:"health"},"Health"),i.createElement("option",{value:"science"},"Science"),i.createElement("option",{value:"sports"},"Sports"),i.createElement("option",{value:"technology"},"Technology")),i.createElement("div",{className:"article"},this.state.items.map(function(e,t){return e.url.startsWith("https")?i.createElement("div",{className:"media",key:t},i.createElement("a",{target:"_blank",className:"d-md-inline",href:"".concat(e.url)},i.createElement("img",{className:"img-responsive rectangle mr-3",src:"".concat(e.urlToImage)})),i.createElement("div",{className:"media-body",key:t},i.createElement("a",{target:"_blank",href:"".concat(e.url)},i.createElement("div",null,e.source.name," "),i.createElement("h1",{className:"h5 m-0 p-0"},i.createElement("b",null,e.title)),i.createElement("p",{className:"m-0 p-0 h5"},e.description)))):null})))}}])&&s(n.prototype,r),a&&s(n,a),t}();r.provideComponent("NewsApiWidget",f),r.provideEditingConfig("NewsApiWidget",{title:"Newsapi Import",attributes:{listType:{title:"List type",values:[{value:"card",title:"List of cards"},{value:"list",title:"Simple list"}]},entries:{title:"Entries",description:"Number of entries. Default: 5"},apiKey:{title:"API-Key",description:"Your API-Key from newsapi.org"},category:{title:"Category",description:"Default: General",values:[{value:"business",title:"Business"},{value:"entertainment",title:"Entertainment"},{value:"general",title:"General"},{value:"health",title:"Health"},{value:"science",title:"Science"},{value:"sports",title:"Sports"},{value:"technology",title:"Technology"}]}},properties:["listType","entries","category","apiKey"],initialContent:{listType:"card",category:"general",entries:"5"}})}])}); |
{ | ||
"name": "scrivito-news-reader", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "A React component/Scrivito widget which shows how to work with external REST-APIs.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10429