diff --git a/server/api/swagger/swagger.yaml b/server/api/swagger/swagger.yaml index d7bb2b4807..ac81dbeca7 100644 --- a/server/api/swagger/swagger.yaml +++ b/server/api/swagger/swagger.yaml @@ -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 diff --git a/server/package.json b/server/package.json index 293e4df465..33f15314a7 100644 --- a/server/package.json +++ b/server/package.json @@ -1,5 +1,5 @@ { - "version": "2.1.19", + "version": "2.1.20", "private": false, "description": "HollaEx Kit", "keywords": [ diff --git a/version b/version index da35555aa1..9765fc457f 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.1.19 \ No newline at end of file +2.1.20 \ No newline at end of file diff --git a/web/package.json b/web/package.json index 0b49975a8e..d2e0bed00b 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "hollaex-kit", - "version": "2.1.19", + "version": "2.1.20", "private": true, "dependencies": { "@ant-design/compatible": "1.0.5", diff --git a/web/src/containers/Admin/User/index.js b/web/src/containers/Admin/User/index.js index ba1201d5aa..bf4f9b4049 100644 --- a/web/src/containers/Admin/User/index.js +++ b/web/src/containers/Admin/User/index.js @@ -25,7 +25,7 @@ const INITIAL_STATE = { userImages: {}, loading: false, userInformationList: [], - kycPluginName: 'kyc' + kycPluginName: 'kyc', }; const Form = AdminHocForm('USER_REQUEST_FORM'); @@ -33,7 +33,16 @@ 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(); @@ -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'), + }); } } }) @@ -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) => ( @@ -328,6 +339,7 @@ class App extends Component { } const mapStateToProps = (state) => ({ + pluginNames: state.app.pluginNames, coins: state.app.coins, constants: state.app.constants, }); diff --git a/web/src/containers/App/App.js b/web/src/containers/App/App.js index 25de94177a..bacf0d0552 100644 --- a/web/src/containers/App/App.js +++ b/web/src/containers/App/App.js @@ -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' || @@ -122,6 +126,7 @@ class App extends Component { addElements(injected_values, 'body'); injectHTML(injected_html, 'body'); + injectHTML(plugins_injected_html, 'body'); } UNSAFE_componentWillReceiveProps(nextProps) { diff --git a/web/src/containers/App/index.js b/web/src/containers/App/index.js index dfbc1f25c1..1abfd97da6 100644 --- a/web/src/containers/App/index.js +++ b/web/src/containers/App/index.js @@ -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) => ({ diff --git a/web/src/index.js b/web/src/index.js index 8a9f1763e8..16ca8efff3 100644 --- a/web/src/index.js +++ b/web/src/index.js @@ -228,10 +228,19 @@ 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' }, @@ -239,6 +248,7 @@ const bootstrapApp = (appConfig, injected_values, injected_html) => { } = appConfig; addElements(injected_values, 'head'); injectHTML(injected_html, 'head'); + injectHTML(plugins_injected_html, 'head'); drawFavIcon(EXCHANGE_FAV_ICON); // window.appConfig = { ...appConfig } const { @@ -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); diff --git a/web/src/reducers/appReducer.js b/web/src/reducers/appReducer.js index f39d319e09..2f57e7aa34 100644 --- a/web/src/reducers/appReducer.js +++ b/web/src/reducers/appReducer.js @@ -152,9 +152,7 @@ const INITIAL_STATE = { wave: [], enabledPlugins: [], plugins: [], - pluginNames: { - bank: 'bank', - }, + pluginNames: {}, helpdeskInfo: { has_helpdesk: false, helpdesk_endpoint: '', @@ -167,6 +165,7 @@ const INITIAL_STATE = { features: {}, injected_values: [], injected_html: {}, + plugins_injected_html: {}, }; const reducer = (state = INITIAL_STATE, { type, payload = {} }) => { @@ -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: { @@ -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; @@ -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