{ "version": 3, "sources": ["src/app/modules/features/interviews/interview-builder/interview-builder-rules.resolver.ts"], "sourcesContent": ["import { Injectable } from '@angular/core';\r\nimport { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\r\nimport { Observable } from 'rxjs';\r\nimport {\r\n UserLoginInfo,\r\n InterviewBuilderRules,\r\n AccountInfoService,\r\n AlertsService,\r\n CustomRuleService,\r\n SessionInfoService,\r\n SessionKey,\r\n RuleCode,\r\n} from 'degarmo-lib';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class InterviewBuilderRulesResolver {\r\n constructor(\r\n private accountInfoService: AccountInfoService,\r\n private alertsService: AlertsService,\r\n private customRuleService: CustomRuleService,\r\n private sessionInfoService: SessionInfoService\r\n ) {}\r\n\r\n resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable {\r\n return this.loadRules();\r\n }\r\n\r\n loadRules = (): Observable => {\r\n const userLoginInfo: UserLoginInfo = this.accountInfoService.getUserLoginInfo();\r\n return new Observable((subscriber) => {\r\n let companyID: number = this.sessionInfoService.getConstant(SessionKey.InterviewBuilderCompanyID, 'number', true);\r\n\r\n if (userLoginInfo.isProctor) {\r\n if (companyID !== userLoginInfo.companyID) {\r\n companyID = userLoginInfo.companyID;\r\n this.sessionInfoService.setConstant(SessionKey.InterviewBuilderCompanyID, companyID, true);\r\n }\r\n }\r\n\r\n if (companyID) {\r\n this.alertsService.showLoading(false, 1);\r\n\r\n this.customRuleService\r\n .getRules({\r\n sets: ['InterviewBuilder', 'InterviewContentManagement', 'InterviewGuide'],\r\n companyID: companyID,\r\n proctorID: userLoginInfo.isProctor ? userLoginInfo.proctorID : 0,\r\n })\r\n .subscribe({\r\n next: (rules) => {\r\n const priorities: string[] = ['proctorID', 'companyID'];\r\n const retVal: InterviewBuilderRules = {\r\n canAddInterviewTags:\r\n this.customRuleService.getPrioritizedRuleValue(RuleCode.CanAddInterviewTemplateTags, priorities, '0', rules) === '1' ? true : false,\r\n canCreateTechnicalQuestions:\r\n this.customRuleService.getPrioritizedRuleValue(RuleCode.CanCreateTechnicalQuestions, priorities, '0', rules) === '1' ? true : false,\r\n canSetInterviewGuidesAsPrivate:\r\n this.customRuleService.getPrioritizedRuleValue(RuleCode.CanSetInterviewGuidesAsPrivate, priorities, '0', rules) === '1'\r\n ? true\r\n : false,\r\n dimensionsGroupedByMacro:\r\n this.customRuleService.getPrioritizedRuleValue(RuleCode.DimensionsGroupedByMacro, priorities, '0', rules) === '1' ? true : false,\r\n displayAssessmentCategory:\r\n this.customRuleService.getPrioritizedRuleValue(RuleCode.DisplayAssessmentCategories, priorities, '0', rules) === '1' ? true : false,\r\n displayJobLevel:\r\n this.customRuleService.getPrioritizedRuleValue(RuleCode.DisplayJobLevel, priorities, '0', rules) === '1' ? true : false,\r\n filterByJobLevelID:\r\n this.customRuleService.getPrioritizedRuleValue(RuleCode.JobLevelFilterToggle, priorities, '0', rules) === '1' ? true : false,\r\n maxLabelsAllowed: Number(this.customRuleService.getPrioritizedRuleValue(RuleCode.MaxLabelsAllowed, priorities, '0', rules)),\r\n minLabelsAllowed: Number(this.customRuleService.getPrioritizedRuleValue(RuleCode.MinLabelsAllowed, priorities, '0', rules)),\r\n maxQuestions: Number(this.customRuleService.getPrioritizedRuleValue(RuleCode.MaxQuestions, priorities, '0', rules)),\r\n minQuestions: Number(this.customRuleService.getPrioritizedRuleValue(RuleCode.MinQuestions, priorities, '0', rules)),\r\n maxTechQuestions: Number(this.customRuleService.getPrioritizedRuleValue(RuleCode.MaxTechQuestions, priorities, '0', rules)),\r\n minTechQuestions: Number(this.customRuleService.getPrioritizedRuleValue(RuleCode.MinTechQuestions, priorities, '0', rules)),\r\n showJobCode: this.customRuleService.getPrioritizedRuleValue(RuleCode.ShowJobCode, priorities, '0', rules) === '1' ? true : false,\r\n showRequisitionNumber:\r\n this.customRuleService.getPrioritizedRuleValue(RuleCode.ShowRequisitionNumber, priorities, '0', rules) === '1' ? true : false,\r\n useDigitalGuides:\r\n this.customRuleService.getPrioritizedRuleValue(RuleCode.UseDigitalGuides, priorities, '0', rules) === '1' ? true : false,\r\n requisitionNumberValidationRequirements: this.customRuleService.getPrioritizedRuleValue(\r\n RuleCode.RequisitionNumberValidationRequirements,\r\n priorities,\r\n '',\r\n rules\r\n ),\r\n jobCodeValidationRequirements: this.customRuleService.getPrioritizedRuleValue(\r\n RuleCode.JobCodeValidationRequirements,\r\n priorities,\r\n '',\r\n rules\r\n ),\r\n questionNumberingStyle: this.customRuleService.getPrioritizedRuleValue(RuleCode.QuestionNumberingStyle, priorities, 'reset', rules),\r\n interviewQuestionType: this.customRuleService.getPrioritizedRuleValue(\r\n RuleCode.InterviewQuestionType,\r\n priorities,\r\n 'Behavioral',\r\n rules\r\n ),\r\n };\r\n\r\n this.alertsService.doneLoading();\r\n this.sessionInfoService.setConstant(SessionKey.InterviewBuilderRules, retVal, true);\r\n subscriber.next(retVal);\r\n },\r\n error: (err) => {\r\n this.alertsService.doneLoading();\r\n subscriber.error(err);\r\n },\r\n complete: () => {\r\n subscriber.complete();\r\n },\r\n });\r\n } else {\r\n subscriber.next(null);\r\n subscriber.complete();\r\n }\r\n });\r\n };\r\n}\r\n"], "mappings": ";;;;;;;;;;;;;AAeM,IAAO,iCAAP,MAAO,+BAA6B;EACxC,YACU,oBACA,eACA,mBACA,oBAAsC;AAHtC,SAAA,qBAAA;AACA,SAAA,gBAAA;AACA,SAAA,oBAAA;AACA,SAAA,qBAAA;AAOV,SAAA,YAAY,MAAwC;AAClD,YAAM,gBAA+B,KAAK,mBAAmB,iBAAgB;AAC7E,aAAO,IAAI,WAAW,CAAC,eAAc;AACnC,YAAI,YAAoB,KAAK,mBAAmB,YAAY,WAAW,2BAA2B,UAAU,IAAI;AAEhH,YAAI,cAAc,WAAW;AAC3B,cAAI,cAAc,cAAc,WAAW;AACzC,wBAAY,cAAc;AAC1B,iBAAK,mBAAmB,YAAY,WAAW,2BAA2B,WAAW,IAAI;UAC3F;QACF;AAEA,YAAI,WAAW;A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