From 7f4a6a44f3e10ad5dd667df6fc156cb51f6cbff1 Mon Sep 17 00:00:00 2001 From: Maximilian Mantz Date: Fri, 20 Jan 2017 12:02:55 +0100 Subject: [PATCH] v3.0.0-beta.3 --- dist/redux-oidc.js | 2 +- package.json | 2 +- src/reducer/reducer-immutable.js | 5 ++++- tests/reducer/reducer-immutable.test.js | 7 ++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/dist/redux-oidc.js b/dist/redux-oidc.js index 5cd3f18..0ef3be5 100644 --- a/dist/redux-oidc.js +++ b/dist/redux-oidc.js @@ -1 +1 @@ -!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("react"),require("co"),require("immutable"),require("oidc-client"));else if("function"==typeof define&&define.amd)define(["react","co","immutable","oidc-client"],r);else{var n="object"==typeof exports?r(require("react"),require("co"),require("immutable"),require("oidc-client")):r(e.react,e.co,e.immutable,e["oidc-client"]);for(var t in n)("object"==typeof exports?exports:e)[t]=n[t]}}(this,function(e,r,n,t){return function(e){function r(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var n={};return r.m=e,r.c=n,r.i=function(e){return e},r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=14)}([function(e,r,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.USER_EXPIRED="redux-oidc/USER_EXPIRED",r.REDIRECT_SUCCESS="redux-oidc/REDIRECT_SUCCESS",r.USER_LOADED="redux-oidc/USER_LOADED",r.SILENT_RENEW_ERROR="redux-oidc/SILENT_RENEW_ERROR",r.SESSION_TERMINATED="redux-oidc/SESSION_TERMINATED",r.USER_EXPIRING="redux-oidc/USER_EXPIRING",r.USER_FOUND="redux-oidc/USER_FOUND",r.LOADING_USER="redux-oidc/LOADING_USER",r.USER_SIGNED_OUT="redux-oidc/USER_SIGNED_OUT"},function(e,r,n){"use strict";function t(){return{type:l.USER_EXPIRED}}function o(e){return{type:l.REDIRECT_SUCCESS,payload:e}}function i(e){return{type:l.USER_FOUND,payload:e}}function s(e){return{type:l.SILENT_RENEW_ERROR,payload:e}}function u(){return{type:l.SESSION_TERMINATED}}function c(){return{type:l.USER_EXPIRING}}function a(){return{type:l.LOADING_USER}}function d(){return{type:l.USER_SIGNED_OUT}}Object.defineProperty(r,"__esModule",{value:!0}),r.userExpired=t,r.redirectSuccess=o,r.userFound=i,r.silentRenewError=s,r.sessionTerminated=u,r.userExpiring=c,r.loadingUser=a,r.userSignedOut=d;var l=n(0)},function(e,r,n){"use strict";function t(e){return new o.UserManager(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=t;var o=n(13)},function(e,r){e.exports=require("react")},function(e,r,n){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.userSignedOut=r.loadingUser=r.userExpiring=r.sessionTerminated=r.silentRenewError=r.userFound=r.redirectSuccess=r.userExpired=r.USER_SIGNED_OUT=r.LOADING_USER=r.USER_EXPIRING=r.SESSION_TERMINATED=r.SILENT_RENEW_ERROR=r.USER_NOT_FOUND=r.USER_FOUND=r.REDIRECT_SUCCESS=r.USER_EXPIRED=r.OidcProvider=r.reducer=r.immutableReducer=r.CallbackComponent=r.processSilentRenew=r.createUserManager=void 0;var o=n(8),i=t(o);r.createUserManager=n(2).default,r.processSilentRenew=n(7).default,r.CallbackComponent=n(5).default,r.immutableReducer=n(9).default,r.reducer=n(10).default,r.OidcProvider=n(6).default,r.USER_EXPIRED=n(0).USER_EXPIRED,r.REDIRECT_SUCCESS=n(0).REDIRECT_SUCCESS,r.USER_FOUND=n(0).USER_FOUND,r.USER_NOT_FOUND=n(0).USER_NOT_FOUND,r.SILENT_RENEW_ERROR=n(0).SILENT_RENEW_ERROR,r.SESSION_TERMINATED=n(0).SESSION_TERMINATED,r.USER_EXPIRING=n(0).USER_EXPIRING,r.LOADING_USER=n(0).LOADING_USER,r.USER_SIGNED_OUT=n(0).USER_SIGNED_OUT,r.userExpired=n(1).userExpired,r.redirectSuccess=n(1).redirectSuccess,r.userFound=n(1).userFound,r.silentRenewError=n(1).silentRenewError,r.sessionTerminated=n(1).sessionTerminated,r.userExpiring=n(1).userExpiring,r.loadingUser=n(1).loadingUser,r.userSignedOut=n(1).userSignedOut,r.default=i.default},function(e,r,n){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function o(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function i(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function s(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var u=function(){function e(e,r){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:r,o=arguments[1];switch(o.type){case t.USER_EXPIRED:return n.set("isLoadingUser",!1);case t.SILENT_RENEW_ERROR:return n.set("isLoadingUser",!1);case t.SESSION_TERMINATED:case t.USER_SIGNED_OUT:return e({user:null,isLoadingUser:!1});case t.REDIRECT_SUCCESS:case t.USER_FOUND:return e({user:o.payload,isLoadingUser:!1});case t.LOADING_USER:return n.set("isLoadingUser",!0);default:return n}}}()}catch(e){o=function(){console.error("You must install immutable-js for this to work!")}}r.default=o},function(e,r,n){"use strict";function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s,r=arguments[1];switch(r.type){case i.USER_EXPIRED:return Object.assign({},o({},e),{user:null,isLoadingUser:!1});case i.SILENT_RENEW_ERROR:return Object.assign({},o({},e),{isLoadingUser:!1});case i.SESSION_TERMINATED:case i.USER_SIGNED_OUT:return Object.assign({},o({},e),{user:null,isLoadingUser:!1});case i.REDIRECT_SUCCESS:case i.USER_FOUND:return Object.assign({},o({},e),{user:r.payload,isLoadingUser:!1});case i.LOADING_USER:return Object.assign({},o({},e),{isLoadingUser:!0});default:return e}}Object.defineProperty(r,"__esModule",{value:!0});var o=Object.assign||function(e){for(var r=1;r0&&void 0!==arguments[0]?arguments[0]:r,o=arguments[1];switch(o.type){case t.USER_EXPIRED:return e({user:null,isLoadingUser:!1});case t.SILENT_RENEW_ERROR:return n.set("isLoadingUser",!1);case t.SESSION_TERMINATED:case t.USER_SIGNED_OUT:return e({user:null,isLoadingUser:!1});case t.REDIRECT_SUCCESS:case t.USER_FOUND:return e({user:o.payload,isLoadingUser:!1});case t.LOADING_USER:return n.set("isLoadingUser",!0);default:return n}}}()}catch(e){o=function(){console.error("You must install immutable-js for this to work!")}}r.default=o},function(e,r,n){"use strict";function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s,r=arguments[1];switch(r.type){case i.USER_EXPIRED:return Object.assign({},o({},e),{user:null,isLoadingUser:!1});case i.SILENT_RENEW_ERROR:return Object.assign({},o({},e),{isLoadingUser:!1});case i.SESSION_TERMINATED:case i.USER_SIGNED_OUT:return Object.assign({},o({},e),{user:null,isLoadingUser:!1});case i.REDIRECT_SUCCESS:case i.USER_FOUND:return Object.assign({},o({},e),{user:r.payload,isLoadingUser:!1});case i.LOADING_USER:return Object.assign({},o({},e),{isLoadingUser:!0});default:return e}}Object.defineProperty(r,"__esModule",{value:!0});var o=Object.assign||function(e){for(var r=1;r { switch (action.type) { case USER_EXPIRED: - return state.set('isLoadingUser', false); + return fromJS({ + user: null, + isLoadingUser: false + }); case SILENT_RENEW_ERROR: return state.set('isLoadingUser', false); case SESSION_TERMINATED: diff --git a/tests/reducer/reducer-immutable.test.js b/tests/reducer/reducer-immutable.test.js index 015819a..eef81d9 100644 --- a/tests/reducer/reducer-immutable.test.js +++ b/tests/reducer/reducer-immutable.test.js @@ -17,12 +17,17 @@ describe('immutable reducer', () => { }); it('should handle USER_EXPIRED correctly', () => { + const state = fromJS({ + user: { some: 'user' }, + isLoadingUser: true + }); + const expectedResult = fromJS({ user: null, isLoadingUser: false }); - expect(reducer(fromJS(initialState), userExpired())).toEqual(expectedResult); + expect(reducer(state, userExpired())).toEqual(expectedResult); }); it('should handle SILENT_RENEW_ERROR correctly', () => {