diff --git a/package.json b/package.json index e1f50d8c..35efc08b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@trixta/trixta-js", - "version": "1.0.5", + "version": "1.0.6", "description": "Javascript library to integrate Trixta", "source": "src/index.ts", "main": "dist/@trixta/trixta-js.cjs.js", @@ -105,7 +105,7 @@ }, "peerDependencies": { "@rjsf/core": "^2.5.1", - "@trixta/phoenix-to-redux": "3.4.7-beta.0", + "@trixta/phoenix-to-redux": "3.5.0-beta.0", "debug": "4.3.1", "immer": ">=3.0.0", "phoenix": "~1.5.4", @@ -119,7 +119,7 @@ "reselect": "~4.0.0" }, "dependencies": { - "@trixta/phoenix-to-redux": "3.4.7-beta.0", + "@trixta/phoenix-to-redux": "3.5.0-beta.0", "phoenix": "1.5.4", "nanoid": "3.1.23" }, diff --git a/src/React/constants/index.ts b/src/React/constants/index.ts index 4644eecb..d1766e15 100644 --- a/src/React/constants/index.ts +++ b/src/React/constants/index.ts @@ -97,8 +97,3 @@ export const TRIXTA_MODE_TYPE_FIELDS = { type: 'type', limit: 'limit', }; - -export const CHANNEL_JOINED_FIELDS = { - contract_actions: 'contract_actions', - contract_reactions: 'contract_reactions', -}; diff --git a/src/React/reducers/__tests__/reducers.test.js b/src/React/reducers/__tests__/reducers.test.js index 01035e22..cda39db7 100644 --- a/src/React/reducers/__tests__/reducers.test.js +++ b/src/React/reducers/__tests__/reducers.test.js @@ -12,12 +12,8 @@ import { pickBy, } from '../../../utils'; import { - ROLE_REACTION_RESPONSE_FIELDS, SUBMIT_TRIXTA_ACTION_RESPONSE_FAILURE, SUBMIT_TRIXTA_ACTION_RESPONSE_SUCCESS, - TRIXTA_FIELDS, - TRIXTA_MODE_TYPE, - TRIXTA_MODE_TYPE_FIELDS, } from '../../constants'; import * as actions from '../../reduxActions'; import { signoutTrixta } from '../../reduxActions'; @@ -63,7 +59,7 @@ describe('trixtaReducer', () => { state = trixtaState; const expectedResult = produce(state, (draft) => { draft.authorizationStarted = true; - const roleName = get(action, 'data.roleName'); + const roleName = action.data.roleName; const index = draft.agentDetails.findIndex((role) => role === roleName); if (index === -1) { draft.agentDetails.push(roleName); @@ -82,7 +78,7 @@ describe('trixtaReducer', () => { const action = { data: { role: { name: nameOfRole } } }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const roleName = get(action, 'data.role.name', false); + const roleName = action.data.role.name; if (roleName) { const index = draft.agentDetails.findIndex((role) => role === roleName); if (index === -1) { @@ -139,7 +135,7 @@ describe('trixtaReducer', () => { const action = { data: { role: { name: nameOfRole } } }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const roleName = get(action, 'data.role.name'); + const roleName = action.data.role.name; const index = draft.agentDetails.findIndex((role) => role === roleName); delete draft.authorizingStatus[roleName]; if (index !== -1) draft.agentDetails.splice(index, 1); @@ -173,8 +169,8 @@ describe('trixtaReducer', () => { }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const actionName = get(action, 'data.actionName'); - const roleName = get(action, 'data.roleName'); + const actionName = action.data.actionName; + const roleName = action.data.roleName; const keyName = getReducerKeyName({ name: actionName, role: roleName, @@ -199,8 +195,8 @@ describe('trixtaReducer', () => { }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const actionName = get(action, 'data.actionName'); - const roleName = get(action, 'data.roleName'); + const actionName = action.data.actionName; + const roleName = action.data.roleName; const keyName = getReducerKeyName({ name: actionName, role: roleName, @@ -223,12 +219,12 @@ describe('trixtaReducer', () => { const nameOfRole = 'guest[d1be63be-c0e4-4468-982c-5c04714a2987]'; const nameOfAction = 'add_to_queue'; const action = { - data: { roleName: nameOfRole, actionName: nameOfAction }, + additionalData: { roleName: nameOfRole, actionName: nameOfAction }, }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const actionName = get(action, 'data.actionName'); - const roleName = get(action, 'data.roleName'); + const actionName = action.additionalData.actionName; + const roleName = action.additionalData.roleName; const keyName = getReducerKeyName({ name: actionName, role: roleName, @@ -238,7 +234,7 @@ describe('trixtaReducer', () => { }); const updatedResult = trixtaReducer( state, - actions.submitTrixtaActionResponse(action.data), + actions.submitTrixtaActionResponse(action.additionalData), ); expect( updatedResult.actions[`${nameOfRole}:${nameOfAction}`].loadingStatus, @@ -247,7 +243,7 @@ describe('trixtaReducer', () => { }); const successResult = trixtaReducer(updatedResult, { type: SUBMIT_TRIXTA_ACTION_RESPONSE_SUCCESS, - data: action.data, + additionalData: action.additionalData, }); expect(successResult).toEqual(expectedResult); expect( @@ -259,13 +255,13 @@ describe('trixtaReducer', () => { const nameOfRole = 'guest[d1be63be-c0e4-4468-982c-5c04714a2987]'; const nameOfAction = 'add_to_queue'; const action = { - data: { roleName: nameOfRole, actionName: nameOfAction }, + additionalData: { roleName: nameOfRole, actionName: nameOfAction }, }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const actionName = get(action, 'data.actionName'); - const roleName = get(action, 'data.roleName'); - const clearResponse = get(action, 'data.clearResponse'); + const actionName = action.additionalData.actionName; + const roleName = action.additionalData.roleName; + const clearResponse = action.additionalData.clearResponse; const keyName = getReducerKeyName({ name: actionName, role: roleName, @@ -280,20 +276,16 @@ describe('trixtaReducer', () => { mode ) { const instance = getTrixtaInstanceResult({ - error: get(action, 'error'), + error: action.error, success: false, }); - switch (mode[TRIXTA_MODE_TYPE_FIELDS.type]) { - case TRIXTA_MODE_TYPE.replace: + switch (mode.type) { + case 'replace': draft.actions[keyName].instances[0] = instance; break; - case TRIXTA_MODE_TYPE.accumulate: + case 'accumulate': { - const accumalateLength = get( - mode, - TRIXTA_MODE_TYPE_FIELDS.limit, - 10, - ); + const accumalateLength = get(mode, 'limit', 10); draft.actions[keyName].instances.unshift(instance); draft.actions[keyName].instances.length = accumalateLength; } @@ -305,7 +297,7 @@ describe('trixtaReducer', () => { }); const updatedResult = trixtaReducer( state, - actions.submitTrixtaActionResponse(action.data), + actions.submitTrixtaActionResponse(action.additionalData), ); expect( updatedResult.actions[`${nameOfRole}:${nameOfAction}`].loadingStatus, @@ -314,7 +306,7 @@ describe('trixtaReducer', () => { }); const failureResult = trixtaReducer(updatedResult, { type: SUBMIT_TRIXTA_ACTION_RESPONSE_FAILURE, - data: action.data, + additionalData: action.additionalData, }); expect(failureResult).toEqual(expectedResult); expect( @@ -349,9 +341,9 @@ describe('trixtaReducer', () => { }; const expectedResult = produce(state, (draft) => { - const keyName = get(action, 'data.keyName'); + const keyName = action.data.keyName; const mode = get(state.actions, `${keyName}.mode`); - const clearResponse = get(action, 'data.clearResponse'); + const clearResponse = action.data.clearResponse; if (!draft.actions[keyName]) return; if (clearResponse) draft.actions[keyName].instances = []; if ( @@ -360,14 +352,14 @@ describe('trixtaReducer', () => { mode ) { const instance = getTrixtaInstanceResult({ - success: get(action, 'data.response'), + success: action.data.response, error: false, }); switch (mode.type) { - case TRIXTA_MODE_TYPE.replace: + case 'replace': draft.actions[keyName].instances[0] = instance; break; - case TRIXTA_MODE_TYPE.accumulate: + case 'accumulate': { const accumalateLength = mode.limit ?? 10; draft.actions[keyName].instances.unshift(instance); @@ -414,9 +406,9 @@ describe('trixtaReducer', () => { }; const expectedResult = produce(state, (draft) => { - const keyName = get(action, 'data.keyName'); + const keyName = action.data.keyName; const mode = get(state.actions, `${keyName}.mode`); - const clearResponse = get(action, 'data.clearResponse'); + const clearResponse = action.data.clearResponse; if (!draft.actions[keyName]) return; if (clearResponse) draft.actions[keyName].instances = []; if ( @@ -425,14 +417,14 @@ describe('trixtaReducer', () => { mode ) { const instance = getTrixtaInstanceResult({ - success: get(action, 'data.response'), + success: action.data.response, error: false, }); switch (mode.type) { - case TRIXTA_MODE_TYPE.replace: + case 'replace': draft.actions[keyName].instances[0] = instance; break; - case TRIXTA_MODE_TYPE.accumulate: + case 'accumulate': { const accumalateLength = mode.limit ?? 10; draft.actions[keyName].instances.unshift(instance); @@ -491,9 +483,9 @@ describe('trixtaReducer', () => { }; const expectedResult = produce(state, (draft) => { - const keyName = get(action, 'data.keyName'); + const keyName = action.data.keyName; const mode = get(state.actions, `${keyName}.mode`); - const clearResponse = get(action, 'data.clearResponse'); + const clearResponse = action.data.clearResponse; if (!draft.actions[keyName]) return; if (clearResponse) draft.actions[keyName].instances = []; if ( @@ -502,14 +494,14 @@ describe('trixtaReducer', () => { mode ) { const instance = getTrixtaInstanceResult({ - success: get(action, 'data.response'), + success: action.data.response, error: false, }); switch (mode.type) { - case TRIXTA_MODE_TYPE.replace: + case 'replace': draft.actions[keyName].instances[0] = instance; break; - case TRIXTA_MODE_TYPE.accumulate: + case 'accumulate': { const accumalateLength = mode.limit ?? 10; draft.actions[keyName].instances.unshift(instance); @@ -586,8 +578,8 @@ describe('trixtaReducer', () => { }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const actionDetails = get(action, 'data.action'); - const keyName = get(action, 'data.keyName', null); + const actionDetails = action.data.action; + const keyName = action.data.keyName; draft.actions[keyName] = getTrixtaActionReducerStructure({ details: actionDetails, }); @@ -654,8 +646,8 @@ describe('trixtaReducer', () => { }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const actionDetails = get(action, 'data.action'); - const keyName = get(action, 'data.keyName', null); + const actionDetails = action.data.action; + const keyName = action.data.keyName; draft.actions[keyName] = getTrixtaActionReducerStructure({ details: actionDetails, }); @@ -717,8 +709,8 @@ describe('trixtaReducer', () => { }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const actionDetails = get(action, 'data.action'); - const keyName = get(action, 'data.keyName', null); + const actionDetails = action.data.action; + const keyName = action.data.keyName; draft.actions[keyName] = getTrixtaActionReducerStructure({ details: actionDetails, }); @@ -749,8 +741,8 @@ describe('trixtaReducer', () => { }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const reactionName = get(action, 'data.reactionName'); - const roleName = get(action, 'data.roleName'); + const reactionName = action.data.reactionName; + const roleName = action.data.roleName; const keyName = getReducerKeyName({ name: reactionName, role: roleName, @@ -797,8 +789,8 @@ describe('trixtaReducer', () => { }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const reactionDetails = get(action, 'data.reaction'); - const keyName = get(action, 'data.keyName', null); + const reactionDetails = action.data.reaction; + const keyName = action.data.keyName; draft.reactions[keyName] = getTrixtaReactionReducerStructure({ details: reactionDetails, }); @@ -834,8 +826,8 @@ describe('trixtaReducer', () => { }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const reactionDetails = get(action, 'data.reaction'); - const keyName = get(action, 'data.keyName', null); + const reactionDetails = action.data.reaction; + const keyName = action.data.keyName; draft.reactions[keyName] = getTrixtaReactionReducerStructure({ details: reactionDetails, }); @@ -876,8 +868,8 @@ describe('trixtaReducer', () => { state = trixtaState; const expectedResult = produce(state, (draft) => { - const reactionDetails = get(action, 'data.reaction'); - const keyName = get(action, 'data.keyName', null); + const reactionDetails = action.data.reaction; + const keyName = action.data.keyName; draft.reactions[keyName] = getTrixtaReactionReducerStructure({ details: reactionDetails, }); @@ -924,40 +916,33 @@ describe('trixtaReducer', () => { }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const keyName = get(action, 'data.keyName'); - const reactionDetails = get(action, 'data.reaction'); + const keyName = action.data.keyName; + const reactionDetails = action.data.reaction; const reaction = getReactionDetails({ reaction: reactionDetails, }); - const ref = get(reaction, ROLE_REACTION_RESPONSE_FIELDS.ref); + const ref = reaction.ref; if (!draft.reactions[keyName]) return; const mode = get(state.reactions, `${keyName}.mode`); - const isExpired = - get(reaction, ROLE_REACTION_RESPONSE_FIELDS.status, '') === - 'expired'; - const isRequestForResponse = - reaction.type === TRIXTA_FIELDS.requestForResponse; + const isExpired = reaction.status === 'expired'; + const isRequestForResponse = reaction.type === 'requestForResponse'; if (isRequestForResponse) { draft.reactions[keyName].loadingStatus = { status: true, }; } if (isExpired) { - const index = draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].findIndex( - (existingReaction) => - get( - existingReaction, - `details.${ROLE_REACTION_RESPONSE_FIELDS.ref}`, - false, - ) === ref, + const index = draft.reactions[ + keyName + ].instances.requestForResponse.findIndex( + (existingReaction) => existingReaction.details.ref === ref, ); if (index !== -1) { - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].splice(index, 1); + draft.reactions[keyName].instances.requestForResponse.splice( + index, + 1, + ); draft.reactions[keyName].loadingStatus = {}; } } else if (draft.reactions[keyName] && mode) { @@ -969,46 +954,44 @@ describe('trixtaReducer', () => { error: false, }); switch (mode.type) { - case TRIXTA_MODE_TYPE.replace: + case 'replace': if (isRequestForResponse) { - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ][0] = instance; + draft.reactions[ + keyName + ].instances.requestForResponse[0] = instance; break; } - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ][0] = instance; + draft.reactions[ + keyName + ].instances.requestForEffect[0] = instance; break; - case TRIXTA_MODE_TYPE.accumulate: + case 'accumulate': { const accumalateLength = mode.limit ?? 10; if (isRequestForResponse) { - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].unshift(instance); + draft.reactions[ + keyName + ].instances.requestForResponse.unshift(instance); if ( - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].length > accumalateLength + draft.reactions[keyName].instances.requestForResponse + .length > accumalateLength ) - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].length = accumalateLength; + draft.reactions[ + keyName + ].instances.requestForResponse.length = accumalateLength; break; } - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ].unshift(instance); + draft.reactions[keyName].instances.requestForEffect.unshift( + instance, + ); if ( - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ].length > accumalateLength + draft.reactions[keyName].instances.requestForEffect.length > + accumalateLength ) - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ].length = accumalateLength; + draft.reactions[ + keyName + ].instances.requestForEffect.length = accumalateLength; } break; default: @@ -1051,40 +1034,33 @@ describe('trixtaReducer', () => { }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const keyName = get(action, 'data.keyName'); - const reactionDetails = get(action, 'data.reaction'); + const keyName = action.data.keyName; + const reactionDetails = action.data.reaction; const reaction = getReactionDetails({ reaction: reactionDetails, }); - const ref = get(reaction, ROLE_REACTION_RESPONSE_FIELDS.ref); + const ref = reaction.ref; if (!draft.reactions[keyName]) return; const mode = get(state.reactions, `${keyName}.mode`); - const isExpired = - get(reaction, ROLE_REACTION_RESPONSE_FIELDS.status, '') === - 'expired'; - const isRequestForResponse = - reaction.type === TRIXTA_FIELDS.requestForResponse; + const isExpired = reaction.status === 'expired'; + const isRequestForResponse = reaction.type === 'requestForResponse'; if (isRequestForResponse) { draft.reactions[keyName].loadingStatus = { status: true, }; } if (isExpired) { - const index = draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].findIndex( - (existingReaction) => - get( - existingReaction, - `details.${ROLE_REACTION_RESPONSE_FIELDS.ref}`, - false, - ) === ref, + const index = draft.reactions[ + keyName + ].instances.requestForResponse.findIndex( + (existingReaction) => existingReaction.details.ref === ref, ); if (index !== -1) { - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].splice(index, 1); + draft.reactions[keyName].instances.requestForResponse.splice( + index, + 1, + ); draft.reactions[keyName].loadingStatus = {}; } } else if (draft.reactions[keyName] && mode) { @@ -1096,46 +1072,44 @@ describe('trixtaReducer', () => { error: false, }); switch (mode.type) { - case TRIXTA_MODE_TYPE.replace: + case 'replace': if (isRequestForResponse) { - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ][0] = instance; + draft.reactions[ + keyName + ].instances.requestForResponse[0] = instance; break; } - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ][0] = instance; + draft.reactions[ + keyName + ].instances.requestForEffect[0] = instance; break; - case TRIXTA_MODE_TYPE.accumulate: + case 'accumulate': { const accumalateLength = mode.limit ?? 10; if (isRequestForResponse) { - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].unshift(instance); + draft.reactions[ + keyName + ].instances.requestForResponse.unshift(instance); if ( - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].length > accumalateLength + draft.reactions[keyName].instances.requestForResponse + .length > accumalateLength ) - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].length = accumalateLength; + draft.reactions[ + keyName + ].instances.requestForResponse.length = accumalateLength; break; } - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ].unshift(instance); + draft.reactions[keyName].instances.requestForEffect.unshift( + instance, + ); if ( - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ].length > accumalateLength + draft.reactions[keyName].instances.requestForEffect.length > + accumalateLength ) - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ].length = accumalateLength; + draft.reactions[ + keyName + ].instances.requestForEffect.length = accumalateLength; } break; default: @@ -1179,40 +1153,33 @@ describe('trixtaReducer', () => { }; state = trixtaState; const expectedResult = produce(state, (draft) => { - const keyName = get(action, 'data.keyName'); + const keyName = action.data.keyName; const reactionDetails = get(action, 'data.reaction'); const reaction = getReactionDetails({ reaction: reactionDetails, }); - const ref = get(reaction, ROLE_REACTION_RESPONSE_FIELDS.ref); + const ref = reaction.ref; if (!draft.reactions[keyName]) return; const mode = get(state.reactions, `${keyName}.mode`); - const isExpired = - get(reaction, ROLE_REACTION_RESPONSE_FIELDS.status, '') === - 'expired'; - const isRequestForResponse = - reaction.type === TRIXTA_FIELDS.requestForResponse; + const isExpired = reaction.status === 'expired'; + const isRequestForResponse = reaction.type === 'requestForResponse'; if (isRequestForResponse) { draft.reactions[keyName].loadingStatus = { status: true, }; } if (isExpired) { - const index = draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].findIndex( - (existingReaction) => - get( - existingReaction, - `details.${ROLE_REACTION_RESPONSE_FIELDS.ref}`, - false, - ) === ref, + const index = draft.reactions[ + keyName + ].instances.requestForResponse.findIndex( + (existingReaction) => existingReaction.details.ref === ref, ); if (index !== -1) { - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].splice(index, 1); + draft.reactions[keyName].instances.requestForResponse.splice( + index, + 1, + ); draft.reactions[keyName].loadingStatus = {}; } } else if (draft.reactions[keyName] && mode) { @@ -1224,46 +1191,44 @@ describe('trixtaReducer', () => { error: false, }); switch (mode.type) { - case TRIXTA_MODE_TYPE.replace: + case 'replace': if (isRequestForResponse) { - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ][0] = instance; + draft.reactions[ + keyName + ].instances.requestForResponse[0] = instance; break; } - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ][0] = instance; + draft.reactions[ + keyName + ].instances.requestForEffect[0] = instance; break; - case TRIXTA_MODE_TYPE.accumulate: + case 'accumulate': { const accumalateLength = mode.limit ?? 10; if (isRequestForResponse) { - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].unshift(instance); + draft.reactions[ + keyName + ].instances.requestForResponse.unshift(instance); if ( - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].length > accumalateLength + draft.reactions[keyName].instances.requestForResponse + .length > accumalateLength ) - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].length = accumalateLength; + draft.reactions[ + keyName + ].instances.requestForResponse.length = accumalateLength; break; } - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ].unshift(instance); + draft.reactions[keyName].instances.requestForEffect.unshift( + instance, + ); if ( - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ].length > accumalateLength + draft.reactions[keyName].instances.requestForEffect.length > + accumalateLength ) - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ].length = accumalateLength; + draft.reactions[ + keyName + ].instances.requestForEffect.length = accumalateLength; } break; default: diff --git a/src/React/reducers/trixtaReducer.ts b/src/React/reducers/trixtaReducer.ts index 8697efb0..48dbc9ab 100644 --- a/src/React/reducers/trixtaReducer.ts +++ b/src/React/reducers/trixtaReducer.ts @@ -2,7 +2,6 @@ import { channelActionTypes } from '@trixta/phoenix-to-redux'; import produce, { Draft } from 'immer'; import { TrixtaCommon, - TrixtaInstance, TrixtaInstanceMode, TrixtaReactionDetails, } from '../../React/types'; @@ -22,15 +21,12 @@ import { CLEAR_TRIXTA_REACTION_RESPONSE, JOIN_TRIXTA_ROLE, REMOVE_TRIXTA_ROLE, - ROLE_REACTION_RESPONSE_FIELDS, SUBMIT_TRIXTA_ACTION_RESPONSE, SUBMIT_TRIXTA_ACTION_RESPONSE_FAILURE, SUBMIT_TRIXTA_ACTION_RESPONSE_SUCCESS, SUBMIT_TRIXTA_REACTION_RESPONSE, SUBMIT_TRIXTA_REACTION_RESPONSE_FAILURE, SUBMIT_TRIXTA_REACTION_RESPONSE_SUCCESS, - TRIXTA_FIELDS, - TRIXTA_MODE_TYPE, UPDATE_TRIXTA_ACTION, UPDATE_TRIXTA_ACTION_RESPONSE, UPDATE_TRIXTA_ERROR, @@ -39,9 +35,10 @@ import { UPDATE_TRIXTA_ROLE, UPDATE_TRIXTA_ROLES, } from '../constants'; +import { TrixtaReactionInstance } from '../types'; import { SIGN_OUT_TRIXTA } from './../constants/index'; import { TrixtaReducerActions } from './../reduxActions/types'; -import { TrixtaReactionResponseDetails, TrixtaState } from './../types'; +import { TrixtaState } from './../types'; export const initialState: TrixtaState = { reactions: {}, @@ -75,7 +72,7 @@ export const trixtaReducer = ( break; case REMOVE_TRIXTA_ROLE: { - const roleName = get(action, 'data.role.name'); + const roleName = action.data.role.name; const index = draft.agentDetails.findIndex( (role) => role === roleName, ); @@ -93,7 +90,7 @@ export const trixtaReducer = ( break; case JOIN_TRIXTA_ROLE: { draft.authorizationStarted = true; - const roleName = get(action, 'data.roleName'); + const roleName = action.data.roleName; const index = draft.agentDetails.findIndex((role) => role === roleName); if (index === -1) { draft.agentDetails.push(roleName); @@ -103,7 +100,7 @@ export const trixtaReducer = ( } case UPDATE_TRIXTA_ROLE: { - const roleName = get(action, 'data.role.name'); + const roleName = action.data.role.name; if (roleName) { const index = draft.agentDetails.findIndex( (role) => role === roleName, @@ -124,8 +121,8 @@ export const trixtaReducer = ( break; case SUBMIT_TRIXTA_REACTION_RESPONSE: { - const reactionName = get(action, 'data.reactionName'); - const roleName = get(action, 'data.roleName'); + const reactionName = action.data.reactionName; + const roleName = action.data.roleName; const keyName = getReducerKeyName({ name: reactionName, role: roleName, @@ -136,34 +133,26 @@ export const trixtaReducer = ( break; case SUBMIT_TRIXTA_REACTION_RESPONSE_FAILURE: { - const reactionName = get(action, 'error.reactionName'); - const roleName = get(action, 'error.roleName'); - const ref = get( - action.data, - ROLE_REACTION_RESPONSE_FIELDS.ref, - '', - ); + const reactionName = action.additionalData.reactionName; + const roleName = action.additionalData.roleName; + const ref = action.additionalData.ref; const keyName = getReducerKeyName({ name: reactionName, role: roleName, }); if (!draft.reactions[keyName]) break; - if ( - draft.reactions[keyName].instances[TRIXTA_FIELDS.requestForResponse] - ) { - const index = draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].findIndex( - (reaction: TrixtaReactionResponseDetails) => - get(reaction, ROLE_REACTION_RESPONSE_FIELDS.ref, '') === - ref, + if (draft.reactions[keyName].instances.requestForResponse) { + const index = draft.reactions[ + keyName + ].instances.requestForResponse.findIndex( + (reaction) => reaction.details.ref === ref, ); if (index !== -1) - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ][index].response = { - error: get(action, 'error'), + draft.reactions[keyName].instances.requestForResponse[ + index + ].response = { + error: action.error, success: false, }; } @@ -171,37 +160,25 @@ export const trixtaReducer = ( break; case SUBMIT_TRIXTA_REACTION_RESPONSE_SUCCESS: { - const reactionName = get(action, 'data.reactionName'); - const roleName = get(action, 'data.roleName'); - const ref = get( - action.data, - ROLE_REACTION_RESPONSE_FIELDS.ref, - '', - ); + const reactionName = action.additionalData.reactionName; + const roleName = action.additionalData.roleName; + const ref = action.additionalData.ref; const keyName = getReducerKeyName({ name: reactionName, role: roleName, }); if (!draft.reactions[keyName]) break; - if ( - draft.reactions[keyName].instances[TRIXTA_FIELDS.requestForResponse] - ) { - const index = draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].findIndex( - (reaction: TrixtaInstance) => - get(reaction, ROLE_REACTION_RESPONSE_FIELDS.ref, '') === - ref, + if (draft.reactions[keyName].instances.requestForResponse) { + const index = draft.reactions[ + keyName + ].instances.requestForResponse.findIndex( + (reaction) => reaction.details.ref === ref, ); - const response = { - ...get(action, 'data'), - } as TrixtaReactionResponseDetails; - delete response.errorEvent; - delete response.responseEvent; + const response = action.data; if (index !== -1) - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ][index].response = { + draft.reactions[keyName].instances.requestForResponse[ + index + ].response = { error: false, success: response, }; @@ -210,7 +187,7 @@ export const trixtaReducer = ( break; case UPDATE_TRIXTA_REACTION_RESPONSE: { - const keyName = get(action, 'data.keyName'); + const keyName = action.data.keyName; const reactionDetails = get( action, 'data.reaction', @@ -218,37 +195,30 @@ export const trixtaReducer = ( const reaction = getReactionDetails({ reaction: reactionDetails, }); - const ref = get(reaction, ROLE_REACTION_RESPONSE_FIELDS.ref); + const ref = reaction.ref; if (!draft.reactions[keyName]) break; const mode = get( state.reactions, `${keyName}.mode`, ); - const isExpired = - get(reaction, ROLE_REACTION_RESPONSE_FIELDS.status, '') === - 'expired'; - const isRequestForResponse = - reaction.type === TRIXTA_FIELDS.requestForResponse; + const isExpired = reaction.status === 'expired'; + const isRequestForResponse = reaction.type === 'requestForResponse'; if (isRequestForResponse) { draft.reactions[keyName].loadingStatus = { status: true, }; } if (isExpired) { - const index = draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].findIndex( - (existingReaction: TrixtaInstance) => - get( - existingReaction, - `details.${ROLE_REACTION_RESPONSE_FIELDS.ref}`, - false, - ) === ref, + const index = draft.reactions[ + keyName + ].instances.requestForResponse.findIndex( + (existingReaction) => existingReaction.details.ref === ref, ); if (index !== -1) { - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].splice(index, 1); + draft.reactions[keyName].instances.requestForResponse.splice( + index, + 1, + ); draft.reactions[keyName].loadingStatus = {}; } } else if (draft.reactions[keyName] && mode) { @@ -258,48 +228,45 @@ export const trixtaReducer = ( : { ref, ...reaction }, success: false, error: false, - }); + }) as TrixtaReactionInstance; switch (mode.type) { - case TRIXTA_MODE_TYPE.replace: + case 'replace': if (isRequestForResponse) { - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ][0] = instance; + draft.reactions[ + keyName + ].instances.requestForResponse[0] = instance; break; } - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ][0] = instance; + draft.reactions[ + keyName + ].instances.requestForEffect[0] = instance; break; - case TRIXTA_MODE_TYPE.accumulate: + case 'accumulate': { const accumalateLength = mode.limit ?? 10; if (isRequestForResponse) { - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].unshift(instance); + draft.reactions[ + keyName + ].instances.requestForResponse.unshift(instance); if ( - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].length > accumalateLength + draft.reactions[keyName].instances.requestForResponse + .length > accumalateLength ) - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ].length = accumalateLength; - + draft.reactions[ + keyName + ].instances.requestForResponse.length = accumalateLength; break; } - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ].unshift(instance); + draft.reactions[keyName].instances.requestForEffect.unshift( + instance, + ); if ( - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ].length > accumalateLength + draft.reactions[keyName].instances.requestForEffect.length > + accumalateLength ) - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ].length = accumalateLength; + draft.reactions[ + keyName + ].instances.requestForEffect.length = accumalateLength; } break; default: @@ -310,25 +277,21 @@ export const trixtaReducer = ( break; case CLEAR_TRIXTA_REACTION_RESPONSE: { - const reactionName = get(action, 'data.reactionName'); - const roleName = get(action, 'data.roleName'); + const reactionName = action.data.reactionName; + const roleName = action.data.roleName; const keyName = getReducerKeyName({ name: reactionName, role: roleName, }); if (!draft.reactions[keyName]) break; - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForResponse - ] = []; - draft.reactions[keyName].instances[ - TRIXTA_FIELDS.requestForEffect - ] = []; + draft.reactions[keyName].instances.requestForResponse = []; + draft.reactions[keyName].instances.requestForEffect = []; } break; case UPDATE_TRIXTA_ACTION: { const actionDetails = get(action, 'data.action'); - const keyName = get(action, 'data.keyName'); + const keyName = action.data.keyName; draft.actions[keyName] = getTrixtaActionReducerStructure({ details: actionDetails, }); @@ -337,7 +300,7 @@ export const trixtaReducer = ( case UPDATE_TRIXTA_REACTION: { const reactionDetails = get(action, 'data.reaction'); - const keyName = get(action, 'data.keyName'); + const keyName = action.data.keyName; draft.reactions[keyName] = getTrixtaReactionReducerStructure({ details: reactionDetails, }); @@ -345,12 +308,12 @@ export const trixtaReducer = ( break; case UPDATE_TRIXTA_ACTION_RESPONSE: { - const keyName = get(action, 'data.keyName'); + const keyName = action.data.keyName; const mode = get( state.actions, `${keyName}.mode`, ); - const clearResponse = get(action, 'data.clearResponse'); + const clearResponse = action.data.clearResponse; if (!draft.actions[keyName]) break; if (clearResponse) draft.actions[keyName].instances = []; if ( @@ -359,14 +322,14 @@ export const trixtaReducer = ( mode ) { const instance = getTrixtaInstanceResult({ - success: get(action, 'data.response'), + success: action.data.response, error: false, }); switch (mode.type) { - case TRIXTA_MODE_TYPE.replace: + case 'replace': draft.actions[keyName].instances[0] = instance; break; - case TRIXTA_MODE_TYPE.accumulate: + case 'accumulate': { const accumalateLength = mode.limit ?? 10; draft.actions[keyName].instances.unshift(instance); @@ -384,8 +347,8 @@ export const trixtaReducer = ( break; case CLEAR_TRIXTA_ACTION_RESPONSE: { - const actionName = get(action, 'data.actionName'); - const roleName = get(action, 'data.roleName'); + const actionName = action.data.actionName; + const roleName = action.data.roleName; const keyName = getReducerKeyName({ name: actionName, role: roleName, @@ -397,8 +360,8 @@ export const trixtaReducer = ( break; case SUBMIT_TRIXTA_ACTION_RESPONSE: { - const actionName = get(action, 'data.actionName'); - const roleName = get(action, 'data.roleName'); + const actionName = action.data.actionName; + const roleName = action.data.roleName; const keyName = getReducerKeyName({ name: actionName, role: roleName, @@ -409,8 +372,8 @@ export const trixtaReducer = ( break; case SUBMIT_TRIXTA_ACTION_RESPONSE_SUCCESS: { - const actionName = get(action, 'data.actionName'); - const roleName = get(action, 'data.roleName'); + const actionName = action.additionalData.actionName; + const roleName = action.additionalData.roleName; const keyName = getReducerKeyName({ name: actionName, role: roleName, @@ -421,13 +384,9 @@ export const trixtaReducer = ( break; case SUBMIT_TRIXTA_ACTION_RESPONSE_FAILURE: { - const actionName = get(action, 'data.actionName'); - const roleName = get(action, 'data.roleName'); - const clearResponse = get( - action, - 'data.clearResponse', - false, - ); + const actionName = action.additionalData.actionName; + const roleName = action.additionalData.roleName; + const clearResponse = action.additionalData.clearResponse; const keyName = getReducerKeyName({ name: actionName, role: roleName, @@ -445,14 +404,14 @@ export const trixtaReducer = ( mode ) { const instance = getTrixtaInstanceResult({ - error: get(action, 'error'), + error: action.error, success: false, }); switch (mode.type) { - case TRIXTA_MODE_TYPE.replace: + case 'replace': draft.actions[keyName].instances[0] = instance; break; - case TRIXTA_MODE_TYPE.accumulate: + case 'accumulate': { const accumalateLength = mode.limit ?? 10; draft.actions[keyName].instances.unshift(instance); diff --git a/src/React/reduxActions/internal/index.ts b/src/React/reduxActions/internal/index.ts index b8992e84..a3b8e58d 100644 --- a/src/React/reduxActions/internal/index.ts +++ b/src/React/reduxActions/internal/index.ts @@ -103,13 +103,11 @@ export function updateTrixtaReaction({ return { type: UPDATE_TRIXTA_REACTION, data: { - role, keyName: getReducerKeyName({ name, role, }), reaction, - name, }, }; } @@ -168,7 +166,6 @@ export function updateTrixtaAction({ return { type: UPDATE_TRIXTA_ACTION, data: { - role, keyName: getReducerKeyName({ name, role, @@ -176,7 +173,6 @@ export function updateTrixtaAction({ action: { ...action, }, - name, }, }; } diff --git a/src/React/reduxActions/tests/actions.test.js b/src/React/reduxActions/tests/actions.test.js index 656e3a6a..d65482c2 100644 --- a/src/React/reduxActions/tests/actions.test.js +++ b/src/React/reduxActions/tests/actions.test.js @@ -149,7 +149,6 @@ describe('Trixta redux Actions', () => { expectedResult = { type: UPDATE_TRIXTA_ACTION, data: { - role: roleName, keyName: getReducerKeyName({ name: actionName, role: roleName, @@ -157,7 +156,6 @@ describe('Trixta redux Actions', () => { action: { ...action, }, - name: actionName, }, }; expect(updateTrixtaAction(parameters)).toEqual(expectedResult); @@ -286,13 +284,11 @@ describe('Trixta redux Actions', () => { expectedResult = { type: UPDATE_TRIXTA_REACTION, data: { - role: roleName, keyName: getReducerKeyName({ name: reactionName, role: roleName, }), reaction, - name: reactionName, }, }; expect(updateTrixtaReaction(parameters)).toEqual(expectedResult); diff --git a/src/React/sagas/setupTrixtaSaga.ts b/src/React/sagas/setupTrixtaSaga.ts index d7295b7d..651b176c 100644 --- a/src/React/sagas/setupTrixtaSaga.ts +++ b/src/React/sagas/setupTrixtaSaga.ts @@ -285,24 +285,20 @@ function* submitActionResponseSaga({ data }: SubmitTrixtaActionResponseAction) { * Success response after submitting the action for the roleName * @param {Object} params * @param {Object} params.data + * @param {Object} params.additionalData * @param {String} params.data.roleName - name of role * @param {String} params.data.actionName - name of action */ function* submitActionResponseSuccess({ + additionalData, data, }: SubmitTrixtaActionResponsSuccesseAction) { - if (data) { - const roleName = data.roleName; - const actionName = data.actionName; - const clearResponse = data.clearResponse; - const responseEvent = data.responseEvent; + if (additionalData) { + const roleName = additionalData.roleName; + const actionName = additionalData.actionName; + const clearResponse = additionalData.clearResponse; + const responseEvent = additionalData.responseEvent; if (roleName && actionName) { - // eslint-disable-next-line no-param-reassign - delete data.responseEvent; - // eslint-disable-next-line no-param-reassign - delete data.clearResponse; - // eslint-disable-next-line no-param-reassign - delete data.errorEvent; yield put( updateTrixtaActionResponse({ roleName, @@ -322,13 +318,16 @@ function* submitActionResponseSuccess({ * Failure response after submitting the action for the roleName * @param {Object} params * @param {Object} params.error - * @param {Object} params.data - additionalData + * @param {Object} params.additionalData - additionalData */ function* submitActionResponseFailure({ error, - data, + additionalData, }: SubmitTrixtaActionResponsFailureAction) { - const errorEvent = data && data.errorEvent ? data.errorEvent : undefined; + const errorEvent = + additionalData && additionalData.errorEvent + ? additionalData.errorEvent + : undefined; if (errorEvent) { yield put({ type: errorEvent, error }); } @@ -462,7 +461,13 @@ function* submitResponseForReactionSaga({ event: reactionName, value: formData, }, - additionalData: { roleName, reactionName, responseEvent, errorEvent }, + additionalData: { + roleName, + reactionName, + responseEvent, + errorEvent, + ref, + }, dispatchChannelError: true, channelErrorResponseEvent: SUBMIT_TRIXTA_REACTION_RESPONSE_FAILURE, channelResponseEvent: SUBMIT_TRIXTA_REACTION_RESPONSE_SUCCESS, @@ -482,13 +487,16 @@ function* submitResponseForReactionSaga({ * Failure response after responding to reaction for the roleName * @param {Object} params * @param {Object} params.error - * @param {Object} params.data - additionalData + * @param {Object} params.additionalData - additionalData */ function* submitReactionResponseFailure({ error, - data, + additionalData, }: SubmitTrixtaReactionResponseFailureAction) { - const errorEvent = data && data.errorEvent ? data.errorEvent : undefined; + const errorEvent = + additionalData && additionalData.errorEvent + ? additionalData.errorEvent + : undefined; if (errorEvent) { yield put({ type: errorEvent, error }); } @@ -498,12 +506,16 @@ function* submitReactionResponseFailure({ * Success response after responding to reaction for the roleName * @param {Object} params * @param {Object} params.data + * @param {Object} params.additionalData */ function* submitReactionResponseSuccess({ data, + additionalData, }: SubmitTrixtaReactionResponseSuccessAction) { const responseEvent = - data && data.responseEvent ? data.responseEvent : undefined; + additionalData && additionalData.responseEvent + ? additionalData.responseEvent + : undefined; if (responseEvent) { yield put({ type: responseEvent, data }); } diff --git a/src/React/types/common/index.ts b/src/React/types/common/index.ts index 37eea095..864b455b 100644 --- a/src/React/types/common/index.ts +++ b/src/React/types/common/index.ts @@ -156,7 +156,6 @@ TErrorType= DefaultUnknownType> extends TrixtaInstance { details: TrixtaInstanceDetails; - } export type TrixtaDispatch = [T] extends [never] ? () => void : (data: T) => void; diff --git a/src/React/types/reactions/index.ts b/src/React/types/reactions/index.ts index 938f4578..3b1c98d2 100644 --- a/src/React/types/reactions/index.ts +++ b/src/React/types/reactions/index.ts @@ -94,8 +94,8 @@ export interface TrixtaReaction { status?:boolean; }; instances: { - requestForEffect?: TrixtaReactionInstance[]; - requestForResponse?: TrixtaReactionInstance[]; + requestForEffect: TrixtaReactionInstance[]; + requestForResponse: TrixtaReactionInstance[]; }; } diff --git a/yarn.lock b/yarn.lock index 8eebafcd..34e90bdc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3315,14 +3315,13 @@ resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== -"@trixta/phoenix-to-redux@3.4.7-beta.0": - version "3.4.7-beta.0" - resolved "https://registry.yarnpkg.com/@trixta/phoenix-to-redux/-/phoenix-to-redux-3.4.7-beta.0.tgz#712dfb8f0aa6236eb227395222b40b2490b3318e" - integrity sha512-Ah+mZqpTZIcVXVoQPsslevopyfZUlobEUaOwNsGKU4vFexPApNH8ALQ0jZKJaBreCBUasgOr8wDseS8kHq4BVA== +"@trixta/phoenix-to-redux@3.5.0-beta.0": + version "3.5.0-beta.0" + resolved "https://registry.yarnpkg.com/@trixta/phoenix-to-redux/-/phoenix-to-redux-3.5.0-beta.0.tgz#94f9c6b04239c0137dca69bbb9610968e334036e" + integrity sha512-n03eWHDe/nvYwKDLkTh2V+vKBk0K57/G9gJRObYpyuhEkix4QsbY4WPUa4yOw+E704Kpw0ikZUpRVub3YxouDg== dependencies: - immer "3.0.0" + immer ">=8.0.1" phoenix "1.5.4" - reselect "4.0.0" "@types/anymatch@*": version "1.3.1" @@ -8940,16 +8939,16 @@ ignore@^5.1.4: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== -immer@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/immer/-/immer-3.0.0.tgz#3991440679116ec2d6b39b0ed5341e681b26ebcf" - integrity sha512-dqLrAUJz/G7vfcuQG6GdjOGm+5Mw9YJEvDRbEwHwzBPBRziZYevOq2P1pF//B07CG1l28ZsjSqLz+RziObkaDQ== - immer@8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/immer/-/immer-8.0.1.tgz#9c73db683e2b3975c424fb0572af5889877ae656" integrity sha512-aqXhGP7//Gui2+UrEtvxZxSquQVXTpZ7KDxfCcKAF3Vysvw0CViVaW9RZ1j1xlIYqaaaipBoqdqeibkc18PNvA== +immer@>=8.0.1: + version "9.0.2" + resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.2.tgz#83e4593df9914acaecfd9fac6a8601ef44d883fc" + integrity sha512-mkcmzLtIfSp40vAqteRr1MbWNSoI7JE+/PB36FNPoSfJ9RQRmNKuTYCjKkyXyuq3Dgn07HuJBrwJd4ZSk2yUbw== + import-fresh@^3.0.0, import-fresh@^3.1.0, import-fresh@^3.2.1: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" @@ -13873,7 +13872,7 @@ requireindex@^1.2.0: resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.2.0.tgz#3463cdb22ee151902635aa6c9535d4de9c2ef1ef" integrity sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww== -reselect@4.0.0, reselect@^4.0.0: +reselect@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.0.0.tgz#f2529830e5d3d0e021408b246a206ef4ea4437f7" integrity sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA==