@influitive/profile-card
Advanced tools
Comparing version 3.1.4 to 3.1.5
{ | ||
"name": "@influitive/profile-card", | ||
"version": "3.1.4", | ||
"version": "3.1.5", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "@influitive/jwt": "^2.1.2", |
@@ -66,1 +66,18 @@ This application was scaffolded via [create-infl-app](https://gitlab.influitive.io/influitive/create-infl-app) | ||
The master branch is v2 while there is also a v3 branch. Changes need to be duplicated in both branches. | ||
- before releasing, make sure you remove node_modules and re-install. There seems to be an error when publishing where there is no lib folder, but getting fresh node_modules seems to somehow fix it. | ||
- you can try `npm publish --dry-run`, I haven't tested this yet, but it should list all the files without actually publishing. | ||
### Infl-fe | ||
To run locally in infl-fe for testing purposes, follow these steps: | ||
1. In Profile Card (v3), run: | ||
- `npm run buildmodule` | ||
- `npm pack` | ||
- copy resulting .tgz file name | ||
2. In Infl-fe stop it running then run: | ||
- `rm -rf node_modules` | ||
- `yarn cache clean` | ||
- `yarn add ../profile-card/<tgz file> --ignore-engines | ||
- `yarn install --ignore-engines` | ||
- `yarn start` |
@@ -7,3 +7,4 @@ export default { | ||
INITIALIZE_CARD: 'INITIALIZE_CARD', | ||
HIDE_PROFILE: 'HIDE_PROFILE' | ||
HIDE_PROFILE: 'HIDE_PROFILE', | ||
SET_MESSAGE_URL: 'SET_MESSAGE_URL' | ||
}; |
import axios from 'axios'; | ||
import * as R from 'ramda'; | ||
import i18n from '../localization'; | ||
@@ -11,2 +12,3 @@ import actions from './action-types'; | ||
dispatch(fetchProfile(id, profileCardId)); | ||
dispatch(fetchMessageUrl(id, profileCardId)); | ||
} | ||
@@ -88,1 +90,19 @@ }; | ||
}; | ||
export const fetchMessageUrl = (memberId, profileCardId) => { | ||
return (dispatch) => | ||
axios.get('/api/features/public') | ||
.then(R.path(['data', 'data'])) | ||
.then( | ||
R.pipe( | ||
features => features.includes('inbox_v2') ? `/chat?p=${memberId}` : `/inbox/${memberId}`, | ||
messageUrl => dispatch({ | ||
type: actions.SET_MESSAGE_URL, | ||
payload: { messageUrl, profileCardId } | ||
}) | ||
)) | ||
.catch(() => dispatch({ | ||
type: actions.SET_MESSAGE_URL, | ||
payload: { messageUrl: `/inbox/${memberId}`, profileCardId } | ||
})); | ||
}; |
@@ -22,3 +22,4 @@ import React, { Component } from 'react'; | ||
disableViewProfile: PropTypes.bool.isRequired, | ||
disableMessage: PropTypes.bool.isRequired | ||
disableMessage: PropTypes.bool.isRequired, | ||
messageUrl: PropTypes.string.isRequired, | ||
} | ||
@@ -41,3 +42,3 @@ | ||
return ( | ||
<Action className="c-action c-message" href={`/inbox/${this.props.id}`}> | ||
<Action className="c-action c-message" href={this.props.messageUrl}> | ||
{this.props.t('Message')} | ||
@@ -44,0 +45,0 @@ </Action> |
@@ -41,3 +41,4 @@ import React, { Component } from 'react'; | ||
disableViewProfile={this.props.disableViewProfile} | ||
disableMessage={this.props.disableMessage} /> | ||
disableMessage={this.props.disableMessage} | ||
messageUrl={this.props.profileDetails.messageUrl} /> | ||
</Section> | ||
@@ -44,0 +45,0 @@ ); |
@@ -46,2 +46,8 @@ /* eslint complexity: "off" */ | ||
} | ||
case actions.SET_MESSAGE_URL: { | ||
return { | ||
...state, | ||
messageUrl: action.payload.messageUrl | ||
}; | ||
} | ||
default: { | ||
@@ -48,0 +54,0 @@ return state; |
@@ -37,2 +37,5 @@ /* eslint complexity: "off" */ | ||
} | ||
case actions.SET_MESSAGE_URL: { | ||
return updateProfileCard(state, action); | ||
} | ||
default: { | ||
@@ -39,0 +42,0 @@ return state; |
@@ -229,1 +229,27 @@ import deepFreeze from 'deep-freeze'; | ||
}); | ||
it('will update the profile messageUrl', () => { | ||
const messageUrl = '/chat?p=12345'; | ||
const expectedState = { | ||
...initialState, | ||
'0': { | ||
...cardInitialState, | ||
id: 0, | ||
messageUrl | ||
} | ||
}; | ||
let newState = sut(initialState, { | ||
type: actions.INITIALIZE_CARD, | ||
payload: { | ||
profileCardId: 0 | ||
} | ||
}); | ||
const resultState = sut(newState, { | ||
type: actions.SET_MESSAGE_URL, | ||
payload: { profileCardId: 0, messageUrl } | ||
}); | ||
expect(resultState).toEqual(expectedState); | ||
}); |
83
3
445286
36
1195