Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-facebook-auth

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-facebook-auth - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

293

dist/react-facebook-auth.js

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

root["ReactFacebookAuth"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_3__) {
})(window, function(__WEBPACK_EXTERNAL_MODULE_react__) {
return /******/ (function(modules) { // webpackBootstrap

@@ -47,5 +47,2 @@ /******/ // The module cache

/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports

@@ -62,2 +59,7 @@ /******/ __webpack_require__.d = function(exports, name, getter) {

/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules

@@ -78,274 +80,57 @@ /******/ __webpack_require__.n = function(module) {

/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ return __webpack_require__(__webpack_require__.s = "./src/index.js");
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/******/ ({
/***/ "./src/facebook-auth.js":
/*!******************************!*\
!*** ./src/facebook-auth.js ***!
\******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _react = __webpack_require__(/*! react */ \"react\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _utils = __webpack_require__(/*! ./utils */ \"./src/utils.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar FacebookAuth = function (_React$Component) {\n _inherits(FacebookAuth, _React$Component);\n\n function FacebookAuth() {\n var _ref;\n\n var _temp, _this, _ret;\n\n _classCallCheck(this, FacebookAuth);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = FacebookAuth.__proto__ || Object.getPrototypeOf(FacebookAuth)).call.apply(_ref, [this].concat(args))), _this), _this.responseApi = function (authResponse) {\n window.FB.api('/me', { locale: _this.props.language, fields: _this.props.fields }, function (me) {\n _this.props.callback(_extends({}, me, authResponse));\n });\n }, _this.checkLoginState = function (response) {\n if (response.authResponse) {\n _this.responseApi(response.authResponse);\n return;\n }\n if (_this.props.onFailure) {\n _this.props.onFailure({ status: response.status });\n } else {\n _this.props.callback({ status: response.status });\n }\n }, _this.checkLoginAfterRefresh = function (response) {\n if (response.status === 'unknown') {\n window.FB.login(function (loginResponse) {\n return _this.checkLoginState(loginResponse);\n }, true);\n } else {\n _this.checkLoginState(response);\n }\n }, _this.click = function (e) {\n var _this$props = _this.props,\n scope = _this$props.scope,\n returnScopes = _this$props.returnScopes,\n appId = _this$props.appId,\n onClick = _this$props.onClick,\n reAuthenticate = _this$props.reAuthenticate,\n reRequest = _this$props.reRequest,\n redirectUri = _this$props.redirectUri,\n disableRedirect = _this$props.disableRedirect,\n isMobile = _this$props.isMobile;\n\n\n if (typeof onClick === 'function') {\n onClick(e);\n if (e.defaultPrevented) {\n return;\n }\n }\n\n var params = {\n client_id: appId,\n redirect_uri: redirectUri,\n state: 'facebookdirect',\n return_scopes: returnScopes,\n scope: scope\n };\n\n if (reAuthenticate) {\n params.auth_type = 'reauthenticate';\n }\n\n if (reRequest) {\n params.auth_type = 'rerequest';\n }\n\n if (isMobile && !disableRedirect) {\n window.location.href = '//www.facebook.com/dialog/oauth?' + (0, _utils.toQueryString)(params);\n } else {\n window.FB.login(_this.checkLoginState, {\n scope: scope,\n return_scopes: returnScopes,\n auth_type: params.auth_type\n });\n }\n }, _temp), _possibleConstructorReturn(_this, _ret);\n }\n\n _createClass(FacebookAuth, [{\n key: 'componentDidMount',\n value: function componentDidMount() {\n if (document.getElementById('facebook-jssdk')) {\n return;\n }\n\n this.setfbAsyncInit();\n this.loadSdkAsynchronously();\n\n var rootElem = document.getElementById('fb-root');\n if (!rootElem) {\n rootElem = document.createElement('div');\n rootElem.id = 'fb-root';\n document.body.appendChild(rootElem);\n }\n }\n }, {\n key: 'setfbAsyncInit',\n value: function setfbAsyncInit() {\n var _this2 = this;\n\n var _props = this.props,\n appId = _props.appId,\n xfbml = _props.xfbml,\n cookie = _props.cookie,\n version = _props.version,\n autoLoad = _props.autoLoad;\n\n window.fbAsyncInit = function () {\n window.FB.init({\n version: 'v' + version,\n appId: appId,\n xfbml: xfbml,\n cookie: cookie\n });\n\n if (autoLoad || window.location.search.indexOf('facebookdirect') !== -1) {\n window.FB.getLoginStatus(_this2.checkLoginAfterRefresh);\n }\n };\n }\n }, {\n key: 'loadSdkAsynchronously',\n value: function loadSdkAsynchronously() {\n var language = this.props.language;\n (function (d, s, id) {\n var fjs = d.getElementsByTagName(s)[0];\n if (d.getElementById(id)) {\n return;\n }\n var js = d.createElement(s);\n js.id = id;\n js.src = 'https://connect.facebook.net/' + language + '/sdk.js';\n fjs.parentNode.insertBefore(js, fjs);\n })(document, 'script', 'facebook-jssdk');\n }\n }, {\n key: 'render',\n value: function render() {\n var Component = this.props.component;\n\n return _react2.default.createElement(Component, _extends({ onClick: this.click }, this.props.customProps));\n }\n }]);\n\n return FacebookAuth;\n}(_react2.default.Component);\n\nFacebookAuth.defaultProps = {\n redirectUri: typeof window !== 'undefined' ? window.location.href : '/',\n scope: 'public_profile,email',\n onFailure: undefined,\n returnScopes: false,\n xfbml: false,\n cookie: false,\n isMobile: (0, _utils.isMobile)(),\n reAuthenticate: false,\n reRequest: false,\n fields: 'name,email,picture',\n version: '2.8',\n language: 'en_US',\n autoLoad: false,\n disableRedirect: false,\n customProps: {}\n};\nexports.default = FacebookAuth;\nmodule.exports = exports['default'];\n\n//# sourceURL=webpack://ReactFacebookAuth/./src/facebook-auth.js?");
/***/ }),
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(3);
var _react2 = _interopRequireDefault(_react);
var _utils = __webpack_require__(2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var FacebookAuth = function (_React$Component) {
_inherits(FacebookAuth, _React$Component);
function FacebookAuth() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, FacebookAuth);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = FacebookAuth.__proto__ || Object.getPrototypeOf(FacebookAuth)).call.apply(_ref, [this].concat(args))), _this), _this.responseApi = function (authResponse) {
window.FB.api('/me', { locale: _this.props.language, fields: _this.props.fields }, function (me) {
_this.props.callback(_extends({}, me, authResponse));
});
}, _this.checkLoginState = function (response) {
if (response.authResponse) {
_this.responseApi(response.authResponse);
return;
}
if (_this.props.onFailure) {
_this.props.onFailure({ status: response.status });
} else {
_this.props.callback({ status: response.status });
}
}, _this.checkLoginAfterRefresh = function (response) {
if (response.status === 'unknown') {
window.FB.login(function (loginResponse) {
return _this.checkLoginState(loginResponse);
}, true);
} else {
_this.checkLoginState(response);
}
}, _this.click = function (e) {
var _this$props = _this.props,
scope = _this$props.scope,
returnScopes = _this$props.returnScopes,
appId = _this$props.appId,
onClick = _this$props.onClick,
reAuthenticate = _this$props.reAuthenticate,
reRequest = _this$props.reRequest,
redirectUri = _this$props.redirectUri,
disableRedirect = _this$props.disableRedirect,
isMobile = _this$props.isMobile;
if (typeof onClick === 'function') {
onClick(e);
if (e.defaultPrevented) {
return;
}
}
var params = {
client_id: appId,
redirect_uri: redirectUri,
state: 'facebookdirect',
return_scopes: returnScopes,
scope: scope
};
if (reAuthenticate) {
params.auth_type = 'reauthenticate';
}
if (reRequest) {
params.auth_type = 'rerequest';
}
if (isMobile && !disableRedirect) {
window.location.href = '//www.facebook.com/dialog/oauth?' + (0, _utils.toQueryString)(params);
} else {
window.FB.login(_this.checkLoginState, {
scope: scope,
return_scopes: returnScopes,
auth_type: params.auth_type
});
}
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(FacebookAuth, [{
key: 'componentDidMount',
value: function componentDidMount() {
if (document.getElementById('facebook-jssdk')) {
return;
}
this.setfbAsyncInit();
this.loadSdkAsynchronously();
var rootElem = document.getElementById('fb-root');
if (!rootElem) {
rootElem = document.createElement('div');
rootElem.id = 'fb-root';
document.body.appendChild(rootElem);
}
}
}, {
key: 'setfbAsyncInit',
value: function setfbAsyncInit() {
var _this2 = this;
var _props = this.props,
appId = _props.appId,
xfbml = _props.xfbml,
cookie = _props.cookie,
version = _props.version,
autoLoad = _props.autoLoad;
window.fbAsyncInit = function () {
window.FB.init({
version: 'v' + version,
appId: appId,
xfbml: xfbml,
cookie: cookie
});
if (autoLoad || window.location.search.indexOf('facebookdirect') !== -1) {
window.FB.getLoginStatus(_this2.checkLoginAfterRefresh);
}
};
}
}, {
key: 'loadSdkAsynchronously',
value: function loadSdkAsynchronously() {
var language = this.props.language;
(function (d, s, id) {
var fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
return;
}
var js = d.createElement(s);
js.id = id;
js.src = 'https://connect.facebook.net/' + language + '/sdk.js';
fjs.parentNode.insertBefore(js, fjs);
})(document, 'script', 'facebook-jssdk');
}
}, {
key: 'render',
value: function render() {
var Component = this.props.component;
return _react2.default.createElement(Component, _extends({ onClick: this.click }, this.props.customProps));
}
}]);
return FacebookAuth;
}(_react2.default.Component);
FacebookAuth.defaultProps = {
redirectUri: typeof window !== 'undefined' ? window.location.href : '/',
scope: 'public_profile,email',
onFailure: undefined,
returnScopes: false,
xfbml: false,
cookie: false,
isMobile: (0, _utils.isMobile)(),
reAuthenticate: false,
reRequest: false,
fields: 'name,email,picture',
version: '2.8',
language: 'en_US',
autoLoad: false,
disableRedirect: false,
customProps: {}
};
exports.default = FacebookAuth;
module.exports = exports['default'];
/***/ }),
/* 1 */
/***/ "./src/index.js":
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = undefined;\n\nvar _facebookAuth = __webpack_require__(/*! ./facebook-auth */ \"./src/facebook-auth.js\");\n\nvar _facebookAuth2 = _interopRequireDefault(_facebookAuth);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _facebookAuth2.default;\nmodule.exports = exports['default'];\n\n//# sourceURL=webpack://ReactFacebookAuth/./src/index.js?");
/***/ }),
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _facebookAuth = __webpack_require__(0);
var _facebookAuth2 = _interopRequireDefault(_facebookAuth);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _facebookAuth2.default;
module.exports = exports['default'];
/***/ }),
/* 2 */
/***/ "./src/utils.js":
/*!**********************!*\
!*** ./src/utils.js ***!
\**********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.toQueryString = toQueryString;\nexports.isMobile = isMobile;\n/**\n * Encode object to url parameters\n *\n * @param object\n * @return {string}\n */\nfunction toQueryString(object) {\n return Object.keys(object).map(function (key) {\n return key + '=' + encodeURIComponent(object[key]);\n }).join('&');\n}\n\n/**\n * Check if device is mobile\n *\n * @return {boolean}\n */\nfunction isMobile() {\n try {\n return !!(window.navigator && window.navigator.standalone || navigator.userAgent.match('CriOS') || navigator.userAgent.match(/mobile/i));\n } catch (ex) {\n return false;\n }\n}\n\n//# sourceURL=webpack://ReactFacebookAuth/./src/utils.js?");
/***/ }),
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.toQueryString = toQueryString;
exports.isMobile = isMobile;
/**
* Encode object to url parameters
*
* @param object
* @return {string}
*/
function toQueryString(object) {
return Object.keys(object).map(function (key) {
return key + '=' + encodeURIComponent(object[key]);
}).join('&');
}
/**
* Check if device is mobile
*
* @return {boolean}
*/
function isMobile() {
try {
return !!(window.navigator && window.navigator.standalone || navigator.userAgent.match('CriOS') || navigator.userAgent.match(/mobile/i));
} catch (ex) {
return false;
}
}
/***/ }),
/* 3 */
/***/ "react":
/*!**************************************************************************************!*\
!*** external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"} ***!
\**************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
eval("module.exports = __WEBPACK_EXTERNAL_MODULE_react__;\n\n//# sourceURL=webpack://ReactFacebookAuth/external_%7B%22root%22:%22React%22,%22commonjs2%22:%22react%22,%22commonjs%22:%22react%22,%22amd%22:%22react%22%7D?");
/***/ })
/******/ ]);
/******/ });
});

