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jB,OAAI2D,WAAY3D,GACPZ,KAAK+D,MAAMM,ODpCe1B,OACrCY,MAAeF,EAA0BjE,GAAUA,EAAMqE,SAASd,ICmCrC2B,CAAoC1D,IAEtDZ,KAAK+D,MAAMM,ODpCiBG,KACvCjB,QAAelD,EAAwBjB,GAC9BA,EAAMqF,KAAMC,GAASA,EAAKF,OAASA,ICkCfF,CAAsC1D,IAInE+D,2BAA2BnG,GACzBwB,KAAK+D,MAAMnC,SAASzC,KAA6B,CAAEX,sBAGrDgF,6BACE,OAAOxD,KAAK+D,MAAM7D,QAAKmE,MAAOC,IAGhCxD,uBACE,OAAOd,KAAK+D,MAAM7D,QAAKmE,MAAOC,IAGhCM,0BACE5E,KAAK+D,MAAMnC,SAASzC,QAGtB0E,sBACE,OAAO7D,KAAK+D,MAAM7D,QAAKmE,MAAOC,IAGhCO,gCACE7E,KAAK+D,MAAMnC,SAASzC,QAGtB2F,yBAAyBtD,GACvBxB,KAAK+D,MAAMnC,SAASzC,KAAoC,CAAEqC,WAG5DsC,yBACE,OAAO9D,KAAK+D,MAAM7D,QAAKmE,MAAOC,IAGhCS,4BACE/E,KAAK+D,MAAMnC,SAASzC,QAGtBsC,sBAAsBb,EAAkBc,EAAoBC,GAC1D3B,KAAK+D,MAAMnC,SAASzC,KAAiC,CAAEyB,WAAUc,aAAYC,kBAG/EqD,SAASrG,GACPqB,KAAK+D,MAAMnC,SAASzC,KAAoBR,kDAhF/BqD,GAA2BH,wCAA3BG,EAA2BF,QAA3BE,EAA2B,YAA3BA,GAAb","names":["ClassroomCourseActions","FetchClassroomCourses","createAction","props","FetchClassroomCourse","FetchClassroomSchedule","FetchInstructorCourses","SaveClassroomReview","SaveClassroomFeedback","CheckParticipantIdentity","DecreaseScheduleCount","AddClassroomCourses","AddClassroomCourse","AddClassroomSchedule","RemoveClassroomSchedule","AddInstructorCourses","AddSelectedCourse","RemoveSelectedClassroomCourse","AddTotalCount","AddCourseReview","AddClassroomReview","AddCourseFeedback","AddClassroomFeedback","AddParticipantIdentity","RemoveParticipantIdentity","AddError","Empty","classroomCourseAdapter","createEntityAdapter","classroomFeatureKey","initialState","selectedCourseId","schedules","instructorCourses","error","totalCount","filter","ClassroomCourseFilter","participantIdentity","_classroomCourseReducer","createReducer","on","fromAction","state","courses","course","Object","selectedDigitalCourseId","participant","action","ClassroomCourseEffects","constructor","actions$","classroomCourseApiService","effectHelperService","this","createEffect","pipe","ofType","mergeMap","getAllClassroomCourse","map","total","handleSuccess","items","handleError","switchMap","courseId","getClassroomCourse","getAvailableSchedule","instructorId","fetchInstructorCourses","payload","sendCourseReview","review","AlertMessageType","sendCourseFeedback","feedback","checkPartnerIdentity","phone","decreaseScheduleCount","scheduleId","numOfBooking","dispatch","i0","factory","ClassroomStoreModule","ClassroomCourseStoreService","ClassroomCourseResolver","imports","StoreModule","classroomCourseReducer","EffectsModule","classroomCourseStoreService","metaService","resolve","route","params","id","queryParams","classroomCourseOGMetaTag","fetchClassroomCourse","first","Boolean","keys","length","of","selectAll","getClassroomCourseState","createFeatureSelector","createSelector","getSelectedClassroomCourse","entities","schedule","status","isSignUpDateExpired","getInstructorCourse","getParticipantIdentity","store","fetchAllClassroomCourses","fetchAvailableSchedule","fetchInstructorCourse","submitCourseReview","submitCourseFeedback","select","fromSelector","Guid","slug","find","item","addSelectedClassroomCourse","removeAvailableSchedule","removeSelectedClassroomCourse","checkParticipantIdentity","removeParticipantIdentity","addError"],"sources":["./src/app/modules/course/classroom/store/classroom-course.action.ts","./src/app/modules/course/classroom/store/classroom-course.entity.ts","./src/app/modules/course/classroom/store/classroom-course.state.ts","./src/app/modules/course/classroom/store/classroom-course.reducer.ts","./src/app/modules/course/classroom/store/classroom-course.effects.ts","./src/app/modules/course/classroom/store/classroom-store.module.ts","./src/app/modules/course/classroom/store/services/classroom-course.resolver.ts","./src/app/modules/course/classroom/store/classroom-course.selector.ts","./src/app/modules/course/classroom/store/services/classroom-course.store.service.ts"],"sourcesContent":["import { createAction, props } from '@ngrx/store';\nimport { AvailableSchedule, ClassroomCourse, ClassroomCourseFilter } from '../models';\nimport { Review } from '@shared/models/review';\nimport { Feedback } from '../models/feedback';\nimport { Participant } from '../models/participant';\n\nexport enum ClassroomCourseActions {\n FetchClassroomCourses = '[Api/ClassroomCourse] Fetch Classroom Courses',\n FetchClassroomCourse = '[Api/ClassroomCourse] Fetch Classroom Course',\n FetchClassroomSchedule = '[Api/ClassroomCourse] Fetch Classroom Schedule',\n FetchInstructorCourses = '[Api/ClassroomCourse] Fetch Instructor Classroom Courses',\n SaveClassroomReview = '[Api/ClassroomCourse] Add Classroom Review.',\n SaveClassroomFeedback = '[Api/ClassroomCourse] Add Classroom Feedback',\n CheckParticipantIdentity = '[Api/ClassroomCourse] Check Participant Identity.',\n DecreaseScheduleCount = '[Api/ClassroomCourse] Decrease Schedule Count.',\n\n AddClassroomCourses = '[ClassroomCourse] Add Classroom Courses',\n AddClassroomCourse = '[ClassroomCourse] Add Classroom Course',\n AddClassroomSchedule = '[ClassroomCourse] Add Classroom Schedules',\n RemoveClassroomSchedule = '[ClassroomCourse] Remove Classroom Schedules',\n AddInstructorCourses = '[ClassroomCourse] Add Instructor Classroom Courses',\n AddSelectedCourse = '[ClassroomCourse] Add Selected Classroom Course Id',\n RemoveSelectedClassroomCourse = '[ClassroomCourse] Remove Selected Classroom Course Id',\n AddTotalCount = '[ClassroomCourse] Add Digital Course Total Count',\n AddClassroomReview = '[ClassroomCourse] Add Course review',\n AddClassroomFeedback = '[ClassroomCourse] Add Course feedback',\n AddParticipantIdentity = '[ClassroomCourse] Add Participant Identity',\n RemoveParticipantIdentity = '[ClassroomCourse] Remove Participant Identity',\n AddError = '[ClassroomCourse] Add Course Error',\n Empty = '[ClassroomCourse] Empty'\n}\n\n// Effects Actions\nexport const FetchClassroomCourses = createAction(\n ClassroomCourseActions.FetchClassroomCourses,\n props<{ filter?: ClassroomCourseFilter }>()\n);\nexport const FetchClassroomCourse = createAction(\n ClassroomCourseActions.FetchClassroomCourse,\n props<{ courseId: string }>()\n);\nexport const FetchClassroomSchedule = createAction(\n ClassroomCourseActions.FetchClassroomSchedule,\n props<{ courseId: string }>()\n);\nexport const FetchInstructorCourses = createAction(\n ClassroomCourseActions.FetchInstructorCourses,\n props<{ instructorId: string }>()\n);\nexport const SaveClassroomReview = createAction(ClassroomCourseActions.SaveClassroomReview, props<{ courseId: string; review: Review }>());\nexport const SaveClassroomFeedback = createAction(ClassroomCourseActions.SaveClassroomFeedback, props<{ courseId: string; feedback: Feedback }>());\n\nexport const CheckParticipantIdentity = createAction(ClassroomCourseActions.CheckParticipantIdentity, props<{ phone: string }>())\nexport const DecreaseScheduleCount = createAction(ClassroomCourseActions.DecreaseScheduleCount, props<{ courseId: string, scheduleId: number, numOfBooking: number }>())\n\n// Store Actions\nexport const AddClassroomCourses = createAction(\n ClassroomCourseActions.AddClassroomCourses,\n props<{ courses: ClassroomCourse[] }>()\n);\nexport const AddClassroomCourse = createAction(\n ClassroomCourseActions.AddClassroomCourse,\n props<{ course: ClassroomCourse }>()\n);\nexport const AddClassroomSchedule = createAction(\n ClassroomCourseActions.AddClassroomSchedule,\n props<{ schedules: AvailableSchedule[] }>()\n);\nexport const RemoveClassroomSchedule = createAction(ClassroomCourseActions.RemoveClassroomSchedule);\nexport const AddInstructorCourses = createAction(\n ClassroomCourseActions.AddInstructorCourses,\n props<{ instructorCourses: ClassroomCourse[] }>()\n);\nexport const AddSelectedCourse = createAction(\n ClassroomCourseActions.AddSelectedCourse,\n props<{ selectedCourseId: string }>()\n);\nexport const RemoveSelectedClassroomCourse = createAction(ClassroomCourseActions.RemoveSelectedClassroomCourse);\n\nexport const AddTotalCount = createAction(ClassroomCourseActions.AddTotalCount, props<{ totalCount: number }>());\nexport const AddCourseReview = createAction(ClassroomCourseActions.AddClassroomReview, props<{ review: Review }>());\nexport const AddCourseFeedback = createAction(ClassroomCourseActions.AddClassroomFeedback ,props<{ feedback: Feedback }>());\nexport const AddParticipantIdentity = createAction(ClassroomCourseActions.AddParticipantIdentity, props<{ participant: Participant}>());\nexport const RemoveParticipantIdentity = createAction(ClassroomCourseActions.RemoveParticipantIdentity);\n\nexport const AddError = createAction(ClassroomCourseActions.AddError, props<{ error: any }>());\n\nexport const Empty = createAction(ClassroomCourseActions.Empty);\n","import { EntityAdapter, createEntityAdapter } from '@ngrx/entity';\nimport { ClassroomCourse } from '../models';\n\nexport const classroomCourseAdapter: EntityAdapter = createEntityAdapter();\n","import { EntityState } from '@ngrx/entity';\nimport { AvailableSchedule, ClassroomCourse, ClassroomCourseFilter } from '../models';\nimport { Participant } from '../models/participant';\n\nexport const classroomFeatureKey = 'classroom';\n\nexport interface ClassroomCourseState extends EntityState {\n selectedCourseId: string;\n schedules: AvailableSchedule[];\n instructorCourses: ClassroomCourse[];\n error: any;\n totalCount: number;\n filter: ClassroomCourseFilter;\n participantIdentity: Participant;\n}\n","import { Action, createReducer, on } from '@ngrx/store';\n\nimport * as fromAction from './classroom-course.action';\nimport { classroomCourseAdapter } from './classroom-course.entity';\nimport { ClassroomCourseState } from './classroom-course.state';\nimport { ClassroomCourseFilter } from '../models';\n\nconst initialState: ClassroomCourseState = classroomCourseAdapter.getInitialState({\n selectedCourseId: null,\n schedules: [],\n instructorCourses: [],\n error: null,\n totalCount: 0,\n filter: new ClassroomCourseFilter(),\n participantIdentity: null\n});\n\nconst _classroomCourseReducer = createReducer(\n initialState,\n on(fromAction.AddClassroomCourses, (state, { courses }) => {\n return classroomCourseAdapter.setAll(courses, state);\n }),\n on(fromAction.AddClassroomCourse, (state, { course }) => {\n return classroomCourseAdapter.upsertOne(course, state);\n }),\n on(fromAction.AddClassroomSchedule, (state, { schedules }) => {\n return classroomCourseAdapter.addMany([], { ...state, schedules });\n }),\n on(fromAction.RemoveClassroomSchedule, (state) => {\n return classroomCourseAdapter.addMany([], { ...state, schedules: [] });\n }),\n on(fromAction.AddInstructorCourses, (state, { instructorCourses }) => {\n return classroomCourseAdapter.addMany([], { ...state, instructorCourses });\n }),\n on(fromAction.AddSelectedCourse, (state, { selectedCourseId }) => {\n return classroomCourseAdapter.addMany([], { ...state, selectedCourseId });\n }),\n on(fromAction.RemoveSelectedClassroomCourse, (state) => {\n return classroomCourseAdapter.addMany([], { ...state, selectedDigitalCourseId: null });\n }),\n on(fromAction.AddParticipantIdentity, (state, { participant }) => {\n return classroomCourseAdapter.addMany([], {...state, participantIdentity: participant })\n }),\n on(fromAction.RemoveParticipantIdentity, (state) => {\n return classroomCourseAdapter.addMany([], {...state, participantIdentity: null })\n }),\n on(fromAction.AddTotalCount, (state, { totalCount }) => {\n return classroomCourseAdapter.addMany([], { ...state, totalCount: totalCount });\n }),\n on(fromAction.AddError, (state, { error }) => {\n return classroomCourseAdapter.addMany([], { ...state, error: error });\n })\n);\n\nexport function classroomCourseReducer(\n state: ClassroomCourseState = initialState,\n action: Action\n): ClassroomCourseState {\n return _classroomCourseReducer(state, action);\n}\n","import { Injectable } from '@angular/core';\nimport { Actions, createEffect, ofType } from '@ngrx/effects';\nimport { Action } from '@ngrx/store';\nimport { Observable } from 'rxjs';\nimport { map, mergeMap, switchMap } from 'rxjs/operators';\nimport * as fromAction from './classroom-course.action';\nimport { PageList } from '@core/models/page-list';\nimport { ClassroomCourseApiService } from '@modules/course/classroom/store/services/classroom-course.api.service';\nimport { AvailableSchedule, ClassroomCourse } from '@modules/course/classroom/models';\nimport { classroomFeatureKey } from './classroom-course.state';\nimport { AlertMessageType } from '@modules/shared/enums/alert-message-type';\nimport { EffectHelperService } from '@modules/core/services/effect-helper.service';\n\n@Injectable()\nexport class ClassroomCourseEffects {\n\n fetchClassroomCoursesEffect$: Observable = createEffect(() => this.actions$.pipe(\n ofType(fromAction.FetchClassroomCourses),\n mergeMap(({ filter }) => {\n return this.classroomCourseApiService.getAllClassroomCourse(filter).pipe(\n map((courses: PageList) => {\n fromAction.AddTotalCount({ totalCount: courses.total });\n return this.effectHelperService.handleSuccess(fromAction.AddClassroomCourses({ courses: courses.items }))\n }),\n this.effectHelperService.handleError(fromAction.AddError, true, classroomFeatureKey)\n );\n })\n ));\n\n\n fetchClassroomCourseEffect$ = createEffect(() => this.actions$.pipe(\n ofType(fromAction.FetchClassroomCourse),\n switchMap(({ courseId }) => {\n return this.classroomCourseApiService\n .getClassroomCourse(courseId)\n .pipe(\n map((course: ClassroomCourse) => this.effectHelperService.handleSuccess(fromAction.AddClassroomCourse({ course }))),\n this.effectHelperService.handleError(fromAction.AddError, true, classroomFeatureKey)\n );\n })\n ));\n\n\n fetchAvailableScheduleEffect$ = createEffect(() => this.actions$.pipe(\n ofType(fromAction.FetchClassroomSchedule),\n switchMap(({ courseId }) => {\n return this.classroomCourseApiService\n .getAvailableSchedule(courseId)\n .pipe(\n map((schedules: AvailableSchedule[]) => this.effectHelperService.handleSuccess(fromAction.AddClassroomSchedule({ schedules }))),\n this.effectHelperService.handleError(fromAction.AddError, true, classroomFeatureKey)\n );\n })\n ));\n\n \n fetchInstructorCoursesEffect$ = createEffect(() => this.actions$.pipe(\n ofType(fromAction.FetchInstructorCourses),\n switchMap(({ instructorId }) => {\n return this.classroomCourseApiService\n .fetchInstructorCourses(instructorId)\n .pipe(\n map((instructorCourses: ClassroomCourse[]) => this.effectHelperService.handleSuccess(fromAction.AddInstructorCourses({ instructorCourses }))),\n this.effectHelperService.handleError(fromAction.AddError, true, classroomFeatureKey)\n );\n })\n ));\n\n saveCourseReview$: Observable = createEffect(() =>\n this.actions$.pipe(\n ofType(fromAction.SaveClassroomReview),\n switchMap((payload) =>\n this.classroomCourseApiService\n .sendCourseReview(payload.courseId, payload.review)\n .pipe(\n map((review) => this.effectHelperService.handleSuccess(fromAction.AddCourseReview({ review }), true, 'thanks_for_your_feedback', classroomFeatureKey, AlertMessageType.SUCCESSFUL )),\n this.effectHelperService.handleError(fromAction.AddError, true, classroomFeatureKey)\n )\n )\n )\n );\n\n saveCourseFeedback$: Observable = createEffect(() =>\n this.actions$.pipe(\n ofType(fromAction.SaveClassroomFeedback),\n switchMap((payload) =>\n this.classroomCourseApiService\n .sendCourseFeedback(payload.courseId, payload.feedback)\n .pipe(\n map((feedback) => this.effectHelperService.handleSuccess(fromAction.AddCourseFeedback({ feedback }))),\n this.effectHelperService.handleError(fromAction.AddError, true, classroomFeatureKey)\n )\n )\n )\n );\n\n checkParticipantIdentity$: Observable = createEffect(() =>\n this.actions$.pipe(\n ofType(fromAction.CheckParticipantIdentity),\n switchMap((payload) =>\n this.classroomCourseApiService\n .checkPartnerIdentity(payload.phone)\n .pipe(\n map((participant) => this.effectHelperService.handleSuccess(fromAction.AddParticipantIdentity({ participant }))),\n this.effectHelperService.handleError(fromAction.AddError, true, classroomFeatureKey)\n )\n )\n )\n );\n\n decreaseScheduleCount$ = createEffect(() =>\n this.actions$.pipe(\n ofType(fromAction.DecreaseScheduleCount),\n switchMap((payload) =>\n this.classroomCourseApiService\n .decreaseScheduleCount(payload.courseId, payload.scheduleId, payload.numOfBooking)\n .pipe(\n map((participant) => this.effectHelperService.handleSuccess(fromAction.Empty())),\n this.effectHelperService.handleError(fromAction.AddError, true, classroomFeatureKey)\n )\n )\n ), { dispatch: false }\n );\n\n constructor(private actions$: Actions, \n private classroomCourseApiService: ClassroomCourseApiService, \n private effectHelperService: EffectHelperService) {}\n}\n","import { NgModule } from '@angular/core';\nimport { StoreModule } from '@ngrx/store';\nimport { EffectsModule } from '@ngrx/effects';\nimport { classroomCourseReducer } from './classroom-course.reducer';\nimport { ClassroomCourseEffects } from './classroom-course.effects';\nimport { ClassroomCourseStoreService } from './services/classroom-course.store.service';\nimport { ClassroomCourseResolver } from './services/classroom-course.resolver';\nimport { classroomFeatureKey } from './classroom-course.state';\n\n@NgModule({\n imports: [\n StoreModule.forFeature(classroomFeatureKey, classroomCourseReducer),\n EffectsModule.forFeature([ClassroomCourseEffects]),\n ],\n providers: [ClassroomCourseStoreService, ClassroomCourseResolver],\n})\nexport class ClassroomStoreModule {}\n","import { Injectable } from '@angular/core';\nimport { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';\nimport { MetaTagService } from '@modules/core/services/meta-tag.service';\nimport { Observable, of } from 'rxjs';\nimport { first, map, tap } from 'rxjs/operators';\n//import { InstructorStoreService } from 'src/app/modules/instructor/client/store/instructor.store.service';\nimport { ClassroomCourse } from '../../models';\nimport { ClassroomCourseStoreService } from './classroom-course.store.service';\n\n@Injectable()\nexport class ClassroomCourseResolver implements Resolve {\n constructor(\n private classroomCourseStoreService: ClassroomCourseStoreService,\n private metaService: MetaTagService,\n ) //private instructorStore: InstructorStoreService,\n {}\n\n resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable {\n let courseId = route.params['id'];\n if(!courseId) courseId = route.queryParams['id'];\n\n if (courseId) {\n return this.classroomCourseStoreService.getClassroomCourse(courseId).pipe(\n map((course: ClassroomCourse) => {\n if (!course) {\n this.classroomCourseStoreService.fetchClassroomCourse(courseId);\n } else {\n const { id } = course.instructors[0];\n this.metaService.classroomCourseOGMetaTag(course);\n }\n return course;\n }),\n first(course => course && Boolean(Object.keys(course).length > 0))\n );\n } else {\n return of(null);\n }\n }\n}\n","import { createFeatureSelector, createSelector } from '@ngrx/store';\nimport { classroomCourseAdapter } from './classroom-course.entity';\nimport { ClassroomCourseState, classroomFeatureKey } from './classroom-course.state';\n\nexport const { selectAll, selectEntities, selectIds, selectTotal } = classroomCourseAdapter.getSelectors();\n\nexport const getClassroomCourseState = createFeatureSelector(classroomFeatureKey);\n\nexport const getAllClassroomCourse = createSelector(getClassroomCourseState, selectAll);\n\nexport const getClassroomCourseById = (id: string) =>\n createSelector(getClassroomCourseState, (state) => state.entities[id]);\nexport const getClassroomCourseBySlug = (slug: string) =>\n createSelector(getAllClassroomCourse, (state) => {\n return state.find((item) => item.slug === slug);\n });\n\nexport const getSelectedClassroomCourse = createSelector(\n getClassroomCourseState,\n (state) => state.entities[state.selectedCourseId]\n);\nexport const getClassroomCourseId = createSelector(getClassroomCourseState, (state) => state.selectedCourseId);\nexport const getAvailableSchedule = createSelector(getClassroomCourseState, (state) => state.schedules.filter(schedule => schedule.status && !schedule.isSignUpDateExpired));\nexport const getInstructorCourse = createSelector(getClassroomCourseState, (state) => state.instructorCourses);\n\nexport const getError = createSelector(getClassroomCourseState, (state) => state.error);\n\nexport const getFilter = createSelector(getClassroomCourseState, (state) => state.filter);\n\nexport const getTotalCount = createSelector(getClassroomCourseState, (state) => state.totalCount);\nexport const getParticipantIdentity = createSelector(getClassroomCourseState, (state) => state.participantIdentity);\n","import { Injectable } from '@angular/core';\nimport { select, Store } from '@ngrx/store';\nimport { Observable } from 'rxjs';\nimport { Guid } from '@core/utils/guid';\nimport { AvailableSchedule, ClassroomCourse, ClassroomCourseFilter } from '../../models';\nimport * as fromAction from '../classroom-course.action';\nimport * as fromSelector from '../classroom-course.selector';\nimport { ClassroomCourseState } from '../classroom-course.state';\nimport { Review } from '@shared/models/review';\nimport { Feedback } from '../../models/feedback';\nimport { Participant } from '../../models/participant';\n\n@Injectable()\nexport class ClassroomCourseStoreService {\n constructor(private store: Store) {}\n\n fetchAllClassroomCourses(filter: ClassroomCourseFilter): void {\n this.store.dispatch(fromAction.FetchClassroomCourses({ filter }));\n }\n\n fetchClassroomCourse(courseId: string): void {\n this.store.dispatch(fromAction.FetchClassroomCourse({ courseId }));\n }\n\n fetchAvailableSchedule(courseId: string): void {\n this.store.dispatch(fromAction.FetchClassroomSchedule({ courseId }));\n }\n\n fetchInstructorCourse(instructorId: string): void {\n this.store.dispatch(fromAction.FetchInstructorCourses({ instructorId }));\n }\n\n submitCourseReview(id: string, review: Review): void {\n this.store.dispatch( fromAction.SaveClassroomReview({ courseId: id, review: review }));\n }\n\n submitCourseFeedback(id: string, feedback: Feedback): void {\n this.store.dispatch( fromAction.SaveClassroomFeedback({ courseId: id, feedback }));\n }\n\n getAllClassroomCourse(): Observable {\n return this.store.pipe(select(fromSelector.getAllClassroomCourse));\n }\n\n getClassroomCourse(courseId: string): Observable {\n if (Guid.IsGuid(courseId)) {\n return this.store.select(fromSelector.getClassroomCourseById(courseId));\n } else {\n return this.store.select(fromSelector.getClassroomCourseBySlug(courseId));\n }\n }\n\n addSelectedClassroomCourse(selectedCourseId: string): void {\n this.store.dispatch(fromAction.AddSelectedCourse({ selectedCourseId }));\n }\n\n getSelectedClassroomCourse(): Observable {\n return this.store.pipe(select(fromSelector.getSelectedClassroomCourse));\n }\n\n getAvailableSchedule(): Observable {\n return this.store.pipe(select(fromSelector.getAvailableSchedule));\n }\n\n removeAvailableSchedule(): void {\n this.store.dispatch(fromAction.RemoveClassroomSchedule());\n }\n\n getInstructorCourse(): Observable {\n return this.store.pipe(select(fromSelector.getInstructorCourse));\n }\n\n removeSelectedClassroomCourse(): void {\n this.store.dispatch(fromAction.RemoveSelectedClassroomCourse());\n }\n\n checkParticipantIdentity(phone: string): void {\n this.store.dispatch(fromAction.CheckParticipantIdentity({ phone }));\n }\n\n getParticipantIdentity(): Observable {\n return this.store.pipe(select(fromSelector.getParticipantIdentity));\n }\n\n removeParticipantIdentity(): void {\n this.store.dispatch(fromAction.RemoveParticipantIdentity());\n }\n\n decreaseScheduleCount(courseId: string, scheduleId: number, numOfBooking: number): void {\n this.store.dispatch(fromAction.DecreaseScheduleCount({ courseId, scheduleId, numOfBooking }));\n }\n\n addError(error: any): void {\n this.store.dispatch(fromAction.AddError(error));\n }\n}\n"],"sourceRoot":"webpack:///","file":"419.741c755582486e81d194.js"}