import { createSelector } from 'reselect';

const selectInAppDomain = () => (state) => state.get('inapp');
const selectAccountDomain = () => (state) => state.get('templates');

const makeSelectInApp = () => createSelector(selectInAppDomain(), (substate) => substate?.toJS());

const makeSelectAccount = () => createSelector(selectAccountDomain(), (substate) => substate.toJS());

const makeSelectBeePopupBuilderTokenFetching = () => createSelector(
  selectInAppDomain(),
  (substate) => substate.get('beePopupBuilderTokenFetching'),
);

const makeSelectBeePopupBuilderToken = () => createSelector(
  selectInAppDomain(),
  (substate) => substate.get('beePopupBuilderToken'),
);

const makeSelectGetTemplateDetailsInProgress = () => createSelector(
  selectInAppDomain(),
  (substate) => substate.get('getTemplateDetailsInProgress'),
);


export {
  makeSelectInApp,
  makeSelectAccount,
  makeSelectBeePopupBuilderTokenFetching,
  makeSelectBeePopupBuilderToken,
  makeSelectGetTemplateDetailsInProgress,
};
