Source: index.js

  1. /**
  2. * @module react-cmf
  3. */
  4. import * as mock from './mock';
  5. // DEPRECATED APIs
  6. import action from './action';
  7. import actionCreator from './actionCreator';
  8. import actions from './actions';
  9. import App from './App';
  10. import bootstrap from './bootstrap';
  11. import cmfConnect from './cmfConnect';
  12. import cmfModule from './cmfModule';
  13. import component from './component';
  14. import ErrorBoundary from './components/ErrorBoundary/ErrorBoundary.component';
  15. import { CmfRegisteredSaga, Saga } from './components/Saga';
  16. import componentState from './componentState';
  17. import constants from './constant';
  18. import ConnectedDispatcher from './Dispatcher';
  19. import expression from './expression';
  20. import expressions from './expressions';
  21. import Inject from './Inject.component';
  22. import localStorage from './localStorage';
  23. import matchPath from './matchPath';
  24. import middlewares from './middlewares';
  25. import onError from './onError';
  26. import reducers from './reducers';
  27. import registry from './registry';
  28. import RegistryProvider from './RegistryProvider';
  29. import sagas from './sagas';
  30. import selectors from './selectors';
  31. import settings from './settings';
  32. import store from './store';
  33. import { useCMFContext } from './useContext';
  34. const Dispatcher = ConnectedDispatcher;
  35. const getErrorMiddleware = middlewares.error;
  36. const httpMiddleware = middlewares.http;
  37. function registerInternals(context) {
  38. actionCreator.register('cmf.saga.start', actions.saga.start, context);
  39. actionCreator.register('cmf.saga.stop', actions.saga.stop, context);
  40. expression.registerMany(expressions, context);
  41. }
  42. export {
  43. App,
  44. actions,
  45. cmfConnect,
  46. Dispatcher,
  47. ErrorBoundary,
  48. Inject,
  49. mock,
  50. sagas,
  51. selectors,
  52. // DEPRECATED
  53. componentState,
  54. getErrorMiddleware,
  55. httpMiddleware,
  56. reducers,
  57. registry,
  58. RegistryProvider,
  59. Saga,
  60. CmfRegisteredSaga,
  61. store,
  62. useCMFContext,
  63. };
  64. /**
  65. * API exported
  66. * @type {Object}
  67. * @example
  68. import cmf from '@talend/react-cmf';
  69. cmf.actionCreator.register(...);
  70. cmf.connect()(MyComponent);
  71. cmf.actions.collections.addOrReplace(...);
  72. * @example
  73. import { Inject } from '@talend/react-cmf';
  74. import { Dispatcher } from '@talend/react-cmf';
  75. * @see module:react-cmf/lib/api
  76. */
  77. export default {
  78. action,
  79. actions,
  80. actionCreator,
  81. bootstrap,
  82. component,
  83. connect: cmfConnect,
  84. constants,
  85. CmfRegisteredSaga,
  86. expression,
  87. expressions,
  88. middlewares,
  89. module: cmfModule,
  90. onError,
  91. registerInternals,
  92. registry,
  93. router: {
  94. matchPath,
  95. },
  96. Saga,
  97. saga: sagas,
  98. sagas,
  99. selectors,
  100. settings,
  101. localStorage,
  102. };