UNPKG

@documment/mmp.ui.augur

Version:

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.1.

1,008 lines (981 loc) 34.3 kB
import { Injectable, NgModule } from '@angular/core'; import { Store, combineReducers } from '@ngrx/store/index'; import { Observable as Observable$1 } from 'rxjs/Observable'; import { DateRangeFilters, DateRangeType, GoalCreateRequest, GoalType, OAuthRequest, OAuthResponse } from '@documment/mmp.core/index'; import { Api, ApiOptions, GoalQueryRequest, GoalsFiltering, InstitutionWarehouse, Logger, OAuthCredentials, TransactionsFiltering, UserSession } from '@documment/mmp.ui.data/index'; import { chain, cloneDeep, filter, find, first, get, intersection, isEqual, join, some } from 'lodash/index'; import moment from 'moment'; var InstitutionListBuilder = (function () { function InstitutionListBuilder() { } /** * @param {?} institutions * @param {?} selectedIds * @return {?} */ InstitutionListBuilder.prototype.build = function (institutions, selectedIds) { var /** @type {?} */ institutionIds = []; var /** @type {?} */ activeIds = chain(institutions).filter(function (institution) { return institution.affiliations.me.isActive; }).map('id').value(); if (some(selectedIds)) { institutionIds = intersection(selectedIds, activeIds); } else { // use all active institutions institutionIds = activeIds; } return institutionIds; }; return InstitutionListBuilder; }()); InstitutionListBuilder.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ InstitutionListBuilder.ctorParameters = function () { return []; }; var GoalStrategyRefresh = 'strategy.goal.refresh.action'; var UserStrategyInitialize = '@ngrx/store/init'; var UserStrategyRefresh = 'strategy.user.refresh.action'; var UserStrategy = (function () { /** * @param {?=} params */ function UserStrategy(params) { if (params === void 0) { params = null; } this.userId = get(params, 'userId', null); this.institutionId = get(params, 'institutionId', null); this.authorization = new OAuthResponse(get(params, 'authorization', null)); } /** * @param {?} userSettings * @return {?} */ UserStrategy.prototype.equals = function (userSettings) { return isEqual(this, userSettings); }; /** * @return {?} */ UserStrategy.prototype.clone = function () { return new UserStrategy(cloneDeep(this)); }; return UserStrategy; }()); var UserStrategizer = (function () { /** * @param {?} store */ function UserStrategizer(store) { this.store = store; } /** * @return {?} */ UserStrategizer.prototype.state = function () { var /** @type {?} */ userStrategy; this.store .select(function (store) { return store.augur.strategy.user; }) .take(1) .subscribe(function (state) { return userStrategy = state; }); return (userStrategy ? userStrategy.clone() : new UserStrategy()); }; /** * @param {?} userStrategy * @return {?} */ UserStrategizer.prototype.refresh = function (userStrategy) { this.store.dispatch({ type: UserStrategyRefresh, payload: userStrategy }); }; /** * @return {?} */ UserStrategizer.prototype.watch = function () { var _this = this; var /** @type {?} */ observable = Observable$1.create(function (observer) { _this.store.select(function (store) { return store.augur.strategy.user; }) .subscribe(function (userStrategy) { observer.next(userStrategy.clone()); }); }); return observable; }; return UserStrategizer; }()); UserStrategizer.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ UserStrategizer.ctorParameters = function () { return [ { type: Store, }, ]; }; var InstitutionSelector = (function () { function InstitutionSelector() { } /** * @param {?} institutionIds * @param {?} selectedInstitutionId * @return {?} */ InstitutionSelector.prototype.select = function (institutionIds, selectedInstitutionId) { var /** @type {?} */ institutionId = find(institutionIds, function (candidateInstitutionId) { return candidateInstitutionId === selectedInstitutionId; }); if (!institutionId) { institutionId = first(institutionIds); } return institutionId; }; return InstitutionSelector; }()); InstitutionSelector.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ InstitutionSelector.ctorParameters = function () { return []; }; var Authorizer = (function () { /** * @param {?} api * @param {?} oAuthCredentials * @param {?} userStrategizer * @param {?} institutionListBuilder * @param {?} institutionSelector * @param {?} logger */ function Authorizer(api, oAuthCredentials, userStrategizer, institutionListBuilder, institutionSelector, logger) { this.api = api; this.oAuthCredentials = oAuthCredentials; this.userStrategizer = userStrategizer; this.institutionListBuilder = institutionListBuilder; this.institutionSelector = institutionSelector; this.logger = logger; } /** * @return {?} */ Authorizer.prototype.run = function () { var _this = this; return Observable$1.create(function (observer) { var /** @type {?} */ userStrategy = _this.userStrategizer.state(); var /** @type {?} */ authorization = userStrategy.authorization; if (authorization.accessToken) { _this.oAuthCredentials.set(authorization.accessToken, authorization.tokenType); _this.logger.info('authorizer set authentication token for user ID {0}', userStrategy.userId); _this.api.users.me() .subscribe(function (user) { _this.api.institutions.all() .subscribe(function (institutions) { _this.refreshUserStratgey(authorization, user, institutions); observer.next(user); }, function (reaction) { observer.error(reaction); }); }, function (reaction) { observer.error(reaction); }); } else { _this.logger.info('authorizer did not find saved authentication token ..'); observer.next(null); } }); }; /** * @param {?} login * @param {?=} options * @return {?} */ Authorizer.prototype.login = function (login, options) { var _this = this; if (options === void 0) { options = null; } var /** @type {?} */ params = new OAuthRequest({ username: login.email, email: login.email, password: login.password, grantType: 'password', clientId: 'documment', clientSecret: 'documment' }); return Observable$1.create(function (observer) { _this.api.auth.token(params, options) .subscribe(function (oAuthResponse) { _this.oAuthCredentials.set(oAuthResponse.accessToken, oAuthResponse.tokenType); _this.logger.info('authorizer received authentication token for user {0}', login.email); _this.api.users.me() .subscribe(function (user) { _this.api.institutions.all() .subscribe(function (institutions) { _this.refreshUserStratgey(oAuthResponse, user, institutions); observer.next(user); }, function (reaction) { observer.error(reaction); }); }, function (reaction) { observer.error(reaction); }); }, function (reaction) { observer.error(reaction); }); }); }; /** * @return {?} */ Authorizer.prototype.logout = function () { var _this = this; return Observable$1.create(function (observer) { _this.api.auth.logout(_this.oAuthCredentials.accessToken, _this.oAuthCredentials.tokenType) .subscribe(function () { var /** @type {?} */ userStrategy = _this.userStrategizer.state(); var /** @type {?} */ userId = userStrategy.userId; userStrategy.userId = null; userStrategy.authorization = new OAuthResponse(); _this.userStrategizer.refresh(userStrategy); _this.oAuthCredentials.set(null, null); _this.logger.info('authorizer logged out user ID {0}', userId); observer.next(); }); }); }; /** * @param {?} oAuthResponse * @param {?} user * @param {?} institutions * @return {?} */ Authorizer.prototype.refreshUserStratgey = function (oAuthResponse, user, institutions) { var /** @type {?} */ userStrategy = this.userStrategizer.state(); var /** @type {?} */ institutionId = userStrategy.institutionId; var /** @type {?} */ institutionIds = this.institutionListBuilder.build(institutions, [institutionId]); userStrategy.authorization = oAuthResponse; userStrategy.userId = user.id; userStrategy.institutionId = this.institutionSelector.select(institutionIds, institutionId); this.logger.info('authorizer refreshing user strategy for user ID {0} and institution ID {1}', userStrategy.userId, userStrategy.institutionId); this.userStrategizer.refresh(userStrategy); }; return Authorizer; }()); Authorizer.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ Authorizer.ctorParameters = function () { return [ { type: Api, }, { type: OAuthCredentials, }, { type: UserStrategizer, }, { type: InstitutionListBuilder, }, { type: InstitutionSelector, }, { type: Logger, }, ]; }; var AuthorizationModule = (function () { function AuthorizationModule() { } return AuthorizationModule; }()); AuthorizationModule.decorators = [ { type: NgModule, args: [{ declarations: [], imports: [], providers: [ Authorizer ], exports: [] },] }, ]; /** * @nocollapse */ AuthorizationModule.ctorParameters = function () { return []; }; var GoalDataManager = (function () { /** * @param {?} api * @param {?} goalsFiltering * @param {?} userStrategizer * @param {?} logger */ function GoalDataManager(api, goalsFiltering, userStrategizer, logger) { this.api = api; this.goalsFiltering = goalsFiltering; this.userStrategizer = userStrategizer; this.logger = logger; } /** * @return {?} */ GoalDataManager.prototype.run = function () { var _this = this; this.logger.info('goal data manager running ..'); this.goalsFiltering.watch() .subscribe(function () { _this.load().subscribe(); }); this.userStrategizer.watch() .subscribe(function () { _this.load().subscribe(); }); }; /** * @return {?} */ GoalDataManager.prototype.create = function () { var _this = this; var /** @type {?} */ observable = Observable$1.create(function (observer) { var /** @type {?} */ userStrategy = _this.userStrategizer.state(); var /** @type {?} */ institutionId = userStrategy.institutionId; var /** @type {?} */ params = new GoalCreateRequest({ institutionId: institutionId, type: GoalType.MmmpRic }); _this.api.goals.create(params) .subscribe(function (goal) { _this.logger.log('goal data manager created goal {0} for institution {1}', goal.id, institutionId); observer.next(goal); }); }); return observable; }; /** * @param {?=} options * @return {?} */ GoalDataManager.prototype.load = function (options) { var _this = this; if (options === void 0) { options = new ApiOptions(); } return Observable$1.create(function (observer) { var /** @type {?} */ goalsFilter = _this.goalsFiltering.state(); var /** @type {?} */ institutionIds = goalsFilter.institutionIds; var /** @type {?} */ userStrategy = _this.userStrategizer.state(); var /** @type {?} */ isAuthorized = (userStrategy.authorization.accessToken ? true : false); if (isAuthorized && some(institutionIds)) { _this.logger.log('goal data manager loading goals for institutions [{0}]', join(institutionIds, ', ')); var /** @type {?} */ goalQueryRequest = _this.buildRequest(goalsFilter); _this.api.goals.findByInstitutions(institutionIds, goalQueryRequest, options) .subscribe(function (goals) { observer.next(goals); }); } else { observer.next([]); } }); }; /** * @param {?} goalId * @return {?} */ GoalDataManager.prototype.remove = function (goalId) { var _this = this; return Observable$1.create(function (observer) { _this.api.goals.delete(goalId) .subscribe(function () { _this.logger.log('goals data manager removed goal {0}', goalId); _this.load() .subscribe(function () { observer.next(); }); }); }); }; /** * @param {?} goalsFilter * @return {?} */ GoalDataManager.prototype.buildRequest = function (goalsFilter) { var /** @type {?} */ range = goalsFilter.range; var /** @type {?} */ status = goalsFilter.status; var /** @type {?} */ sort = goalsFilter.sort; var /** @type {?} */ statusApiQuery = 0x0; if (status.anyInProgress) { statusApiQuery += 0x01; } if (status.anyCompleted) { statusApiQuery += 0x02; } if (status.anySubmitted) { statusApiQuery += 0x04; } if (status.anyNotQualified) { statusApiQuery += 0x08; } var /** @type {?} */ goalQueryRequest = new GoalQueryRequest({ rangeStartDate: range.rangeStart, rangeEndDate: range.rangeEnd, statusMask: statusApiQuery, sortProperty: sort.property, sortDirection: sort.direction }); return goalQueryRequest; }; return GoalDataManager; }()); GoalDataManager.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ GoalDataManager.ctorParameters = function () { return [ { type: Api, }, { type: GoalsFiltering, }, { type: UserStrategizer, }, { type: Logger, }, ]; }; var InstitutionDataManager = (function () { /** * @param {?} api * @param {?} institutionWarehouse * @param {?} userStrategizer * @param {?} institutionListBuilder * @param {?} institutionSelector * @param {?} logger */ function InstitutionDataManager(api, institutionWarehouse, userStrategizer, institutionListBuilder, institutionSelector, logger) { this.api = api; this.institutionWarehouse = institutionWarehouse; this.userStrategizer = userStrategizer; this.institutionListBuilder = institutionListBuilder; this.institutionSelector = institutionSelector; this.logger = logger; } /** * @return {?} */ InstitutionDataManager.prototype.run = function () { var _this = this; this.logger.info('institution data manager running ..'); this.institutionWarehouse.watchAll() .subscribe(function (institutions) { _this.api.users.me() .subscribe(function (user) { _this.logger.log('institution data manager refreshed "me"'); _this.refreshUserStratgey(user, institutions); }, function (reaction) { _this.logger.warn('institution data manager got error refreshing "me": {0}', reaction.message); }); }); }; /** * @param {?} params * @param {?=} options * @return {?} */ InstitutionDataManager.prototype.create = function (params, options) { var _this = this; if (options === void 0) { options = new ApiOptions(); } var /** @type {?} */ observable = Observable$1.create(function (observer) { _this.api.institutions.create(params, options) .subscribe(function (institution) { _this.logger.info('institution data manager created institution {0} with ID {1}', institution.name, institution.id); // loading all will trigger 'me' to be refreshed _this.load(options) .subscribe(function () { observer.next(institution); }, function (reaction) { observer.error(reaction); }); }, function (reaction) { _this.logger.warn('institution data manager got error creating institution {0}: {1}', params.name, reaction.message); observer.error(reaction); }); }); return observable; }; /** * @param {?=} options * @return {?} */ InstitutionDataManager.prototype.load = function (options) { var _this = this; if (options === void 0) { options = new ApiOptions(); } var /** @type {?} */ observable = Observable$1.create(function (observer) { _this.api.institutions.all(options) .subscribe(function (institutions) { observer.next(institutions); }, function (reaction) { _this.logger.warn('institution data manager got error loading institutions: {0}', reaction.message); observer.error(reaction); }); }); return observable; }; /** * @param {?} institution * @return {?} */ InstitutionDataManager.prototype.select = function (institution) { var /** @type {?} */ userStratgey = this.userStrategizer.state(); if (institution.id !== userStratgey.institutionId) { this.logger.info('institution {0} was selected from {1} via the institution data manager', userStratgey.institutionId, institution.id); userStratgey.institutionId = institution.id; this.userStrategizer.refresh(userStratgey); } }; /** * @param {?} user * @param {?} institutions * @return {?} */ InstitutionDataManager.prototype.refreshUserStratgey = function (user, institutions) { var /** @type {?} */ userStrategy = this.userStrategizer.state(); var /** @type {?} */ institutionId = userStrategy.institutionId; var /** @type {?} */ institutionIds = this.institutionListBuilder.build(institutions, [institutionId]); userStrategy.userId = user.id; userStrategy.institutionId = this.institutionSelector.select(institutionIds, institutionId); this.logger.info('institution data manager refreshing user strategy for user ID {0} and institution ID {1}', userStrategy.userId, userStrategy.institutionId); this.userStrategizer.refresh(userStrategy); }; return InstitutionDataManager; }()); InstitutionDataManager.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ InstitutionDataManager.ctorParameters = function () { return [ { type: Api, }, { type: InstitutionWarehouse, }, { type: UserStrategizer, }, { type: InstitutionListBuilder, }, { type: InstitutionSelector, }, { type: Logger, }, ]; }; var DataModule = (function () { function DataModule() { } return DataModule; }()); DataModule.decorators = [ { type: NgModule, args: [{ declarations: [], imports: [], providers: [ GoalDataManager, InstitutionDataManager ], exports: [] },] }, ]; /** * @nocollapse */ DataModule.ctorParameters = function () { return []; }; var FiltersConfig = (function () { function FiltersConfig() { this.singleInstitution = true; this.type = DateRangeType.TodayOnly; this.goalSortProperty = 'status'; this.goalSortDirection = 'asc'; } return FiltersConfig; }()); FiltersConfig.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ FiltersConfig.ctorParameters = function () { return []; }; var FilteringManager = (function () { /** * @param {?} institutionWarehouse * @param {?} goalsFiltering * @param {?} transactionsFiltering * @param {?} userSession * @param {?} userStrategizer * @param {?} institutionListBuilder * @param {?} filtersConfig * @param {?} logger */ function FilteringManager(institutionWarehouse, goalsFiltering, transactionsFiltering, userSession, userStrategizer, institutionListBuilder, filtersConfig, logger) { this.institutionWarehouse = institutionWarehouse; this.goalsFiltering = goalsFiltering; this.transactionsFiltering = transactionsFiltering; this.userSession = userSession; this.userStrategizer = userStrategizer; this.institutionListBuilder = institutionListBuilder; this.filtersConfig = filtersConfig; this.logger = logger; } /** * @return {?} */ FilteringManager.prototype.run = function () { var _this = this; var /** @type {?} */ observable = Observable$1.create(function (observer) { _this.logger.info('filtering manager running ..'); _this.monitor(); observer.next(); }); return observable; }; /** * @return {?} */ FilteringManager.prototype.monitor = function () { var _this = this; this.userStrategizer.watch() .subscribe(function (userStrategy) { var /** @type {?} */ institutions = _this.institutionWarehouse.state(); if (_this.canBuildFilters(userStrategy)) { _this.buildGoalFilters(userStrategy, institutions); } }); this.userSession.watch() .subscribe(function (sessionUser) { var /** @type {?} */ affiliations = filter(sessionUser.user.persona.affiliations, { 'isActive': true }); }); this.institutionWarehouse.watchAll() .subscribe(function (institutions) { var /** @type {?} */ userStrategy = _this.userStrategizer.state(); if (_this.canBuildFilters(userStrategy)) { _this.buildGoalFilters(userStrategy, institutions); } }); }; /** * @param {?} userStrategy * @param {?} institutions * @return {?} */ FilteringManager.prototype.buildGoalFilters = function (userStrategy, institutions) { var /** @type {?} */ goalsFilter = this.goalsFiltering.state(); var /** @type {?} */ institutionIds = []; if (this.filtersConfig.singleInstitution) { var /** @type {?} */ selectedInstitutionId = userStrategy.institutionId; institutionIds = this.institutionListBuilder.build(institutions, [selectedInstitutionId]); } else { var /** @type {?} */ filterInstitutionIds = get(goalsFilter, 'institutionIds', []); institutionIds = this.institutionListBuilder.build(institutions, filterInstitutionIds); } var /** @type {?} */ sortProperty = (goalsFilter.sort.property || this.filtersConfig.goalSortProperty); var /** @type {?} */ sortDirection = (goalsFilter.sort.direction || this.filtersConfig.goalSortDirection); goalsFilter.institutionIds = institutionIds; goalsFilter.sort.property = sortProperty; goalsFilter.sort.direction = sortDirection; this.logger.debug('filtering manager rebuilt goal filters: institution IDs: {0}, sort property: {1}, sort direction: {2}', join([institutionIds], ', '), sortProperty, sortDirection); this.goalsFiltering.refresh(goalsFilter); }; /** * @param {?} userStrategy * @return {?} */ FilteringManager.prototype.canBuildFilters = function (userStrategy) { return (userStrategy.authorization.accessToken ? true : false); }; return FilteringManager; }()); FilteringManager.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ FilteringManager.ctorParameters = function () { return [ { type: InstitutionWarehouse, }, { type: GoalsFiltering, }, { type: TransactionsFiltering, }, { type: UserSession, }, { type: UserStrategizer, }, { type: InstitutionListBuilder, }, { type: FiltersConfig, }, { type: Logger, }, ]; }; var FilteringModule = (function () { function FilteringModule() { } return FilteringModule; }()); FilteringModule.decorators = [ { type: NgModule, args: [{ declarations: [], imports: [], providers: [ FilteringManager ], exports: [] },] }, ]; /** * @nocollapse */ FilteringModule.ctorParameters = function () { return []; }; var DateRangeFilterBuilder = (function () { /** * @param {?} filtersConfig */ function DateRangeFilterBuilder(filtersConfig) { this.filtersConfig = filtersConfig; } /** * @param {?=} dateRangeFilters * @return {?} */ DateRangeFilterBuilder.prototype.build = function (dateRangeFilters) { if (dateRangeFilters === void 0) { dateRangeFilters = null; } var /** @type {?} */ type = get(dateRangeFilters, 'type', this.filtersConfig.type); var /** @type {?} */ rangeStart = get(dateRangeFilters, 'rangeStart', ''); var /** @type {?} */ rangeEnd = get(dateRangeFilters, 'rangeEnd', ''); if (type === DateRangeType.TodayOnly) { rangeStart = this.today(); rangeEnd = this.today(); } else if (type === DateRangeType.Last7Days) { rangeStart = this.weekAgo(); rangeEnd = this.today(); } return new DateRangeFilters({ type: type, rangeStart: rangeStart, rangeEnd: rangeEnd }); }; /** * @return {?} */ DateRangeFilterBuilder.prototype.today = function () { var /** @type {?} */ date = moment(); return date.format('YYYY-MM-DD'); }; /** * @return {?} */ DateRangeFilterBuilder.prototype.weekAgo = function () { var /** @type {?} */ date = moment().subtract(7, 'days'); return date.format('YYYY-MM-DD'); }; return DateRangeFilterBuilder; }()); DateRangeFilterBuilder.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ DateRangeFilterBuilder.ctorParameters = function () { return [ { type: FiltersConfig, }, ]; }; var GoalStrategy = (function () { /** * @param {?=} params */ function GoalStrategy(params) { if (params === void 0) { params = null; } this.showPhotoIds = get(params, 'showPhotoIds', true); this.showSignatures = get(params, 'showSignatures', true); this.showScanHelper = get(params, 'showScanHelper', false); } /** * @param {?} goalSettings * @return {?} */ GoalStrategy.prototype.equals = function (goalSettings) { return isEqual(this, goalSettings); }; /** * @return {?} */ GoalStrategy.prototype.clone = function () { return new GoalStrategy(cloneDeep(this)); }; return GoalStrategy; }()); var GoalStrategizer = (function () { /** * @param {?} store */ function GoalStrategizer(store) { this.store = store; } /** * @return {?} */ GoalStrategizer.prototype.state = function () { var /** @type {?} */ goalStrategy; this.store .select(function (store) { return store.augur.strategy.goal; }) .take(1) .subscribe(function (state) { return goalStrategy = state; }); return (goalStrategy ? goalStrategy.clone() : new GoalStrategy()); }; /** * @param {?} goalStrategy * @return {?} */ GoalStrategizer.prototype.refresh = function (goalStrategy) { this.store.dispatch({ type: GoalStrategyRefresh, payload: goalStrategy }); }; /** * @return {?} */ GoalStrategizer.prototype.watch = function () { var _this = this; var /** @type {?} */ observable = Observable$1.create(function (observer) { _this.store.select(function (store) { return store.augur.strategy.goal; }) .subscribe(function (goalStrategy) { observer.next(goalStrategy.clone()); }); }); return observable; }; return GoalStrategizer; }()); GoalStrategizer.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ GoalStrategizer.ctorParameters = function () { return [ { type: Store, }, ]; }; var GoalStrategyInitializer = (function () { function GoalStrategyInitializer() { } /** * @param {?} state * @param {?} action * @return {?} */ GoalStrategyInitializer.handle = function (state, action) { if (state instanceof GoalStrategy) { return state.clone(); } return new GoalStrategy(state); }; return GoalStrategyInitializer; }()); var GoalStrategyRefresher = (function () { function GoalStrategyRefresher() { } /** * @param {?} state * @param {?} action * @return {?} */ GoalStrategyRefresher.handle = function (state, action) { if (!state.equals(action.payload)) { return action.payload.clone(); } return state; }; return GoalStrategyRefresher; }()); var GoalStrategyReducer = function (state, action) { switch (action.type) { case UserStrategyInitialize: return GoalStrategyInitializer.handle(state, action); case GoalStrategyRefresh: return GoalStrategyRefresher.handle(state, action); } return state; }; var UserStrategyInitializer = (function () { function UserStrategyInitializer() { } /** * @param {?} state * @param {?} action * @return {?} */ UserStrategyInitializer.handle = function (state, action) { if (state instanceof UserStrategy) { return state.clone(); } return new UserStrategy(state); }; return UserStrategyInitializer; }()); var UserStrategyRefresher = (function () { function UserStrategyRefresher() { } /** * @param {?} state * @param {?} action * @return {?} */ UserStrategyRefresher.handle = function (state, action) { if (!state.equals(action.payload)) { return action.payload.clone(); } return state; }; return UserStrategyRefresher; }()); var UserStrategyReducer = function (state, action) { switch (action.type) { case UserStrategyInitialize: return UserStrategyInitializer.handle(state, action); case UserStrategyRefresh: return UserStrategyRefresher.handle(state, action); } return state; }; var StrategyModule = (function () { function StrategyModule() { } /** * @param {?} state * @param {?} action * @return {?} */ StrategyModule.reducer = function (state, action) { var /** @type {?} */ reducers = { goal: GoalStrategyReducer, user: UserStrategyReducer }; var /** @type {?} */ reducer = combineReducers(reducers); return reducer(state, action); }; return StrategyModule; }()); StrategyModule.decorators = [ { type: NgModule, args: [{ declarations: [], imports: [], providers: [ GoalStrategizer, UserStrategizer ], exports: [] },] }, ]; /** * @nocollapse */ StrategyModule.ctorParameters = function () { return []; }; var AugurModule = (function () { function AugurModule() { } /** * @param {?} state * @param {?} action * @return {?} */ AugurModule.reducer = function (state, action) { var /** @type {?} */ reducers = { strategy: StrategyModule.reducer }; var /** @type {?} */ reducer = combineReducers(reducers); return reducer(state, action); }; return AugurModule; }()); AugurModule.decorators = [ { type: NgModule, args: [{ declarations: [], imports: [ AuthorizationModule, DataModule, FilteringModule, StrategyModule ], providers: [ Authorizer, GoalDataManager, FilteringManager, DateRangeFilterBuilder, InstitutionListBuilder, FiltersConfig, GoalStrategizer, UserStrategizer, InstitutionSelector ], exports: [] },] }, ]; /** * @nocollapse */ AugurModule.ctorParameters = function () { return []; }; var AugurDataState = (function () { function AugurDataState() { } return AugurDataState; }()); export { AugurModule, AugurDataState, Authorizer, GoalDataManager, InstitutionDataManager, FilteringManager, DateRangeFilterBuilder, FiltersConfig, GoalStrategy, UserStrategy, GoalStrategizer, UserStrategizer };