Socket
Socket
Sign inDemoInstall

use-facebook-auth

Package Overview
Dependencies
3
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.5 to 0.0.6

4

dist/index.d.ts
import React, { ReactNode } from 'react';
import { FacebookSDKInitParams } from './utils/facebook.client';
import { AuthResponse } from './utils/facebook.window';
import { AuthResponse, LoginOptions } from './utils/facebook.window';
interface FacebookContextOptions {

@@ -11,3 +11,3 @@ authenticatedState: AuthenticatedStatus;

logout(): void;
login(): void;
login(options: LoginOptions): void;
}

@@ -14,0 +14,0 @@ declare enum AuthenticatedStatus {

@@ -46,2 +46,20 @@ 'use strict';

function _extends() {
_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;
};
return _extends.apply(this, arguments);
}
function createCommonjsModule(fn, module) {

@@ -836,3 +854,3 @@ return module = { exports: {} }, fn(module, module.exports), module.exports;

}
function login() {
function login(_x) {
return _login.apply(this, arguments);

@@ -842,3 +860,3 @@ }

function _login() {
_login = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
_login = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(options) {
var authResponse;

@@ -853,3 +871,3 @@ return runtime_1.wrap(function _callee$(_context) {

return resolve(response);
});
}, _extends({}, options));
});

@@ -1021,3 +1039,3 @@

