You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actions.web.js 649B

12345678910111213141516171819202122232425
  1. // @flow
  2. import { openDialog } from '../base/dialog';
  3. import { PremiumFeatureDialog } from './components';
  4. import { isFeatureDisabled } from './functions';
  5. /**
  6. * Shows a dialog prompting users to upgrade, if requested feature is disabled.
  7. *
  8. * @param {string} feature - The feature to check availability for.
  9. *
  10. * @returns {Function}
  11. */
  12. export function maybeShowPremiumFeatureDialog(feature: string) {
  13. return function(dispatch: Function, getState: Function) {
  14. if (isFeatureDisabled(getState(), feature)) {
  15. dispatch(openDialog(PremiumFeatureDialog));
  16. return true;
  17. }
  18. return false;
  19. };
  20. }