2023-02-18 12:40:37 +03:00
|
|
|
import type Bottle from 'bottlejs';
|
2023-02-18 13:11:01 +03:00
|
|
|
import { prop } from 'ramda';
|
2023-07-23 19:30:59 +03:00
|
|
|
import type { ConnectDecorator } from '../../container';
|
2020-11-28 11:58:05 +03:00
|
|
|
import { DomainSelector } from '../DomainSelector';
|
2021-08-20 18:30:07 +03:00
|
|
|
import { ManageDomains } from '../ManageDomains';
|
2021-08-21 18:53:06 +03:00
|
|
|
import { editDomainRedirects } from '../reducers/domainRedirects';
|
2023-02-18 13:11:01 +03:00
|
|
|
import { domainsListReducerCreator } from '../reducers/domainsList';
|
2020-11-25 23:05:27 +03:00
|
|
|
|
2023-02-18 13:37:49 +03:00
|
|
|
export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
2020-11-25 23:05:27 +03:00
|
|
|
// Components
|
2020-11-28 11:58:05 +03:00
|
|
|
bottle.serviceFactory('DomainSelector', () => DomainSelector);
|
2022-03-26 14:17:42 +03:00
|
|
|
bottle.decorator('DomainSelector', connect(['domainsList'], ['listDomains']));
|
2020-11-25 23:05:27 +03:00
|
|
|
|
2021-08-20 18:30:07 +03:00
|
|
|
bottle.serviceFactory('ManageDomains', () => ManageDomains);
|
2021-08-21 18:53:06 +03:00
|
|
|
bottle.decorator('ManageDomains', connect(
|
2023-07-24 19:03:59 +03:00
|
|
|
['domainsList'],
|
2022-03-26 14:17:42 +03:00
|
|
|
['listDomains', 'filterDomains', 'editDomainRedirects', 'checkDomainHealth'],
|
2021-08-21 18:53:06 +03:00
|
|
|
));
|
2021-08-20 18:30:07 +03:00
|
|
|
|
2022-11-02 22:40:14 +03:00
|
|
|
// Reducer
|
2022-11-04 20:56:34 +03:00
|
|
|
bottle.serviceFactory(
|
|
|
|
'domainsListReducerCreator',
|
|
|
|
domainsListReducerCreator,
|
2023-07-26 21:04:50 +03:00
|
|
|
'apiClientFactory',
|
2022-11-04 20:56:34 +03:00
|
|
|
'editDomainRedirects',
|
|
|
|
);
|
|
|
|
bottle.serviceFactory('domainsListReducer', prop('reducer'), 'domainsListReducerCreator');
|
2022-11-02 22:40:14 +03:00
|
|
|
|
2020-11-25 23:05:27 +03:00
|
|
|
// Actions
|
2022-11-04 20:56:34 +03:00
|
|
|
bottle.serviceFactory('listDomains', prop('listDomains'), 'domainsListReducerCreator');
|
|
|
|
bottle.serviceFactory('filterDomains', prop('filterDomains'), 'domainsListReducerCreator');
|
2023-07-26 21:04:50 +03:00
|
|
|
bottle.serviceFactory('editDomainRedirects', editDomainRedirects, 'apiClientFactory');
|
2022-11-04 20:56:34 +03:00
|
|
|
bottle.serviceFactory('checkDomainHealth', prop('checkDomainHealth'), 'domainsListReducerCreator');
|
2020-11-25 23:05:27 +03:00
|
|
|
};
|