2

dist/react-facebook-auth.min.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("ReactFacebookAuth",["react"],t):"object"==typeof exports?exports.ReactFacebookAuth=t(require("react")):e.ReactFacebookAuth=t(e.React)}(this,function(e){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var o={};return t.m=e,t.c=o,t.i=function(e){return e},t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,o){"use strict";function n(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 c=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},u=function(){function e(e,t){for(var o=0;t.length>o;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}}(),a=o(3),s=function(e){return e&&e.__esModule?e:{default:e}}(a),f=o(2),l=function(e){function t(){var e,o,i,u;n(this,t);for(var a=arguments.length,s=Array(a),l=0;a>l;l++)s[l]=arguments[l];return o=i=r(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),i.responseApi=function(e){window.FB.api("/me",{locale:i.props.language,fields:i.props.fields},function(t){i.props.callback(c({},t,e))})},i.checkLoginState=function(e){if(e.authResponse)return void i.responseApi(e.authResponse);i.props.onFailure?i.props.onFailure({status:e.status}):i.props.callback({status:e.status})},i.checkLoginAfterRefresh=function(e){"unknown"===e.status?window.FB.login(function(e){return i.checkLoginState(e)},!0):i.checkLoginState(e)},i.click=function(e){var t=i.props,o=t.scope,n=t.returnScopes,r=t.appId,c=t.onClick,u=t.reAuthenticate,a=t.reRequest,s=t.redirectUri,l=t.disableRedirect,p=t.isMobile;if("function"!=typeof c||(c(e),!e.defaultPrevented)){var d={client_id:r,redirect_uri:s,state:"facebookdirect",return_scopes:n,scope:o};u&&(d.auth_type="reauthenticate"),a&&(d.auth_type="rerequest"),p&&!l?window.location.href="//www.facebook.com/dialog/oauth?"+(0,f.toQueryString)(d):window.FB.login(i.checkLoginState,{scope:o,return_scopes:n,auth_type:d.auth_type})}},u=o,r(i,u)}return i(t,e),u(t,[{key:"componentDidMount",value:function(){if(!document.getElementById("facebook-jssdk")){this.setfbAsyncInit(),this.loadSdkAsynchronously();var e=document.getElementById("fb-root");e||(e=document.createElement("div"),e.id="fb-root",document.body.appendChild(e))}}},{key:"setfbAsyncInit",value:function(){var e=this,t=this.props,o=t.appId,n=t.xfbml,r=t.cookie,i=t.version,c=t.autoLoad;window.fbAsyncInit=function(){window.FB.init({version:"v"+i,appId:o,xfbml:n,cookie:r}),(c||-1!==window.location.search.indexOf("facebookdirect"))&&window.FB.getLoginStatus(e.checkLoginAfterRefresh)}}},{key:"loadSdkAsynchronously",value:function(){var e=this.props.language;!function(t,o,n){var r=t.getElementsByTagName(o)[0];if(!t.getElementById(n)){var i=t.createElement(o);i.id=n,i.src="https://connect.facebook.net/"+e+"/sdk.js",r.parentNode.insertBefore(i,r)}}(document,"script","facebook-jssdk")}},{key:"render",value:function(){return s.default.createElement(this.props.component,c({onClick:this.click},this.props.customProps))}}]),t}(s.default.Component);l.defaultProps={redirectUri:"undefined"!=typeof window?window.location.href:"/",scope:"public_profile,email",onFailure:void 0,returnScopes:!1,xfbml:!1,cookie:!1,isMobile:(0,f.isMobile)(),reAuthenticate:!1,reRequest:!1,fields:"name,email,picture",version:"2.8",language:"en_US",autoLoad:!1,disableRedirect:!1,customProps:{}},t.default=l,e.exports=t.default},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=o(0);t.default=function(e){return e&&e.__esModule?e:{default:e}}(n).default,e.exports=t.default},function(e,t,o){"use strict";function n(e){return Object.keys(e).map(function(t){return t+"="+encodeURIComponent(e[t])}).join("&")}function r(){try{return!!(window.navigator&&window.navigator.standalone||navigator.userAgent.match("CriOS")||navigator.userAgent.match(/mobile/i))}catch(e){return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.toQueryString=n,t.isMobile=r},function(t,o){t.exports=e}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("ReactFacebookAuth",["react"],t):"object"==typeof exports?exports.ReactFacebookAuth=t(require("react")):e.ReactFacebookAuth=t(e.React)}(window,function(e){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},o.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=3)}([function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toQueryString=function(e){return Object.keys(e).map(function(t){return t+"="+encodeURIComponent(e[t])}).join("&")},t.isMobile=function(){try{return!!(window.navigator&&window.navigator.standalone||navigator.userAgent.match("CriOS")||navigator.userAgent.match(/mobile/i))}catch(e){return!1}}},function(t,o){t.exports=e},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},i=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}}(),c=o(1),a=(n=c)&&n.__esModule?n:{default:n},u=o(0);function s(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}var f=function(e){function t(){var e,o,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,c=Array(i),a=0;a<i;a++)c[a]=arguments[a];return o=n=s(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),n.responseApi=function(e){window.FB.api("/me",{locale:n.props.language,fields:n.props.fields},function(t){n.props.callback(r({},t,e))})},n.checkLoginState=function(e){e.authResponse?n.responseApi(e.authResponse):n.props.onFailure?n.props.onFailure({status:e.status}):n.props.callback({status:e.status})},n.checkLoginAfterRefresh=function(e){"unknown"===e.status?window.FB.login(function(e){return n.checkLoginState(e)},!0):n.checkLoginState(e)},n.click=function(e){var t=n.props,o=t.scope,r=t.returnScopes,i=t.appId,c=t.onClick,a=t.reAuthenticate,s=t.reRequest,f=t.redirectUri,l=t.disableRedirect,p=t.isMobile;if("function"!=typeof c||(c(e),!e.defaultPrevented)){var d={client_id:i,redirect_uri:f,state:"facebookdirect",return_scopes:r,scope:o};a&&(d.auth_type="reauthenticate"),s&&(d.auth_type="rerequest"),p&&!l?window.location.href="//www.facebook.com/dialog/oauth?"+(0,u.toQueryString)(d):window.FB.login(n.checkLoginState,{scope:o,return_scopes:r,auth_type:d.auth_type})}},s(n,o)}return function(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)}(t,a.default.Component),i(t,[{key:"componentDidMount",value:function(){if(!document.getElementById("facebook-jssdk")){this.setfbAsyncInit(),this.loadSdkAsynchronously();var e=document.getElementById("fb-root");e||((e=document.createElement("div")).id="fb-root",document.body.appendChild(e))}}},{key:"setfbAsyncInit",value:function(){var e=this,t=this.props,o=t.appId,n=t.xfbml,r=t.cookie,i=t.version,c=t.autoLoad;window.fbAsyncInit=function(){window.FB.init({version:"v"+i,appId:o,xfbml:n,cookie:r}),(c||-1!==window.location.search.indexOf("facebookdirect"))&&window.FB.getLoginStatus(e.checkLoginAfterRefresh)}}},{key:"loadSdkAsynchronously",value:function(){var e=this.props.language;!function(t,o,n){var r=t.getElementsByTagName(o)[0];if(!t.getElementById(n)){var i=t.createElement(o);i.id=n,i.src="https://connect.facebook.net/"+e+"/sdk.js",r.parentNode.insertBefore(i,r)}}(document,"script","facebook-jssdk")}},{key:"render",value:function(){var e=this.props.component;return a.default.createElement(e,r({onClick:this.click},this.props.customProps))}}]),t}();f.defaultProps={redirectUri:"undefined"!=typeof window?window.location.href:"/",scope:"public_profile,email",onFailure:void 0,returnScopes:!1,xfbml:!1,cookie:!1,isMobile:(0,u.isMobile)(),reAuthenticate:!1,reRequest:!1,fields:"name,email,picture",version:"2.8",language:"en_US",autoLoad:!1,disableRedirect:!1,customProps:{}},t.default=f,e.exports=t.default},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,r=o(2),i=(n=r)&&n.__esModule?n:{default:n};t.default=i.default,e.exports=t.default}])});

@@ -13,16 +13,18 @@ {

"scripts": {
"start": "webpack-dev-server --colors --content-base ./public --hot --inline"
"start": "webpack-dev-server --mode development --colors --content-base ./public --hot --inline",
"prettier": "prettier --write --semi --single-quote --trailing-comma=all 'src/**/*.{js,jsx,json,css}'"
},
"dependencies": {
"react": "^15.5.4",
"react-dom": "^15.5.4"
"react": "^16.2.0",
"react-dom": "^16.2.0"
},
"devDependencies": {
"babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.3",
"babel-preset-stage-1": "^6.24.1",
"html-webpack-plugin": "^2.28.0",
"webpack": "^2.6.1",
"webpack-dev-server": "^2.4.5"
"html-webpack-plugin": "webpack-contrib/html-webpack-plugin",
"prettier": "^1.10.2",
"webpack": "^4.0.0",
"webpack-dev-server": "^3.0.0"
}
}

@@ -24,3 +24,3 @@ import React from 'react';

const authenticate = (response) => {
const authenticate = response => {
console.log(response);

@@ -41,5 +41,2 @@ };

ReactDOM.render(
<App />,
document.getElementById('root'),
);
ReactDOM.render(<App />, document.getElementById('root'));

@@ -21,3 +21,3 @@ const path = require('path');

module: {
loaders: [
rules: [
{

@@ -27,3 +27,5 @@ test: /\.js$/,

include: [__dirname, libSrc],
loader: 'babel-loader',
use: {
loader: 'babel-loader',
},
},

@@ -30,0 +32,0 @@ ],

{
"name": "react-facebook-auth",
"version": "1.3.0",
"version": "1.4.0",
"description": "A Component React for Facebook authentication",

@@ -32,4 +32,4 @@ "author": "Ionut Milica <ionut.milica@gmail.com>",

"build:es": "cross-env BABEL_ENV=es babel src --out-dir es --ignore __tests__",
"build:umd": "cross-env NODE_ENV=development webpack src/index.js dist/react-facebook-auth.js --config config/webpack.dev.js",
"build:umd:min": "cross-env NODE_ENV=production webpack src/index.js dist/react-facebook-auth.min.js --config config/webpack.prod.js",
"build:umd": "cross-env NODE_ENV=development webpack src/index.js --output dist/react-facebook-auth.js --mode development --config config/webpack.config.js",
"build:umd:min": "cross-env NODE_ENV=production webpack src/index.js --output dist/react-facebook-auth.min.js --mode production --config config/webpack.config.js",
"lint": "eslint src",

@@ -40,23 +40,23 @@ "test": "cross-env NODE_ENV=test jest --config config/jest.config.js",

"test:watch": "npm run test -- --watch --bail",
"prettier": "prettier --write --semi --single-quote --trailing-comma=all 'src/**/*.js'",
"clean": "rimraf dist lib es"
"prettier": "prettier --write --semi --single-quote --trailing-comma=all 'src/**/*.{js,jsx,json,css}'",
"clean": "rimraf dist lib es coverage"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^7.2.3",
"babel-jest": "^20.0.3",
"babel-loader": "^7.0.0",
"babel-jest": "^22.4.1",
"babel-loader": "^7.1.3",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.5",
"babel-preset-env": "^1.5.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.13",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-1": "^6.24.1",
"babel-register": "^6.24.1",
"codecov": "^2.2.0",
"cross-env": "^5.0.0",
"babel-register": "^6.26.0",
"codecov": "^3.0.0",
"cross-env": "^5.1.3",
"eslint": "^4.1.1",
"eslint-config-react-app": "^2.0.1",
"eslint-config-react-app": "^2.1.0",
"eslint-plugin-flowtype": "^2.34.1",

@@ -66,8 +66,9 @@ "eslint-plugin-import": "^2.6.0",

"eslint-plugin-react": "^7.1.0",
"jest": "^20.0.4",
"prettier": "^1.9.2",
"rimraf": "^2.6.1",
"webpack": "^2.6.1",
"webpack-dev-server": "^2.4.5",
"webpack-merge": "^4.1.0"
"jest": "^22.4.2",
"prettier": "^1.10.2",
"rimraf": "^2.6.2",
"webpack": "^4.0.0",
"webpack-cli": "^2.0.9",
"webpack-dev-server": "^3.0.0",
"webpack-merge": "^4.1.2"
},

@@ -74,0 +75,0 @@ "dependencies": {

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc