Skip to content

Commit

Permalink
Merge pull request #973 from bitholla/hotfix
Browse files Browse the repository at this point in the history
Hotfix
  • Loading branch information
abeikverdi authored Oct 6, 2021
2 parents b0b9f77 + 10ca4cb commit 33fb59e
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 23 deletions.
2 changes: 1 addition & 1 deletion server/api/swagger/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
swagger: "2.0"
info:
version: "2.1.19"
version: "2.1.20"
title: HollaEx Kit
host: api.hollaex.com
basePath: /v2
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.1.19",
"version": "2.1.20",
"private": false,
"description": "HollaEx Kit",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.19
2.1.20
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hollaex-kit",
"version": "2.1.19",
"version": "2.1.20",
"private": true,
"dependencies": {
"@ant-design/compatible": "1.0.5",
Expand Down
22 changes: 17 additions & 5 deletions web/src/containers/Admin/User/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,24 @@ const INITIAL_STATE = {
userImages: {},
loading: false,
userInformationList: [],
kycPluginName: 'kyc'
kycPluginName: 'kyc',
};

const Form = AdminHocForm('USER_REQUEST_FORM');

const TabPane = Tabs.TabPane;

class App extends Component {
state = INITIAL_STATE;
constructor(props) {
super(props);
const {
pluginNames: { kyc: kycPluginName },
} = this.props;
this.state = {
...INITIAL_STATE,
kycPluginName,
};
}

componentWillMount() {
this.getMyPlugins();
Expand All @@ -50,9 +59,11 @@ class App extends Component {
return requestMyPlugins(params)
.then((res) => {
if (res && res.data) {
const filterData = res.data.filter(data => data.type === "kyc");
const filterData = res.data.filter((data) => data.type === 'kyc');
if (filterData.length) {
this.setState({ kycPluginName: _get(filterData, '[0].name', 'kyc') });
this.setState({
kycPluginName: _get(filterData, '[0].name', 'kyc'),
});
}
}
})
Expand Down Expand Up @@ -206,7 +217,7 @@ class App extends Component {
userBalance,
loading,
userInformationList,
kycPluginName
kycPluginName,
} = this.state;
const { coins, constants, isConfigure, showConfigure } = this.props;
const renderBoolean = (value) => (
Expand Down Expand Up @@ -328,6 +339,7 @@ class App extends Component {
}

const mapStateToProps = (state) => ({
pluginNames: state.app.pluginNames,
coins: state.app.coins,
constants: state.app.constants,
});
Expand Down
7 changes: 6 additions & 1 deletion web/src/containers/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ class App extends Component {

componentDidMount() {
const initialized = getExchangeInitialized();
const { injected_values, injected_html } = this.props;
const {
injected_values,
injected_html,
plugins_injected_html,
} = this.props;

if (
initialized === 'false' ||
Expand All @@ -122,6 +126,7 @@ class App extends Component {

addElements(injected_values, 'body');
injectHTML(injected_html, 'body');
injectHTML(plugins_injected_html, 'body');
}

UNSAFE_componentWillReceiveProps(nextProps) {
Expand Down
1 change: 1 addition & 0 deletions web/src/containers/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const mapStateToProps = (store) => ({
pairsTradesFetched: store.orderbook.pairsTradesFetched,
injected_values: store.app.injected_values,
injected_html: store.app.injected_html,
plugins_injected_html: store.app.plugins_injected_html,
});

const mapDispatchToProps = (dispatch) => ({
Expand Down
28 changes: 24 additions & 4 deletions web/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,27 @@ const getConfigs = async () => {
captcha,
});

return [appConfigs, injected_values, injected_html];
const {
app: { plugins_injected_html },
} = store.getState();

return [appConfigs, injected_values, injected_html, plugins_injected_html];
};

const bootstrapApp = (appConfig, injected_values, injected_html) => {
const bootstrapApp = (
appConfig,
injected_values,
injected_html,
plugins_injected_html
) => {
const {
icons: {
dark: { EXCHANGE_FAV_ICON = '/favicon.ico' },
},
} = appConfig;
addElements(injected_values, 'head');
injectHTML(injected_html, 'head');
injectHTML(plugins_injected_html, 'head');
drawFavIcon(EXCHANGE_FAV_ICON);
// window.appConfig = { ...appConfig }
const {
Expand Down Expand Up @@ -267,8 +277,18 @@ const bootstrapApp = (appConfig, injected_values, injected_html) => {

const initialize = async () => {
try {
const [configs, injected_values, injected_html] = await getConfigs();
bootstrapApp(configs, injected_values, injected_html);
const [
configs,
injected_values,
injected_html,
plugins_injected_html,
] = await getConfigs();
bootstrapApp(
configs,
injected_values,
injected_html,
plugins_injected_html
);
} catch (err) {
console.error('Initialization failed!\n', err);
setTimeout(initialize, 3000);
Expand Down
28 changes: 19 additions & 9 deletions web/src/reducers/appReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ const INITIAL_STATE = {
wave: [],
enabledPlugins: [],
plugins: [],
pluginNames: {
bank: 'bank',
},
pluginNames: {},
helpdeskInfo: {
has_helpdesk: false,
helpdesk_endpoint: '',
Expand All @@ -167,6 +165,7 @@ const INITIAL_STATE = {
features: {},
injected_values: [],
injected_html: {},
plugins_injected_html: {},
};

const reducer = (state = INITIAL_STATE, { type, payload = {} }) => {
Expand Down Expand Up @@ -380,17 +379,16 @@ const reducer = (state = INITIAL_STATE, { type, payload = {} }) => {
...enabledPluginTypes,
]);

const { name: bank = 'bank' } =
payload.enabledPlugins.find(({ type }) => type === 'bank') || {};
const pluginNames = {};
payload.enabledPlugins.forEach(({ type, name }) => {
pluginNames[type ? type : name] = name;
});

return {
...state,
enabledPlugins,
plugins: payload.enabledPlugins,
pluginNames: {
...state.pluginNames,
bank,
},
pluginNames,
};
}
case SET_HELPDESK_INFO: {
Expand Down Expand Up @@ -431,6 +429,17 @@ const reducer = (state = INITIAL_STATE, { type, payload = {} }) => {
}
});

const plugins_injected_html = { head: '', body: '' };
allWebViews.forEach(({ injected_html = {} }) => {
Object.keys(plugins_injected_html).forEach((key) => {
if (injected_html && injected_html[key]) {
plugins_injected_html[key] = plugins_injected_html[key].concat(
injected_html[key]
);
}
});
});

const CLUSTERED_WEB_VIEWS = {};
allWebViews.forEach((plugin) => {
const { target } = plugin;
Expand Down Expand Up @@ -465,6 +474,7 @@ const reducer = (state = INITIAL_STATE, { type, payload = {} }) => {

return {
...state,
plugins_injected_html,
webViews: FILTERED_CLUSTERED_WEB_VIEWS,
targets: Object.entries(FILTERED_CLUSTERED_WEB_VIEWS).map(
([target]) => target
Expand Down

0 comments on commit 33fb59e

Please sign in to comment.