import { connect } from 'react-redux';
import { compose } from 'redux';

import { withTranslation } from '@waldur/i18n';
import { showComponentsList } from '@waldur/marketplace/common/registry';

import { removeOfferingComponent, removeOfferingQuotas } from '../store/actions';
import { getType, getOfferingComponents } from '../store/selectors';
import { AccountingStep } from './AccountingStep';

const mapStateToProps = state => {
  const type = getType(state);
  const showComponents = type && showComponentsList(type);
  const builtinComponents = type && getOfferingComponents(state, type);
  return {showComponents, type, builtinComponents};
};

const mapStateToDispatch = {
  removeOfferingComponent,
  removeOfferingQuotas,
};

const connector = compose(connect(mapStateToProps, mapStateToDispatch), withTranslation);

export const AccountingStepContainer = connector(AccountingStep);

import { connect } from 'react-redux';
import { compose } from 'redux';

import { withTranslation } from '@waldur/i18n';
import { showComponentsList } from '@waldur/marketplace/common/registry';

import { removeOfferingComponent, removeOfferingQuotas } from '../store/actions';
import { getType, getOfferingComponents } from '../store/selectors';
import { AccountingStep } from './AccountingStep';

const mapStateToProps = state => {
  const type = getType(state);
  const showComponents = type && showComponentsList(type);
  const builtinComponents = getOfferingComponents(state, type);
  return {showComponents, type, builtinComponents};
};

const mapStateToDispatch = {
  removeOfferingComponent,
  removeOfferingQuotas,
};

const connector = compose(connect(mapStateToProps, mapStateToDispatch), withTranslation);

export const AccountingStepContainer = connector(AccountingStep);

--- 
+++ 
@@ -11,7 +11,7 @@
 const mapStateToProps = state => {
   const type = getType(state);
   const showComponents = type && showComponentsList(type);
-  const builtinComponents = getOfferingComponents(state, type);
+  const builtinComponents = type && getOfferingComponents(state, type);
   return {showComponents, type, builtinComponents};
 };
 
Fix marketplace offering creation form.

Skip components selector unless offering type is selected.
