redux-oauth
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -1,1 +0,1 @@ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("redux-immutablejs"),require("immutable"),require("lodash/keys"),require("lodash/assign"),require("js-cookie"),require("isomorphic-fetch"),require("lodash/isArray"),require("lodash/omit"),require("querystring"),require("url"));else if("function"==typeof define&&define.amd)define(["redux-immutablejs","immutable","lodash/keys","lodash/assign","js-cookie","isomorphic-fetch","lodash/isArray","lodash/omit","querystring","url"],t);else{var r="object"==typeof exports?t(require("redux-immutablejs"),require("immutable"),require("lodash/keys"),require("lodash/assign"),require("js-cookie"),require("isomorphic-fetch"),require("lodash/isArray"),require("lodash/omit"),require("querystring"),require("url")):t(e["redux-immutablejs"],e.immutable,e["lodash/keys"],e["lodash/assign"],e["js-cookie"],e["isomorphic-fetch"],e["lodash/isArray"],e["lodash/omit"],e.querystring,e.url);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,function(e,t,r,n,u,o,i,a,c,s){return function(e){function t(n){if(r[n])return r[n].exports;var u=r[n]={exports:{},id:n,loaded:!1};return e[n].call(u.exports,u,u.exports,t),u.loaded=!0,u.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(20)},function(e,t){"use strict";function r(e){return{backend:n(e),cookieOptions:u(e),tokenFormat:o(e)}}function n(e){var t=""+e.auth.getIn(["config","backend","apiUrl"]),r={};return e.auth.getIn(["config","backend","authProviderPaths"]).forEach(function(e,n){return r[n]=""+t+e}),{tokenValidationPath:""+t+e.auth.getIn(["config","backend","tokenValidationPath"]),signOutPath:""+t+e.auth.getIn(["config","backend","signOutPath"]),authProviderPaths:r,apiUrl:t}}function u(e){return{key:e.auth.getIn(["config","cookieOptions","key"]),expire:e.auth.getIn(["config","cookieOptions","expire"]),path:e.auth.getIn(["config","cookieOptions","path"])}}function o(e){var t={};return e.auth.getIn(["config","tokenFormat"]).forEach(function(e,r){return t[r]=e}),t}Object.defineProperty(t,"__esModule",{value:!0}),t.getSettings=r},function(e,t){e.exports=require("redux-immutablejs")},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return function(t,r){var n=(0,a.getSettings)(r()),u=n.cookieOptions;return i["default"].set(u.key,e,{expires:u.expires,path:u.path}),t({type:c,headers:e})}}Object.defineProperty(t,"__esModule",{value:!0}),t.UPDATE_HEADERS=void 0,t.updateHeaders=u;var o=r(16),i=n(o),a=r(1),c=t.UPDATE_HEADERS="UPDATE_HEADERS"},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(){return{type:h}}function o(){return{type:p}}function i(e){return{type:T,errors:e}}function a(){return function(e,t){var r=(0,f.getSettings)(t()),n=r.backend;return e(u()),e((0,_.updateHeaders)({})),e((0,s["default"])(n.signOutPath,{method:"delete"})).then(l["default"]).then(function(){return e(o()),Promise.resolve()})["catch"](function(t){return e(i(t)),Promise.reject(t)})}}Object.defineProperty(t,"__esModule",{value:!0}),t.SIGN_OUT_ERROR=t.SIGN_OUT_COMPLETE=t.SIGN_OUT=void 0,t.signOut=a;var c=r(8),s=n(c),f=r(1),d=r(12),l=n(d),_=r(3),h=t.SIGN_OUT="SIGN_OUT",p=t.SIGN_OUT_COMPLETE="SIGN_OUT_COMPLETE",T=t.SIGN_OUT_ERROR="SIGN_OUT_ERROR"},function(e,t){e.exports=require("immutable")},function(e,t){"use strict";function r(){return{type:o}}function n(e){return{type:i,user:e}}function u(e){return{type:a,errors:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.authenticateStart=r,t.authenticateComplete=n,t.authenticateError=u;var o=t.AUTHENTICATE_START="AUTHENTICATE_START",i=t.AUTHENTICATE_COMPLETE="AUTHENTICATE_COMPLETE",a=t.AUTHENTICATE_ERROR="AUTHENTICATE_ERROR"},function(e,t){e.exports=require("lodash/keys")},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return function(r,n){var u=n(),i=(0,f.getSettings)(u),d=i.tokenFormat,l=i.backend;return e.match(l.apiUrl)?(0,o["default"])(e,(0,a["default"])({},t,{headers:(0,c.prepareHeadersForFetch)((0,c.getHeaders)(u),d)})).then(function(e){var t=(0,c.parseHeaders)(e.headers,d);return r((0,s.updateHeaders)(t)),Promise.resolve(e)})["catch"](function(e){return Promise.reject(e)}):(0,o["default"])(e,t).then(function(e){return Promise.resolve(e)})["catch"](function(e){return Promise.reject(e)})}};var u=r(30),o=n(u),i=r(10),a=n(i),c=r(9),s=r(3),f=r(1)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t){try{var r=e.trim();return r.length>1&&"{"===r[0]&&"}"===r[r.length-1]?r.substr(1,r.length-2).replace(/\{(.*?)}/g,function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];var u=t[r[1].trim()];if(!u)throw"required values missing";return u}):e}catch(n){return null}}function o(e,t){var r=(0,f["default"])({},e,{"If-Modified-Since":"Mon, 26 Jul 1997 05:00:00 GMT"});return(0,l["default"])(t).forEach(function(n){var o=t[n];if(o&&!r[n]){var i=u(o,e);i&&(r[n]=i)}}),r}function i(e){if(!e||void 0===e)return{};var t=(0,v.getSettings)(e),r=t.cookieOptions,n=t.tokenFormat,u=(0,g.getHeaders)(e);if(!c(u,n))return u;try{return JSON.parse(T["default"].get(r.key)||"{}")}catch(o){return{}}}function a(e,t){if(!e)return{};var r={},n=!0;return(0,l["default"])(t).forEach(function(t){void 0===e[t]?e.get&&e.get(t)&&(r[t]=e.get(t)):r[t]=e[t],r[t]&&((0,h["default"])(r[t])&&(r[t]=r[t][0]),n=!1)}),n?{}:r}function c(e,t){if(!e)return!0;for(var r=(0,l["default"])(t),n=0;n<r.length;++n){var u=r[n],o=void 0!==e[u]||e.has&&e.has(u);if(o)return!1}return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.prepareHeadersForFetch=o,t.getHeaders=i,t.parseHeaders=a,t.areHeadersBlank=c;var s=r(10),f=n(s),d=r(7),l=n(d),_=r(31),h=n(_),p=r(16),T=n(p),g=r(21),v=r(1)},function(e,t){e.exports=require("lodash/assign")},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e){return{type:m,provider:e}}function o(e){return{type:P,user:e}}function i(e,t){return{type:S,provider:e,errors:t}}function a(e){var t=e.provider,r=e.params;return function(e,n){e(u(t));var a=n(),f=c({provider:t,params:r,state:a});return e(s({provider:t,url:f,state:a})).then(function(t){return e(o(t))})["catch"](function(r){var n=r.errors;return e(i(t,n))})}}function c(e){var t=e.provider,r=e.params,n=e.state,u=(0,d.getSettings)(n).backend.authProviderPaths,o=u[t];if(!o)throw"authProviderPath is not set for "+t;var i=o+"?auth_origin_url="+encodeURIComponent(window.location.href);return r&&(0,b["default"])(r).forEach(function(e){return i+="&"+encodeURIComponent(e)+"="+encodeURIComponent(r[e])}),i}function s(e){var t=e.provider,r=e.url,n=e.state,u=e.tab,o=void 0!==u&&u,i=o?"_blank":t,a=(0,O["default"])(t,r,i);return function(e,r){var u=(0,d.getSettings)(r()),o=u.tokenFormat;return new Promise(function(r,u){return e(f({popup:a,provider:t,state:n,resolve:r,reject:u,tokenFormat:o}))})}}function f(e){var t=e.popup,r=e.provider,n=e.state,u=e.resolve,o=e.reject,i=e.tokenFormat;return function(e){var a=null;try{a=(0,E.getAllParams)(t.location)}catch(c){console.log(c)}if(!(0,h.areHeadersBlank)(a,i)){var s=(0,d.getSettings)(n).backend.tokenValidationPath;return t.close(),e((0,p.updateHeaders)((0,h.parseHeaders)(a,i))),e((0,g["default"])(s)).then(_["default"]).then(function(e){var t=e.data;return u(t)})["catch"](function(e){var t=e.errors;return o({errors:t})})}return t.closed?o({errors:"Authentication was cancelled."}):setTimeout(function(){return e(f({popup:t,provider:r,state:n,resolve:u,reject:o,tokenFormat:i}))},20)}}Object.defineProperty(t,"__esModule",{value:!0}),t.OAUTH_SIGN_IN_ERROR=t.OAUTH_SIGN_IN_COMPLETE=t.OAUTH_SIGN_IN_START=void 0,t.oAuthSignInStart=u,t.oAuthSignInComplete=o,t.oAuthSignInError=i,t.oAuthSignIn=a;var d=r(1),l=r(12),_=n(l),h=r(9),p=r(3),T=r(8),g=n(T),v=r(29),O=n(v),E=r(15),I=r(7),b=n(I),m=t.OAUTH_SIGN_IN_START="OAUTH_SIGN_IN_START",P=t.OAUTH_SIGN_IN_COMPLETE="OAUTH_SIGN_IN_COMPLETE",S=t.OAUTH_SIGN_IN_ERROR="OAUTH_SIGN_IN_ERROR"},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){var t=e.json();return e.status>=200&&e.status<300?t:t.then(function(e){return Promise.reject(e)})}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e){return{type:O,config:e}}function o(e){return{backend:(0,v["default"])({},l["default"],e.backend),tokenFormat:e.tokenFormat||h["default"],cookieOptions:(0,v["default"])({},T["default"],e.cookieOptions),cookies:e.cookies}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return function(t,r){if(r().auth.getIn(["user","isSignedIn"]))return Promise.resolve();var n=o(e);if(t(u(n)),n.cookies&&n.cookies[n.cookieOptions.key])try{t((0,f.updateHeaders)(JSON.parse(n.cookies[n.cookieOptions.key])))}catch(i){t((0,f.updateHeaders)())}return e.currentLocation&&e.currentLocation.match(/blank=true/)?Promise.resolve({blank:!0}):t((0,c["default"])(e.currentLocation)).then(function(e){var r=e.user;return t((0,s.authenticateComplete)(r)),Promise.resolve()})["catch"](function(e){var r=e.errors;return t((0,f.updateHeaders)()),t((0,s.authenticateError)(r)),Promise.resolve()})}}Object.defineProperty(t,"__esModule",{value:!0}),t.AUTH_INIT_SETTINGS=void 0,t.initialize=i;var a=r(14),c=n(a),s=r(6),f=r(3),d=r(17),l=n(d),_=r(19),h=n(_),p=r(18),T=n(p),g=r(10),v=n(g),O=t.AUTH_INIT_SETTINGS="AUTH_INIT_SETTINGS"},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return function(t,r){var n=r(),u=(0,i.getHeaders)(n),c=(0,a.getSettings)(n),f=c.backend,_=c.tokenFormat,p=(0,d["default"])(o["default"].parse(e),_),T=p.authRedirectHeaders;if((0,i.areHeadersBlank)(T,_)||(u=(0,i.parseHeaders)(T,_)),0===(0,h["default"])(u).length)return Promise.reject({reason:"No creds"});var g=f.tokenValidationPath+"?unbatch=true";return t((0,l.authenticateStart)()),t((0,s["default"])(g)).then(function(e){return e.json()}).then(function(e){return e.success?Promise.resolve({user:e.data}):Promise.reject({errors:e.errors})})}};var u=r(34),o=n(u),i=r(9),a=r(1),c=r(8),s=n(c),f=r(15),d=n(f),l=r(6),_=r(7),h=n(_)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e){var t=e.anchor||"",r=t.split("?");return r.length>1?r[1]:null}function o(e){var t=e.search||"",r=t.replace("?","");return r?d["default"].parse(r):{}}function i(e){var t=u(e);return t?d["default"].parse(t):{}}function a(e){return(0,_["default"])({},i(e),o(e))}function c(e,t){var r=a(e),n={};return(0,p["default"])(t).forEach(function(e){return n[e]=r[e]}),n}function s(e,t){var r=d["default"].stringify((0,g["default"])(o(e),t)),n=d["default"].stringify((0,g["default"])(i(e),t)),u=(e.hash||"").split("?")[0];return r&&(r="?"+r),n&&(u+="?"+n),u&&!u.match(/^#/)&&(u="#/"+u),e.pathname+r+u}Object.defineProperty(t,"__esModule",{value:!0}),t.getAllParams=a,t["default"]=function(e,t){if(!e)return{};var r=(0,p["default"])(t),n=c(e,r),u=s(e,r);return u!==e?{authRedirectHeaders:n,authRedirectPath:u}:{}};var f=r(33),d=n(f),l=r(10),_=n(l),h=r(7),p=n(h),T=r(32),g=n(T)},function(e,t){e.exports=require("js-cookie")},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={tokenValidationPath:"/auth/validate_token",signOutPath:"/auth/sign_out",authProviderPaths:{}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={key:"authHeaders",path:"/",expire:14}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={"Access-Token":null,"Token-Type":"Bearer",Client:null,Expiry:null,Uid:null,Authorization:"{{ Token-Type } { Access-Token }}"}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.OAUTH_SIGN_IN_ERROR=t.OAUTH_SIGN_IN_COMPLETE=t.OAUTH_SIGN_IN_START=t.AUTHENTICATE_ERROR=t.AUTHENTICATE_COMPLETE=t.AUTHENTICATE_START=t.verifyAuth=t.UPDATE_HEADERS=t.updateHeaders=t.oAuthSignIn=t.authenticateError=t.authenticateComplete=t.authenticateStart=t.SIGN_OUT_ERROR=t.SIGN_OUT_COMPLETE=t.SIGN_OUT=t.signOut=t.initialize=t.parseResponse=t.getHeaders=t.fetch=t.authStateReducer=void 0;var u=r(9);Object.defineProperty(t,"getHeaders",{enumerable:!0,get:function(){return u.getHeaders}});var o=r(13);Object.defineProperty(t,"initialize",{enumerable:!0,get:function(){return o.initialize}});var i=r(4);Object.defineProperty(t,"signOut",{enumerable:!0,get:function(){return i.signOut}}),Object.defineProperty(t,"SIGN_OUT",{enumerable:!0,get:function(){return i.SIGN_OUT}}),Object.defineProperty(t,"SIGN_OUT_COMPLETE",{enumerable:!0,get:function(){return i.SIGN_OUT_COMPLETE}}),Object.defineProperty(t,"SIGN_OUT_ERROR",{enumerable:!0,get:function(){return i.SIGN_OUT_ERROR}});var a=r(6);Object.defineProperty(t,"authenticateStart",{enumerable:!0,get:function(){return a.authenticateStart}}),Object.defineProperty(t,"authenticateComplete",{enumerable:!0,get:function(){return a.authenticateComplete}}),Object.defineProperty(t,"authenticateError",{enumerable:!0,get:function(){return a.authenticateError}});var c=r(11);Object.defineProperty(t,"oAuthSignIn",{enumerable:!0,get:function(){return c.oAuthSignIn}});var s=r(3);Object.defineProperty(t,"updateHeaders",{enumerable:!0,get:function(){return s.updateHeaders}}),Object.defineProperty(t,"UPDATE_HEADERS",{enumerable:!0,get:function(){return s.UPDATE_HEADERS}}),Object.defineProperty(t,"AUTHENTICATE_START",{enumerable:!0,get:function(){return a.AUTHENTICATE_START}}),Object.defineProperty(t,"AUTHENTICATE_COMPLETE",{enumerable:!0,get:function(){return a.AUTHENTICATE_COMPLETE}}),Object.defineProperty(t,"AUTHENTICATE_ERROR",{enumerable:!0,get:function(){return a.AUTHENTICATE_ERROR}}),Object.defineProperty(t,"OAUTH_SIGN_IN_START",{enumerable:!0,get:function(){return c.OAUTH_SIGN_IN_START}}),Object.defineProperty(t,"OAUTH_SIGN_IN_COMPLETE",{enumerable:!0,get:function(){return c.OAUTH_SIGN_IN_COMPLETE}}),Object.defineProperty(t,"OAUTH_SIGN_IN_ERROR",{enumerable:!0,get:function(){return c.OAUTH_SIGN_IN_ERROR}});var f=r(25),d=n(f),l=r(8),_=n(l),h=r(12),p=n(h),T=r(14),g=n(T);t.authStateReducer=d["default"],t.fetch=_["default"],t.parseResponse=p["default"],t.verifyAuth=g["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e){var t=(0,o.getSettings)(e),r=t.tokenFormat,n={};return(0,a["default"])(r).forEach(function(t){var r=e.auth.getIn(["headers",t]);r&&(n[t]=r)}),n}Object.defineProperty(t,"__esModule",{value:!0}),t.getHeaders=u;var o=r(1),i=r(7),a=n(i)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var o,i=r(5),a=n(i),c=r(2),s=r(6),f=r(4),d=a["default"].fromJS({loading:!1,valid:!1,errors:null});t["default"]=(0,c.createReducer)(d,(o={},u(o,s.AUTHENTICATE_COMPLETE,function(e){return e.merge({loading:!1,errors:null,valid:!0})}),u(o,s.AUTHENTICATE_ERROR,function(e){return e.merge({loading:!1,errors:"Invalid token",valid:!1})}),u(o,f.SIGN_OUT,function(){return d}),o))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(5),a=n(i),c=r(2),s=r(13),f=a["default"].fromJS({});t["default"]=(0,c.createReducer)(f,u({},s.AUTH_INIT_SETTINGS,function(e,t){var r=t.config;return e.mergeDeep(o({},r))}))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var o,i=r(5),a=n(i),c=r(2),s=r(3),f=r(4),d=a["default"].fromJS({});t["default"]=(0,c.createReducer)(d,(o={},u(o,s.UPDATE_HEADERS,function(e,t){var r=t.headers;return e.merge(r)}),u(o,f.SIGN_OUT,function(){return d}),o))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var u=r(2),o=r(22),i=n(o),a=r(28),c=n(a),s=r(26),f=n(s),d=r(24),l=n(d),_=r(27),h=n(_),p=r(23),T=n(p);t["default"]=(0,u.combineReducers)({signOut:h["default"],authentication:i["default"],oAuthSignIn:f["default"],headers:l["default"],user:c["default"],config:T["default"]})},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var o,i=r(5),a=n(i),c=r(2),s=r(11),f=r(4),d=a["default"].fromJS({loading:!1,errors:null});t["default"]=(0,c.createReducer)(d,(o={},u(o,s.OAUTH_SIGN_IN_START,function(e,t){var r=t.provider;return e.setIn([r,"loading"],!0)}),u(o,s.OAUTH_SIGN_IN_COMPLETE,function(e,t){var r=t.provider;return e.mergeDeep(u({},r,{loading:!1,errors:null}))}),u(o,s.OAUTH_SIGN_IN_ERROR,function(e,t){var r=t.provider,n=t.errors;return e.mergeDeep(u({},r,{loading:!1,errors:n}))}),u(o,f.SIGN_OUT,function(){return d}),o))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var o,i=r(5),a=n(i),c=r(2),s=r(4),f=a["default"].fromJS({loading:!1,errors:null});t["default"]=(0,c.createReducer)(f,(o={},u(o,s.SIGN_OUT,function(e){return e.setIn(["loading"],!0)}),u(o,s.SIGN_OUT_COMPLETE,function(e){return e.mergeDeep({loading:!1,errors:null})}),u(o,s.SIGN_OUT_ERROR,function(e,t){var r=t.errors;return e.mergeDeep({loading:!1,errors:r})}),o))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var o,i=r(5),a=n(i),c=r(2),s=r(6),f=r(11),d=r(4),l=a["default"].fromJS({attributes:null,isSignedIn:!1});t["default"]=(0,c.createReducer)(l,(o={},u(o,s.AUTHENTICATE_COMPLETE,function(e,t){var r=t.user;return e.merge({attributes:r,isSignedIn:!0})}),u(o,f.OAUTH_SIGN_IN_COMPLETE,function(e,t){var r=t.user;return e.merge({attributes:r,isSignedIn:!0})}),u(o,s.AUTHENTICATE_ERROR,function(e){return e.merge(l)}),u(o,d.SIGN_OUT,function(){return l}),o))},function(e,t){"use strict";function r(e){var t=e.width,r=e.height,n=window.screenLeft?window.screenLeft:window.screenX,u=window.screenTop?window.screenTop:window.screenY,o=n+window.innerWidth/2-t/2,i=u+window.innerHeight/2-r/2;return{top:i,left:o}}function n(e){switch(e){case"facebook":return{width:580,height:400};case"google":return{width:452,height:633};case"github":return{width:1020,height:618};case"linkedin":return{width:527,height:582};case"twitter":return{width:495,height:645};case"live":return{width:500,height:560};case"yahoo":return{width:559,height:519};default:return{width:1020,height:618}}}function u(e){var t=n(e),u=t.width,o=t.height,i=r({width:u,height:o}),a=i.top,c=i.left;return"width="+u+",height="+o+",top="+a+",left="+c}Object.defineProperty(t,"__esModule",{value:!0});var o="scrollbars=no,toolbar=no,location=no,titlebar=no,directories=no,status=no,menubar=no";t["default"]=function(e,t,r){return window.open(t,r,o+","+u(e))}},function(e,t){e.exports=require("isomorphic-fetch")},function(e,t){e.exports=require("lodash/isArray")},function(e,t){e.exports=require("lodash/omit")},function(e,t){e.exports=require("querystring")},function(e,t){e.exports=require("url")}])}); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("immutable"),require("redux-immutablejs"),require("lodash/keys"),require("lodash/assign"),require("js-cookie"),require("isomorphic-fetch"),require("lodash/isArray"),require("lodash/omit"),require("querystring"),require("url"));else if("function"==typeof define&&define.amd)define(["immutable","redux-immutablejs","lodash/keys","lodash/assign","js-cookie","isomorphic-fetch","lodash/isArray","lodash/omit","querystring","url"],t);else{var r="object"==typeof exports?t(require("immutable"),require("redux-immutablejs"),require("lodash/keys"),require("lodash/assign"),require("js-cookie"),require("isomorphic-fetch"),require("lodash/isArray"),require("lodash/omit"),require("querystring"),require("url")):t(e.immutable,e["redux-immutablejs"],e["lodash/keys"],e["lodash/assign"],e["js-cookie"],e["isomorphic-fetch"],e["lodash/isArray"],e["lodash/omit"],e.querystring,e.url);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,function(e,t,r,n,u,o,i,a,c,s){return function(e){function t(n){if(r[n])return r[n].exports;var u=r[n]={exports:{},id:n,loaded:!1};return e[n].call(u.exports,u,u.exports,t),u.loaded=!0,u.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(20)},function(e,t){"use strict";function r(e){return{backend:n(e),cookieOptions:u(e),tokenFormat:o(e)}}function n(e){var t=""+e.auth.getIn(["config","backend","apiUrl"]),r={};return e.auth.getIn(["config","backend","authProviderPaths"]).forEach(function(e,n){return r[n]=""+t+e}),{tokenValidationPath:""+t+e.auth.getIn(["config","backend","tokenValidationPath"]),signOutPath:""+t+e.auth.getIn(["config","backend","signOutPath"]),authProviderPaths:r,apiUrl:t}}function u(e){return{key:e.auth.getIn(["config","cookieOptions","key"]),expire:e.auth.getIn(["config","cookieOptions","expire"]),path:e.auth.getIn(["config","cookieOptions","path"])}}function o(e){var t={};return e.auth.getIn(["config","tokenFormat"]).forEach(function(e,r){return t[r]=e}),t}Object.defineProperty(t,"__esModule",{value:!0}),t.getSettings=r},function(e,t){e.exports=require("immutable")},function(e,t){e.exports=require("redux-immutablejs")},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return function(t,r){var n=(0,a.getSettings)(r()),u=n.cookieOptions;return i["default"].set(u.key,e,{expires:u.expires,path:u.path}),t({type:c,headers:e})}}Object.defineProperty(t,"__esModule",{value:!0}),t.UPDATE_HEADERS=void 0,t.updateHeaders=u;var o=r(16),i=n(o),a=r(1),c=t.UPDATE_HEADERS="UPDATE_HEADERS"},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(){return{type:h}}function o(){return{type:p}}function i(e){return{type:T,errors:e}}function a(){return function(e,t){var r=(0,f.getSettings)(t()),n=r.backend;return e(u()),e((0,_.updateHeaders)({})),e((0,s["default"])(n.signOutPath,{method:"delete"})).then(l["default"]).then(function(){return e(o()),Promise.resolve()})["catch"](function(t){return e(i(t)),Promise.reject(t)})}}Object.defineProperty(t,"__esModule",{value:!0}),t.SIGN_OUT_ERROR=t.SIGN_OUT_COMPLETE=t.SIGN_OUT=void 0,t.signOut=a;var c=r(8),s=n(c),f=r(1),d=r(12),l=n(d),_=r(4),h=t.SIGN_OUT="SIGN_OUT",p=t.SIGN_OUT_COMPLETE="SIGN_OUT_COMPLETE",T=t.SIGN_OUT_ERROR="SIGN_OUT_ERROR"},function(e,t){"use strict";function r(){return{type:o}}function n(e){return{type:i,user:e}}function u(e){return{type:a,errors:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.authenticateStart=r,t.authenticateComplete=n,t.authenticateError=u;var o=t.AUTHENTICATE_START="AUTHENTICATE_START",i=t.AUTHENTICATE_COMPLETE="AUTHENTICATE_COMPLETE",a=t.AUTHENTICATE_ERROR="AUTHENTICATE_ERROR"},function(e,t){e.exports=require("lodash/keys")},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return function(r,n){var u=n(),i=(0,f.getSettings)(u),d=i.tokenFormat,l=i.backend;return e.match(l.apiUrl)?(0,o["default"])(e,(0,a["default"])({},t,{headers:(0,c.prepareHeadersForFetch)((0,c.getHeaders)(u),d)})).then(function(e){var t=(0,c.parseHeaders)(e.headers,d);return r((0,s.updateHeaders)(t)),Promise.resolve(e)})["catch"](function(e){return Promise.reject(e)}):(0,o["default"])(e,t).then(function(e){return Promise.resolve(e)})["catch"](function(e){return Promise.reject(e)})}};var u=r(30),o=n(u),i=r(10),a=n(i),c=r(9),s=r(4),f=r(1)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t){try{var r=e.trim();return r.length>1&&"{"===r[0]&&"}"===r[r.length-1]?r.substr(1,r.length-2).replace(/\{(.*?)}/g,function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];var u=t[r[1].trim()];if(!u)throw"required values missing";return u}):e}catch(n){return null}}function o(e,t){var r=(0,f["default"])({},e,{"If-Modified-Since":"Mon, 26 Jul 1997 05:00:00 GMT"});return(0,l["default"])(t).forEach(function(n){var o=t[n];if(o&&!r[n]){var i=u(o,e);i&&(r[n]=i)}}),r}function i(e){if(!e||void 0===e)return{};var t=(0,g.getSettings)(e),r=t.cookieOptions,n=t.tokenFormat,u=(0,v.getHeaders)(e);if(!c(u,n))return u;try{return JSON.parse(T["default"].get(r.key)||"{}")}catch(o){return{}}}function a(e,t){if(!e)return{};var r={},n=!0;return(0,l["default"])(t).forEach(function(t){void 0===e[t]?e.get&&e.get(t)&&(r[t]=e.get(t)):r[t]=e[t],r[t]&&((0,h["default"])(r[t])&&(r[t]=r[t][0]),n=!1)}),n?{}:r}function c(e,t){if(!e)return!0;for(var r=(0,l["default"])(t),n=0;n<r.length;++n){var u=r[n],o=void 0!==e[u]||e.has&&e.has(u);if(o)return!1}return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.prepareHeadersForFetch=o,t.getHeaders=i,t.parseHeaders=a,t.areHeadersBlank=c;var s=r(10),f=n(s),d=r(7),l=n(d),_=r(31),h=n(_),p=r(16),T=n(p),v=r(21),g=r(1)},function(e,t){e.exports=require("lodash/assign")},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e){return{type:m,provider:e}}function o(e){return{type:P,user:e}}function i(e,t){return{type:S,provider:e,errors:t}}function a(e){var t=e.provider,r=e.params;return function(e,n){e(u(t));var a=n(),f=c({provider:t,params:r,state:a});return e(s({provider:t,url:f,state:a})).then(function(t){return e(o(t))})["catch"](function(r){var n=r.errors;return e(i(t,n))})}}function c(e){var t=e.provider,r=e.params,n=e.state,u=(0,d.getSettings)(n).backend.authProviderPaths,o=u[t];if(!o)throw"authProviderPath is not set for "+t;var i=o+"?auth_origin_url="+encodeURIComponent(window.location.href);return r&&(0,b["default"])(r).forEach(function(e){return i+="&"+encodeURIComponent(e)+"="+encodeURIComponent(r[e])}),i}function s(e){var t=e.provider,r=e.url,n=e.state,u=e.tab,o=void 0!==u&&u,i=o?"_blank":t,a=(0,O["default"])(t,r,i);return function(e,r){var u=(0,d.getSettings)(r()),o=u.tokenFormat;return new Promise(function(r,u){return e(f({popup:a,provider:t,state:n,resolve:r,reject:u,tokenFormat:o}))})}}function f(e){var t=e.popup,r=e.provider,n=e.state,u=e.resolve,o=e.reject,i=e.tokenFormat;return function(e){var a=null;try{a=(0,E.getAllParams)(t.location)}catch(c){console.log(c)}if(!(0,h.areHeadersBlank)(a,i)){var s=(0,d.getSettings)(n).backend.tokenValidationPath;return t.close(),e((0,p.updateHeaders)((0,h.parseHeaders)(a,i))),e((0,v["default"])(s)).then(_["default"]).then(function(e){var t=e.data;return u(t)})["catch"](function(e){var t=e.errors;return o({errors:t})})}return t.closed?o({errors:"Authentication was cancelled."}):setTimeout(function(){return e(f({popup:t,provider:r,state:n,resolve:u,reject:o,tokenFormat:i}))},20)}}Object.defineProperty(t,"__esModule",{value:!0}),t.OAUTH_SIGN_IN_ERROR=t.OAUTH_SIGN_IN_COMPLETE=t.OAUTH_SIGN_IN_START=void 0,t.oAuthSignInStart=u,t.oAuthSignInComplete=o,t.oAuthSignInError=i,t.oAuthSignIn=a;var d=r(1),l=r(12),_=n(l),h=r(9),p=r(4),T=r(8),v=n(T),g=r(29),O=n(g),E=r(15),I=r(7),b=n(I),m=t.OAUTH_SIGN_IN_START="OAUTH_SIGN_IN_START",P=t.OAUTH_SIGN_IN_COMPLETE="OAUTH_SIGN_IN_COMPLETE",S=t.OAUTH_SIGN_IN_ERROR="OAUTH_SIGN_IN_ERROR"},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){var t=e.json();return e.status>=200&&e.status<300?t:t.then(function(e){return Promise.reject(e)})}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e){return{type:O,config:e}}function o(e){return{backend:(0,g["default"])({},l["default"],e.backend),tokenFormat:e.tokenFormat||h["default"],cookieOptions:(0,g["default"])({},T["default"],e.cookieOptions),cookies:e.cookies}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return function(t,r){if(r().auth.getIn(["user","isSignedIn"]))return Promise.resolve();var n=o(e);if(t(u(n)),n.cookies&&n.cookies[n.cookieOptions.key])try{t((0,f.updateHeaders)(JSON.parse(n.cookies[n.cookieOptions.key])))}catch(i){t((0,f.updateHeaders)())}return e.currentLocation&&e.currentLocation.match(/blank=true/)?Promise.resolve({blank:!0}):t((0,c["default"])(e.currentLocation)).then(function(e){var r=e.user;return t((0,s.authenticateComplete)(r)),Promise.resolve()})["catch"](function(e){var r=e.errors;return t((0,f.updateHeaders)()),t((0,s.authenticateError)(r)),Promise.resolve()})}}Object.defineProperty(t,"__esModule",{value:!0}),t.AUTH_INIT_SETTINGS=void 0,t.initialize=i;var a=r(14),c=n(a),s=r(6),f=r(4),d=r(17),l=n(d),_=r(19),h=n(_),p=r(18),T=n(p),v=r(10),g=n(v),O=t.AUTH_INIT_SETTINGS="AUTH_INIT_SETTINGS"},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return function(t,r){var n=r(),u=(0,i.getHeaders)(n),c=(0,a.getSettings)(n),f=c.backend,_=c.tokenFormat,p=(0,d["default"])(o["default"].parse(e),_),T=p.authRedirectHeaders;if((0,i.areHeadersBlank)(T,_)||(u=(0,i.parseHeaders)(T,_)),0===(0,h["default"])(u).length)return Promise.reject({reason:"No creds"});var v=f.tokenValidationPath+"?unbatch=true";return t((0,l.authenticateStart)()),t((0,s["default"])(v)).then(function(e){return e.json()}).then(function(e){return e.success?Promise.resolve({user:e.data}):Promise.reject({errors:e.errors})})}};var u=r(34),o=n(u),i=r(9),a=r(1),c=r(8),s=n(c),f=r(15),d=n(f),l=r(6),_=r(7),h=n(_)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e){var t=e.anchor||"",r=t.split("?");return r.length>1?r[1]:null}function o(e){var t=e.search||"",r=t.replace("?","");return r?d["default"].parse(r):{}}function i(e){var t=u(e);return t?d["default"].parse(t):{}}function a(e){return(0,_["default"])({},i(e),o(e))}function c(e,t){var r=a(e),n={};return(0,p["default"])(t).forEach(function(e){return n[e]=r[e]}),n}function s(e,t){var r=d["default"].stringify((0,v["default"])(o(e),t)),n=d["default"].stringify((0,v["default"])(i(e),t)),u=(e.hash||"").split("?")[0];return r&&(r="?"+r),n&&(u+="?"+n),u&&!u.match(/^#/)&&(u="#/"+u),e.pathname+r+u}Object.defineProperty(t,"__esModule",{value:!0}),t.getAllParams=a,t["default"]=function(e,t){if(!e)return{};var r=(0,p["default"])(t),n=c(e,r),u=s(e,r);return u!==e?{authRedirectHeaders:n,authRedirectPath:u}:{}};var f=r(33),d=n(f),l=r(10),_=n(l),h=r(7),p=n(h),T=r(32),v=n(T)},function(e,t){e.exports=require("js-cookie")},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={tokenValidationPath:"/auth/validate_token",signOutPath:"/auth/sign_out",authProviderPaths:{}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={key:"authHeaders",path:"/",expire:14}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={"Access-Token":null,"Token-Type":"Bearer",Client:null,Expiry:null,Uid:null,Authorization:"{{ Token-Type } { Access-Token }}"}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.OAUTH_SIGN_IN_ERROR=t.OAUTH_SIGN_IN_COMPLETE=t.OAUTH_SIGN_IN_START=t.AUTHENTICATE_ERROR=t.AUTHENTICATE_COMPLETE=t.AUTHENTICATE_START=t.verifyAuth=t.UPDATE_HEADERS=t.updateHeaders=t.oAuthSignIn=t.authenticateError=t.authenticateComplete=t.authenticateStart=t.SIGN_OUT_ERROR=t.SIGN_OUT_COMPLETE=t.SIGN_OUT=t.signOut=t.initialize=t.parseResponse=t.getHeaders=t.fetch=t.authStateReducer=void 0;var u=r(9);Object.defineProperty(t,"getHeaders",{enumerable:!0,get:function(){return u.getHeaders}});var o=r(13);Object.defineProperty(t,"initialize",{enumerable:!0,get:function(){return o.initialize}});var i=r(5);Object.defineProperty(t,"signOut",{enumerable:!0,get:function(){return i.signOut}}),Object.defineProperty(t,"SIGN_OUT",{enumerable:!0,get:function(){return i.SIGN_OUT}}),Object.defineProperty(t,"SIGN_OUT_COMPLETE",{enumerable:!0,get:function(){return i.SIGN_OUT_COMPLETE}}),Object.defineProperty(t,"SIGN_OUT_ERROR",{enumerable:!0,get:function(){return i.SIGN_OUT_ERROR}});var a=r(6);Object.defineProperty(t,"authenticateStart",{enumerable:!0,get:function(){return a.authenticateStart}}),Object.defineProperty(t,"authenticateComplete",{enumerable:!0,get:function(){return a.authenticateComplete}}),Object.defineProperty(t,"authenticateError",{enumerable:!0,get:function(){return a.authenticateError}});var c=r(11);Object.defineProperty(t,"oAuthSignIn",{enumerable:!0,get:function(){return c.oAuthSignIn}});var s=r(4);Object.defineProperty(t,"updateHeaders",{enumerable:!0,get:function(){return s.updateHeaders}}),Object.defineProperty(t,"UPDATE_HEADERS",{enumerable:!0,get:function(){return s.UPDATE_HEADERS}}),Object.defineProperty(t,"AUTHENTICATE_START",{enumerable:!0,get:function(){return a.AUTHENTICATE_START}}),Object.defineProperty(t,"AUTHENTICATE_COMPLETE",{enumerable:!0,get:function(){return a.AUTHENTICATE_COMPLETE}}),Object.defineProperty(t,"AUTHENTICATE_ERROR",{enumerable:!0,get:function(){return a.AUTHENTICATE_ERROR}}),Object.defineProperty(t,"OAUTH_SIGN_IN_START",{enumerable:!0,get:function(){return c.OAUTH_SIGN_IN_START}}),Object.defineProperty(t,"OAUTH_SIGN_IN_COMPLETE",{enumerable:!0,get:function(){return c.OAUTH_SIGN_IN_COMPLETE}}),Object.defineProperty(t,"OAUTH_SIGN_IN_ERROR",{enumerable:!0,get:function(){return c.OAUTH_SIGN_IN_ERROR}});var f=r(25),d=n(f),l=r(8),_=n(l),h=r(12),p=n(h),T=r(14),v=n(T);t.authStateReducer=d["default"],t.fetch=_["default"],t.parseResponse=p["default"],t.verifyAuth=v["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e){var t=(0,o.getSettings)(e),r=t.tokenFormat,n={};return(0,a["default"])(r).forEach(function(t){var r=e.auth.getIn(["headers",t]);r&&(n[t]=r)}),n}Object.defineProperty(t,"__esModule",{value:!0}),t.getHeaders=u;var o=r(1),i=r(7),a=n(i)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var o,i=r(2),a=n(i),c=r(3),s=r(6),f=r(5),d=a["default"].fromJS({loading:!1,valid:!1,errors:null});t["default"]=(0,c.createReducer)(d,(o={},u(o,s.AUTHENTICATE_COMPLETE,function(e){return e.merge({loading:!1,errors:null,valid:!0})}),u(o,s.AUTHENTICATE_ERROR,function(e){return e.merge({loading:!1,errors:"Invalid token",valid:!1})}),u(o,f.SIGN_OUT,function(){return d}),o))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(2),a=n(i),c=r(3),s=r(13),f=a["default"].fromJS({});t["default"]=(0,c.createReducer)(f,u({},s.AUTH_INIT_SETTINGS,function(e,t){var r=t.config;return e.mergeDeep(o({},r))}))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var o,i=r(2),a=n(i),c=r(3),s=r(4),f=r(5),d=a["default"].fromJS({});t["default"]=(0,c.createReducer)(d,(o={},u(o,s.UPDATE_HEADERS,function(e,t){var r=t.headers;return e.merge(r)}),u(o,f.SIGN_OUT,function(){return d}),o))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var u=r(3),o=r(2),i=n(o),a=r(22),c=n(a),s=r(28),f=n(s),d=r(26),l=n(d),_=r(24),h=n(_),p=r(27),T=n(p),v=r(23),g=n(v),O=(0,u.combineReducers)({signOut:T["default"],authentication:c["default"],oAuthSignIn:l["default"],headers:h["default"],user:f["default"],config:g["default"]});t["default"]=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];return i["default"].Iterable.isIterable(e)?O(e,t):O(i["default"].fromJS(e),t)}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var o,i=r(2),a=n(i),c=r(3),s=r(11),f=r(5),d=a["default"].fromJS({loading:!1,errors:null});t["default"]=(0,c.createReducer)(d,(o={},u(o,s.OAUTH_SIGN_IN_START,function(e,t){var r=t.provider;return e.setIn([r,"loading"],!0)}),u(o,s.OAUTH_SIGN_IN_COMPLETE,function(e,t){var r=t.provider;return e.mergeDeep(u({},r,{loading:!1,errors:null}))}),u(o,s.OAUTH_SIGN_IN_ERROR,function(e,t){var r=t.provider,n=t.errors;return e.mergeDeep(u({},r,{loading:!1,errors:n}))}),u(o,f.SIGN_OUT,function(){return d}),o))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var o,i=r(2),a=n(i),c=r(3),s=r(5),f=a["default"].fromJS({loading:!1,errors:null});t["default"]=(0,c.createReducer)(f,(o={},u(o,s.SIGN_OUT,function(e){return e.setIn(["loading"],!0)}),u(o,s.SIGN_OUT_COMPLETE,function(e){return e.mergeDeep({loading:!1,errors:null})}),u(o,s.SIGN_OUT_ERROR,function(e,t){var r=t.errors;return e.mergeDeep({loading:!1,errors:r})}),o))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var o,i=r(2),a=n(i),c=r(3),s=r(6),f=r(11),d=r(5),l=a["default"].fromJS({attributes:null,isSignedIn:!1});t["default"]=(0,c.createReducer)(l,(o={},u(o,s.AUTHENTICATE_COMPLETE,function(e,t){var r=t.user;return e.merge({attributes:r,isSignedIn:!0})}),u(o,f.OAUTH_SIGN_IN_COMPLETE,function(e,t){var r=t.user;return e.merge({attributes:r,isSignedIn:!0})}),u(o,s.AUTHENTICATE_ERROR,function(e){return e.merge(l)}),u(o,d.SIGN_OUT,function(){return l}),o))},function(e,t){"use strict";function r(e){var t=e.width,r=e.height,n=window.screenLeft?window.screenLeft:window.screenX,u=window.screenTop?window.screenTop:window.screenY,o=n+window.innerWidth/2-t/2,i=u+window.innerHeight/2-r/2;return{top:i,left:o}}function n(e){switch(e){case"facebook":return{width:580,height:400};case"google":return{width:452,height:633};case"github":return{width:1020,height:618};case"linkedin":return{width:527,height:582};case"twitter":return{width:495,height:645};case"live":return{width:500,height:560};case"yahoo":return{width:559,height:519};default:return{width:1020,height:618}}}function u(e){var t=n(e),u=t.width,o=t.height,i=r({width:u,height:o}),a=i.top,c=i.left;return"width="+u+",height="+o+",top="+a+",left="+c}Object.defineProperty(t,"__esModule",{value:!0});var o="scrollbars=no,toolbar=no,location=no,titlebar=no,directories=no,status=no,menubar=no";t["default"]=function(e,t,r){return window.open(t,r,o+","+u(e))}},function(e,t){e.exports=require("isomorphic-fetch")},function(e,t){e.exports=require("lodash/isArray")},function(e,t){e.exports=require("lodash/omit")},function(e,t){e.exports=require("querystring")},function(e,t){e.exports=require("url")}])}); |
{ | ||
"name": "redux-oauth", | ||
"description": "Oauth token authentication system for redux.", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "repository": { |
# redux-oauth | ||
Bearer token-based authentication library with omniauth support for redux applications | ||
# Full example | ||
### Universal / Isomorphic use-case | ||
[Live demo](https://redux-oauth-demo.heroku.com) | ||
[Source code](https://github.com/yury-dymov/redux-oauth-demo) | ||
### Client-side only | ||
[Live demo](https://yury-dymov.github.io/redux-oauth-client-demo) | ||
[Source code](https://github.com/yury-dymov/redux-oauth-client-demo) | ||
### Backend | ||
[Backend source code](https://github.com/yury-dymov/redux-oauth-backend-demo) | ||
# Notes on migration from 1.x version | ||
@@ -11,5 +25,5 @@ First version is based and fully compatible with [Redux-Auth](https://github.com/lynndylanhurley/redux-auth). Support is discontinued. | ||
* Implements Bearer token-based authentication for your application to talk to 3d party APIs | ||
* Provides universal fetch method for any HTTP/HTTPS calls both client and server side | ||
* Provides universal / isomorphic fetch method for any HTTP/HTTPS requests | ||
* Supports OAuth2 | ||
* Supports server-side rendering to make users and search engines happy. This means that page, which require several API requests, can be fully or partly rendered on the server first | ||
* Supports server-side rendering to make users and search engines happy. This means that page, which require several API requests, can be fully or partly rendered on the server side first | ||
@@ -119,14 +133,2 @@ # Configuration | ||
# Full example | ||
### Universal / Isomorphic use-case | ||
[Live demo](https://yury-dymov.github.io/redux-oauth-client-demo) | ||
[Source code](https://github.com/yury-dymov/redux-oauth-demo) | ||
### Client-side only | ||
[Live demo](https://yury-dymov.github.io/redux-oauth-client-demo) | ||
[Source code](https://github.com/yury-dymov/redux-oauth-client-demo) | ||
### Backend | ||
[Backend source code](https://github.com/yury-dymov/redux-oauth-backend-demo) | ||
# Email-password authentication and other use-cases | ||
@@ -133,0 +135,0 @@ I wanted to make library as light-weight as possible. Also many folks have very different use-cases so it is hard to satisfy everyone. Therefore it is considered that everyone can easily implement methods they need themselves. |
import { combineReducers } from 'redux-immutablejs'; | ||
import Immutable from "immutable"; | ||
@@ -10,3 +11,3 @@ import authentication from './authenticate'; | ||
export default combineReducers({ | ||
const reducer = combineReducers({ | ||
signOut, | ||
@@ -19,1 +20,9 @@ authentication, | ||
}); | ||
export default (state = {}, action) => { | ||
if (!Immutable.Iterable.isIterable(state)) { | ||
return reducer(Immutable.fromJS(state), action); | ||
} | ||
return reducer(state, action); | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
53715
622
167
3