login: function () {
var _login2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
var _login2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(options) {
var response;

@@ -1029,3 +1047,3 @@ return runtime_1.wrap(function _callee3$(_context3) {

_context3.next = 2;
return login();
return login(options);

@@ -1044,3 +1062,3 @@ case 2:

function login$1() {
function login$1(_x) {
return _login2.apply(this, arguments);

@@ -1047,0 +1065,0 @@ }

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("react"),r=(t=e)&&"object"==typeof t&&"default"in t?t.default:t;function n(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function u(t){n(a,o,i,u,c,"next",t)}function c(t){n(a,o,i,u,c,"throw",t)}u(void 0)}))}}var i,a,u=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new L(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=x(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function l(){}function p(){}var d={};d[o]=function(){return this};var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&r.call(y,o)&&(d=y);var g=p.prototype=h.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(h).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function k(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:N}}function N(){return{value:void 0,done:!0}}return l.prototype=g.constructor=p,p.constructor=l,l.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),w.prototype[i]=function(){return this},t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),u(g,a,"Generator"),g[o]=function(){return this},g.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),b(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;b(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}(a={exports:{}}),a.exports);function c(t){return new Promise((function(e){window.fbAsyncInit=function(){window.FB.init({appId:t.appId,cookie:!0,xfbml:!0,version:t.version?t.version:"v8.0"}),window.FB.getLoginStatus((function(t){e(t||void 0)}))},function(e,r,n){var o=e.getElementsByTagName(r)[0];if(!e.getElementById(n)){var i=e.createElement(r);i.id=n,i.src="https://connect.facebook.net/"+(t.language||"en_US")+"/sdk.js",o&&o.parentNode&&o.parentNode.insertBefore(i,o)}}(document,"script","facebook-jssdk")}))}function s(){return f.apply(this,arguments)}function f(){return(f=o(u.mark((function t(){var e;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t){return window.FB.login((function(e){return t(e)}))}));case 2:if(e=t.sent){t.next=5;break}return t.abrupt("return",void 0);case 5:return t.abrupt("return",e);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(){return l.apply(this,arguments)}function l(){return(l=o(u.mark((function t(){return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,window.FB.api("/me/permissions","delete");case 2:return t.next=4,new Promise((function(t){return window.FB.logout((function(e){return t(e)}))}));case 4:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}!function(t){t.LOADING="loading",t.ERROR="error",t.AUTHENTICATED="authenticated",t.UNAUTHENTICATED="unauthenticated"}(i||(i={}));var p=r.createContext({authenticatedState:i.LOADING,isAuthenticated:!1,loading:!0,user:{},logout:function(){},login:function(){}}),d=function(t){var n,a,f=t.children,l=t.options,d=e.useState({authStatus:i.LOADING}),v=d[0],y=d[1],g=function(t){var e=t&&"connected"===t.status?t.authResponse:void 0;y({authStatus:e?i.AUTHENTICATED:i.UNAUTHENTICATED,authRequestStatus:null==t?void 0:t.status,authResponse:e})};return e.useEffect((function(){!function(){var t=o(u.mark((function t(){return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c(l);case 2:g(t.sent);case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()()}),[]),r.createElement(p.Provider,{value:{authenticatedSession:v.authResponse,authenticatedState:v.authStatus,isAuthenticated:v.authStatus===i.AUTHENTICATED,loading:v.authStatus===i.LOADING,user:{},logout:(a=o(u.mark((function t(){return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,h();case 2:g(t.sent);case 4:case"end":return t.stop()}}),t)}))),function(){return a.apply(this,arguments)}),login:(n=o(u.mark((function t(){return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s();case 2:g(t.sent);case 4:case"end":return t.stop()}}),t)}))),function(){return n.apply(this,arguments)})}},f)};exports.FacebookContext=p,exports.FacebookProvider=d,exports.default=d,exports.useFacebook=function(){return e.useContext(p)};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("react"),r=(t=e)&&"object"==typeof t&&"default"in t?t.default:t;function n(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function u(t){n(a,o,i,u,c,"next",t)}function c(t){n(a,o,i,u,c,"throw",t)}u(void 0)}))}}function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}var a,u,c=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new L(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=x(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function l(){}function p(){}var d={};d[o]=function(){return this};var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&r.call(y,o)&&(d=y);var g=p.prototype=h.prototype=Object.create(d);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(h).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function k(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:N}}function N(){return{value:void 0,done:!0}}return l.prototype=g.constructor=p,p.constructor=l,l.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},w(m.prototype),m.prototype[i]=function(){return this},t.AsyncIterator=m,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new m(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(g),u(g,a,"Generator"),g[o]=function(){return this},g.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),b(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;b(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}(u={exports:{}}),u.exports);function s(t){return new Promise((function(e){window.fbAsyncInit=function(){window.FB.init({appId:t.appId,cookie:!0,xfbml:!0,version:t.version?t.version:"v8.0"}),window.FB.getLoginStatus((function(t){e(t||void 0)}))},function(e,r,n){var o=e.getElementsByTagName(r)[0];if(!e.getElementById(n)){var i=e.createElement(r);i.id=n,i.src="https://connect.facebook.net/"+(t.language||"en_US")+"/sdk.js",o&&o.parentNode&&o.parentNode.insertBefore(i,o)}}(document,"script","facebook-jssdk")}))}function f(t){return h.apply(this,arguments)}function h(){return(h=o(c.mark((function t(e){var r;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t){return window.FB.login((function(e){return t(e)}),i({},e))}));case 2:if(r=t.sent){t.next=5;break}return t.abrupt("return",void 0);case 5:return t.abrupt("return",r);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function l(){return p.apply(this,arguments)}function p(){return(p=o(c.mark((function t(){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,window.FB.api("/me/permissions","delete");case 2:return t.next=4,new Promise((function(t){return window.FB.logout((function(e){return t(e)}))}));case 4:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}!function(t){t.LOADING="loading",t.ERROR="error",t.AUTHENTICATED="authenticated",t.UNAUTHENTICATED="unauthenticated"}(a||(a={}));var d=r.createContext({authenticatedState:a.LOADING,isAuthenticated:!1,loading:!0,user:{},logout:function(){},login:function(){}}),v=function(t){var n,i,u=t.children,h=t.options,p=e.useState({authStatus:a.LOADING}),v=p[0],y=p[1],g=function(t){var e=t&&"connected"===t.status?t.authResponse:void 0;y({authStatus:e?a.AUTHENTICATED:a.UNAUTHENTICATED,authRequestStatus:null==t?void 0:t.status,authResponse:e})};return e.useEffect((function(){!function(){var t=o(c.mark((function t(){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s(h);case 2:g(t.sent);case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()()}),[]),r.createElement(d.Provider,{value:{authenticatedSession:v.authResponse,authenticatedState:v.authStatus,isAuthenticated:v.authStatus===a.AUTHENTICATED,loading:v.authStatus===a.LOADING,user:{},logout:(i=o(c.mark((function t(){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,l();case 2:g(t.sent);case 4:case"end":return t.stop()}}),t)}))),function(){return i.apply(this,arguments)}),login:(n=o(c.mark((function t(e){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,f(e);case 2:g(t.sent);case 4:case"end":return t.stop()}}),t)}))),function(t){return n.apply(this,arguments)})}},u)};exports.FacebookContext=d,exports.FacebookProvider=v,exports.default=v,exports.useFacebook=function(){return e.useContext(d)};
//# sourceMappingURL=use-facebook-auth.cjs.production.min.js.map

@@ -39,2 +39,20 @@ import React, { useContext, useState, useEffect } from 'react';

function _extends() {
_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;
};
return _extends.apply(this, arguments);
}
function createCommonjsModule(fn, module) {

@@ -829,3 +847,3 @@ return module = { exports: {} }, fn(module, module.exports), module.exports;

}
function login() {
function login(_x) {
return _login.apply(this, arguments);

@@ -835,3 +853,3 @@ }

function _login() {
_login = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
_login = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(options) {
var authResponse;

@@ -846,3 +864,3 @@ return runtime_1.wrap(function _callee$(_context) {

return resolve(response);
});
}, _extends({}, options));
});

@@ -1014,3 +1032,3 @@

login: function () {
var _login2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
var _login2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(options) {
var response;

@@ -1022,3 +1040,3 @@ return runtime_1.wrap(function _callee3$(_context3) {

_context3.next = 2;
return login();
return login(options);

@@ -1037,3 +1055,3 @@ case 2:

function login$1() {
function login$1(_x) {
return _login2.apply(this, arguments);

@@ -1040,0 +1058,0 @@ }

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

import { StatusResponse } from './facebook.window';
import { LoginOptions, StatusResponse } from './facebook.window';
export interface FacebookSDKInitParams {

@@ -8,3 +8,3 @@ appId: string;

export declare function initFacebookSdk(params: FacebookSDKInitParams): Promise<StatusResponse | undefined>;
export declare function login(): Promise<StatusResponse | undefined>;
export declare function login(options: LoginOptions): Promise<StatusResponse | undefined>;
export declare function logout(): Promise<StatusResponse | undefined>;

@@ -24,3 +24,3 @@ export declare type LoginStatus = 'authorization_expired' | 'connected' | 'not_authorized' | 'unknown';

}
interface LoginOptions {
export interface LoginOptions {
auth_type?: 'reauthenticate' | 'reauthorize' | 'rerequest';

@@ -27,0 +27,0 @@ scope?: string;

{
"name": "use-facebook-auth",
"version": "0.0.5",
"version": "0.0.6",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public",

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

# useFacebookAuth
# use-facebook-auth

@@ -43,2 +43,5 @@ A React based hook for facebook authentication.

const loginOptions = {
scope: 'public_profile,email'
}

@@ -59,3 +62,3 @@ const MyMethod = () => {

logout(): void,
login(): void
login(loginOptions): void
} = useFacebook();

@@ -62,0 +65,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc