@hmcts/ccd-case-ui-toolkit 7.3.74-multiple-role-categories → 7.3.74-unsafe-eval-removal

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,6 @@ import moment from 'moment';
17
17
  import { __decorate, __metadata } from 'tslib';
18
18
  import * as _ from 'underscore';
19
19
  import 'reflect-metadata';
20
- import { generate } from 'pegjs';
21
20
  import { StateMachine } from '@edium/fsm';
22
21
  import * as i1$3 from '@angular/material/legacy-dialog';
23
22
  import { MAT_LEGACY_DIALOG_DATA, MatLegacyDialogModule } from '@angular/material/legacy-dialog';
@@ -4798,107 +4797,1036 @@ class FieldsUtils {
4798
4797
  type: Injectable
4799
4798
  }], null, null); })();
4800
4799
 
4801
- const conditionSource = `{
4800
+ // @ts-nocheck
4801
+ // This file is generated by npm run generate:condition-parser. Do not edit by hand.
4802
+ // @generated by Peggy 5.1.0.
4803
+ //
4804
+ // https://peggyjs.org/
4805
+ class peg$SyntaxError extends SyntaxError {
4806
+ constructor(message, expected, found, location) {
4807
+ super(message);
4808
+ this.expected = expected;
4809
+ this.found = found;
4810
+ this.location = location;
4811
+ this.name = "SyntaxError";
4812
+ }
4813
+ format(sources) {
4814
+ let str = "Error: " + this.message;
4815
+ if (this.location) {
4816
+ let src = null;
4817
+ const st = sources.find(s => s.source === this.location.source);
4818
+ if (st) {
4819
+ src = st.text.split(/\r\n|\n|\r/g);
4820
+ }
4821
+ const s = this.location.start;
4822
+ const offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
4823
+ ? this.location.source.offset(s)
4824
+ : s;
4825
+ const loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
4826
+ if (src) {
4827
+ const e = this.location.end;
4828
+ const filler = "".padEnd(offset_s.line.toString().length, " ");
4829
+ const line = src[s.line - 1];
4830
+ const last = s.line === e.line ? e.column : line.length + 1;
4831
+ const hatLen = (last - s.column) || 1;
4832
+ str += "\n --> " + loc + "\n"
4833
+ + filler + " |\n"
4834
+ + offset_s.line + " | " + line + "\n"
4835
+ + filler + " | " + "".padEnd(s.column - 1, " ")
4836
+ + "".padEnd(hatLen, "^");
4837
+ }
4838
+ else {
4839
+ str += "\n at " + loc;
4840
+ }
4841
+ }
4842
+ return str;
4843
+ }
4844
+ static buildMessage(expected, found) {
4845
+ function hex(ch) {
4846
+ return ch.codePointAt(0).toString(16).toUpperCase();
4847
+ }
4848
+ const nonPrintable = Object.prototype.hasOwnProperty.call(RegExp.prototype, "unicode")
4849
+ ? new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]", "gu")
4850
+ : null;
4851
+ function unicodeEscape(s) {
4852
+ if (nonPrintable) {
4853
+ return s.replace(nonPrintable, ch => "\\u{" + hex(ch) + "}");
4854
+ }
4855
+ return s;
4856
+ }
4857
+ function literalEscape(s) {
4858
+ return unicodeEscape(s
4859
+ .replace(/\\/g, "\\\\")
4860
+ .replace(/"/g, "\\\"")
4861
+ .replace(/\0/g, "\\0")
4862
+ .replace(/\t/g, "\\t")
4863
+ .replace(/\n/g, "\\n")
4864
+ .replace(/\r/g, "\\r")
4865
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
4866
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
4867
+ }
4868
+ function classEscape(s) {
4869
+ return unicodeEscape(s
4870
+ .replace(/\\/g, "\\\\")
4871
+ .replace(/\]/g, "\\]")
4872
+ .replace(/\^/g, "\\^")
4873
+ .replace(/-/g, "\\-")
4874
+ .replace(/\0/g, "\\0")
4875
+ .replace(/\t/g, "\\t")
4876
+ .replace(/\n/g, "\\n")
4877
+ .replace(/\r/g, "\\r")
4878
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
4879
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
4880
+ }
4881
+ const DESCRIBE_EXPECTATION_FNS = {
4882
+ literal(expectation) {
4883
+ return "\"" + literalEscape(expectation.text) + "\"";
4884
+ },
4885
+ class(expectation) {
4886
+ const escapedParts = expectation.parts.map(part => (Array.isArray(part)
4887
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
4888
+ : classEscape(part)));
4889
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]" + (expectation.unicode ? "u" : "");
4890
+ },
4891
+ any() {
4892
+ return "any character";
4893
+ },
4894
+ end() {
4895
+ return "end of input";
4896
+ },
4897
+ other(expectation) {
4898
+ return expectation.description;
4899
+ },
4900
+ };
4901
+ function describeExpectation(expectation) {
4902
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
4903
+ }
4904
+ function describeExpected(expected) {
4905
+ const descriptions = expected.map(describeExpectation);
4906
+ descriptions.sort();
4907
+ if (descriptions.length > 0) {
4908
+ let j = 1;
4909
+ for (let i = 1; i < descriptions.length; i++) {
4910
+ if (descriptions[i - 1] !== descriptions[i]) {
4911
+ descriptions[j] = descriptions[i];
4912
+ j++;
4913
+ }
4914
+ }
4915
+ descriptions.length = j;
4916
+ }
4917
+ switch (descriptions.length) {
4918
+ case 1:
4919
+ return descriptions[0];
4920
+ case 2:
4921
+ return descriptions[0] + " or " + descriptions[1];
4922
+ default:
4923
+ return descriptions.slice(0, -1).join(", ")
4924
+ + ", or "
4925
+ + descriptions[descriptions.length - 1];
4926
+ }
4927
+ }
4928
+ function describeFound(found) {
4929
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
4930
+ }
4931
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
4932
+ }
4933
+ }
4934
+ function peg$parse(input, options) {
4935
+ options = options !== undefined ? options : {};
4936
+ const peg$FAILED = {};
4937
+ const peg$source = options.grammarSource;
4938
+ const peg$startRuleFunctions = {
4939
+ Start: peg$parseStart,
4940
+ };
4941
+ let peg$startRuleFunction = peg$parseStart;
4942
+ const peg$c0 = "AND";
4943
+ const peg$c1 = "OR";
4944
+ const peg$c2 = "[";
4945
+ const peg$c3 = "]";
4946
+ const peg$c4 = "\"";
4947
+ const peg$c5 = "(";
4948
+ const peg$c6 = ")";
4949
+ const peg$c7 = "=";
4950
+ const peg$c8 = "!=";
4951
+ const peg$c9 = "CONTAINS";
4952
+ const peg$r0 = /^[a-zA-Z]/;
4953
+ const peg$r1 = /^[A-Za-z0-9._\-]/;
4954
+ const peg$r2 = /^[0-9]/;
4955
+ const peg$r3 = /^[A-Za-z0-9.,* _&()\/\-]/;
4956
+ const peg$r4 = /^[ \t]/;
4957
+ const peg$e0 = peg$literalExpectation("AND", false);
4958
+ const peg$e1 = peg$literalExpectation("OR", false);
4959
+ const peg$e2 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false, false);
4960
+ const peg$e3 = peg$classExpectation([["A", "Z"], ["a", "z"], ["0", "9"], ".", "_", "-"], false, false, false);
4961
+ const peg$e4 = peg$literalExpectation("[", false);
4962
+ const peg$e5 = peg$literalExpectation("]", false);
4963
+ const peg$e6 = peg$classExpectation([["0", "9"]], false, false, false);
4964
+ const peg$e7 = peg$literalExpectation("\"", false);
4965
+ const peg$e8 = peg$classExpectation([["A", "Z"], ["a", "z"], ["0", "9"], ".", ",", "*", " ", "_", "&", "(", ")", "/", "-"], false, false, false);
4966
+ const peg$e9 = peg$literalExpectation("(", false);
4967
+ const peg$e10 = peg$literalExpectation(")", false);
4968
+ const peg$e11 = peg$literalExpectation("=", false);
4969
+ const peg$e12 = peg$literalExpectation("!=", false);
4970
+ const peg$e13 = peg$literalExpectation("CONTAINS", false);
4971
+ const peg$e14 = peg$otherExpectation("Whitespace");
4972
+ const peg$e15 = peg$classExpectation([" ", "\t"], false, false, false);
4973
+ const peg$e16 = peg$otherExpectation("One or more whitespaces");
4974
+ function peg$f0(formula, join) { return flat([[formula], join[0]], 1); }
4975
+ function peg$f1(eq, joins) { return flat([eq, flat(joins)]); }
4976
+ function peg$f2(comp, eq) { return [comp, eq]; }
4977
+ function peg$f3(comp, f) { return [comp, f]; }
4978
+ function peg$f4(fr, op, val) { return { fieldReference: fr, comparator: op, value: val }; }
4979
+ function peg$f5(c) { return c; }
4980
+ function peg$f6(c) { return c; }
4981
+ function peg$f7(l) { return l.join(""); }
4982
+ function peg$f8(v) { return v.join(""); }
4983
+ function peg$f9(v) { return parseInt(v.join("")); }
4984
+ function peg$f10(s1, fr, s2) { return s1 + fr + s2; }
4985
+ function peg$f11(characters) { return characters.join(""); }
4986
+ function peg$f12(val) { return val.join(""); }
4987
+ let peg$currPos = options.peg$currPos | 0;
4988
+ let peg$savedPos = peg$currPos;
4989
+ const peg$posDetailsCache = [{ line: 1, column: 1 }];
4990
+ let peg$maxFailPos = peg$currPos;
4991
+ let peg$maxFailExpected = options.peg$maxFailExpected || [];
4992
+ let peg$silentFails = options.peg$silentFails | 0;
4993
+ let peg$result;
4994
+ if (options.startRule) {
4995
+ if (!(options.startRule in peg$startRuleFunctions)) {
4996
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
4997
+ }
4998
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
4999
+ }
5000
+ function text() {
5001
+ return input.substring(peg$savedPos, peg$currPos);
5002
+ }
5003
+ function offset() {
5004
+ return peg$savedPos;
5005
+ }
5006
+ function range() {
5007
+ return {
5008
+ source: peg$source,
5009
+ start: peg$savedPos,
5010
+ end: peg$currPos,
5011
+ };
5012
+ }
5013
+ function location() {
5014
+ return peg$computeLocation(peg$savedPos, peg$currPos);
5015
+ }
5016
+ function expected(description, location) {
5017
+ location = location !== undefined
5018
+ ? location
5019
+ : peg$computeLocation(peg$savedPos, peg$currPos);
5020
+ throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);
5021
+ }
5022
+ function error(message, location) {
5023
+ location = location !== undefined
5024
+ ? location
5025
+ : peg$computeLocation(peg$savedPos, peg$currPos);
5026
+ throw peg$buildSimpleError(message, location);
5027
+ }
5028
+ function peg$getUnicode(pos = peg$currPos) {
5029
+ const cp = input.codePointAt(pos);
5030
+ if (cp === undefined) {
5031
+ return "";
5032
+ }
5033
+ return String.fromCodePoint(cp);
5034
+ }
5035
+ function peg$literalExpectation(text, ignoreCase) {
5036
+ return { type: "literal", text, ignoreCase };
5037
+ }
5038
+ function peg$classExpectation(parts, inverted, ignoreCase, unicode) {
5039
+ return { type: "class", parts, inverted, ignoreCase, unicode };
5040
+ }
5041
+ function peg$anyExpectation() {
5042
+ return { type: "any" };
5043
+ }
5044
+ function peg$endExpectation() {
5045
+ return { type: "end" };
5046
+ }
5047
+ function peg$otherExpectation(description) {
5048
+ return { type: "other", description };
5049
+ }
5050
+ function peg$computePosDetails(pos) {
5051
+ let details = peg$posDetailsCache[pos];
5052
+ let p;
5053
+ if (details) {
5054
+ return details;
5055
+ }
5056
+ else {
5057
+ if (pos >= peg$posDetailsCache.length) {
5058
+ p = peg$posDetailsCache.length - 1;
5059
+ }
5060
+ else {
5061
+ p = pos;
5062
+ while (!peg$posDetailsCache[--p]) { }
5063
+ }
5064
+ details = peg$posDetailsCache[p];
5065
+ details = {
5066
+ line: details.line,
5067
+ column: details.column,
5068
+ };
5069
+ while (p < pos) {
5070
+ if (input.charCodeAt(p) === 10) {
5071
+ details.line++;
5072
+ details.column = 1;
5073
+ }
5074
+ else {
5075
+ details.column++;
5076
+ }
5077
+ p++;
5078
+ }
5079
+ peg$posDetailsCache[pos] = details;
5080
+ return details;
5081
+ }
5082
+ }
5083
+ function peg$computeLocation(startPos, endPos, offset) {
5084
+ const startPosDetails = peg$computePosDetails(startPos);
5085
+ const endPosDetails = peg$computePosDetails(endPos);
5086
+ const res = {
5087
+ source: peg$source,
5088
+ start: {
5089
+ offset: startPos,
5090
+ line: startPosDetails.line,
5091
+ column: startPosDetails.column,
5092
+ },
5093
+ end: {
5094
+ offset: endPos,
5095
+ line: endPosDetails.line,
5096
+ column: endPosDetails.column,
5097
+ },
5098
+ };
5099
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
5100
+ res.start = peg$source.offset(res.start);
5101
+ res.end = peg$source.offset(res.end);
5102
+ }
5103
+ return res;
5104
+ }
5105
+ function peg$fail(expected) {
5106
+ if (peg$currPos < peg$maxFailPos) {
5107
+ return;
5108
+ }
5109
+ if (peg$currPos > peg$maxFailPos) {
5110
+ peg$maxFailPos = peg$currPos;
5111
+ peg$maxFailExpected = [];
5112
+ }
5113
+ peg$maxFailExpected.push(expected);
5114
+ }
5115
+ function peg$buildSimpleError(message, location) {
5116
+ return new peg$SyntaxError(message, null, null, location);
5117
+ }
5118
+ function peg$buildStructuredError(expected, found, location) {
5119
+ return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
5120
+ }
5121
+ function peg$parseStart() {
5122
+ let s0;
5123
+ s0 = peg$parseFormula();
5124
+ return s0;
5125
+ }
5126
+ function peg$parseFormula() {
5127
+ let s0;
5128
+ s0 = peg$parseEnclosedFormula();
5129
+ if (s0 === peg$FAILED) {
5130
+ s0 = peg$parseOpenFormula();
5131
+ }
5132
+ return s0;
5133
+ }
5134
+ function peg$parseEnclosedFormula() {
5135
+ let s0, s1, s2, s3, s4, s5;
5136
+ s0 = peg$currPos;
5137
+ s1 = peg$parsebracket();
5138
+ if (s1 !== peg$FAILED) {
5139
+ s2 = peg$parseOpenFormula();
5140
+ if (s2 !== peg$FAILED) {
5141
+ s3 = peg$parsebracket();
5142
+ if (s3 !== peg$FAILED) {
5143
+ s4 = [];
5144
+ s5 = peg$parseJoinComparator();
5145
+ while (s5 !== peg$FAILED) {
5146
+ s4.push(s5);
5147
+ s5 = peg$parseJoinComparator();
5148
+ }
5149
+ peg$savedPos = s0;
5150
+ s0 = peg$f0(s2, s4);
5151
+ }
5152
+ else {
5153
+ peg$currPos = s0;
5154
+ s0 = peg$FAILED;
5155
+ }
5156
+ }
5157
+ else {
5158
+ peg$currPos = s0;
5159
+ s0 = peg$FAILED;
5160
+ }
5161
+ }
5162
+ else {
5163
+ peg$currPos = s0;
5164
+ s0 = peg$FAILED;
5165
+ }
5166
+ return s0;
5167
+ }
5168
+ function peg$parseOpenFormula() {
5169
+ let s0, s1, s2, s3;
5170
+ s0 = peg$currPos;
5171
+ s1 = peg$parseOpenEqualityCheck();
5172
+ if (s1 !== peg$FAILED) {
5173
+ s2 = [];
5174
+ s3 = peg$parseJoinComparator();
5175
+ while (s3 !== peg$FAILED) {
5176
+ s2.push(s3);
5177
+ s3 = peg$parseJoinComparator();
5178
+ }
5179
+ peg$savedPos = s0;
5180
+ s0 = peg$f1(s1, s2);
5181
+ }
5182
+ else {
5183
+ peg$currPos = s0;
5184
+ s0 = peg$FAILED;
5185
+ }
5186
+ return s0;
5187
+ }
5188
+ function peg$parseJoinComparator() {
5189
+ let s0, s1, s2;
5190
+ s0 = peg$currPos;
5191
+ s1 = peg$parseComparator();
5192
+ if (s1 !== peg$FAILED) {
5193
+ s2 = peg$parseOpenEqualityCheck();
5194
+ if (s2 !== peg$FAILED) {
5195
+ peg$savedPos = s0;
5196
+ s0 = peg$f2(s1, s2);
5197
+ }
5198
+ else {
5199
+ peg$currPos = s0;
5200
+ s0 = peg$FAILED;
5201
+ }
5202
+ }
5203
+ else {
5204
+ peg$currPos = s0;
5205
+ s0 = peg$FAILED;
5206
+ }
5207
+ if (s0 === peg$FAILED) {
5208
+ s0 = peg$parseCompoundJoinComparator();
5209
+ }
5210
+ return s0;
5211
+ }
5212
+ function peg$parseCompoundJoinComparator() {
5213
+ let s0, s1, s2, s3, s4;
5214
+ s0 = peg$currPos;
5215
+ s1 = peg$parseComparator();
5216
+ if (s1 !== peg$FAILED) {
5217
+ s2 = peg$parsebracket();
5218
+ if (s2 !== peg$FAILED) {
5219
+ s3 = peg$parseOpenFormula();
5220
+ if (s3 !== peg$FAILED) {
5221
+ s4 = peg$parsebracket();
5222
+ if (s4 !== peg$FAILED) {
5223
+ peg$savedPos = s0;
5224
+ s0 = peg$f3(s1, s3);
5225
+ }
5226
+ else {
5227
+ peg$currPos = s0;
5228
+ s0 = peg$FAILED;
5229
+ }
5230
+ }
5231
+ else {
5232
+ peg$currPos = s0;
5233
+ s0 = peg$FAILED;
5234
+ }
5235
+ }
5236
+ else {
5237
+ peg$currPos = s0;
5238
+ s0 = peg$FAILED;
5239
+ }
5240
+ }
5241
+ else {
5242
+ peg$currPos = s0;
5243
+ s0 = peg$FAILED;
5244
+ }
5245
+ return s0;
5246
+ }
5247
+ function peg$parseOpenEqualityCheck() {
5248
+ let s0, s1, s2, s3, s4, s5;
5249
+ s0 = peg$currPos;
5250
+ s1 = peg$parseFieldRef();
5251
+ if (s1 !== peg$FAILED) {
5252
+ s2 = peg$parse_();
5253
+ if (s2 === peg$FAILED) {
5254
+ s2 = null;
5255
+ }
5256
+ s3 = peg$parseoperator();
5257
+ if (s3 !== peg$FAILED) {
5258
+ s4 = peg$parse_();
5259
+ if (s4 === peg$FAILED) {
5260
+ s4 = null;
5261
+ }
5262
+ s5 = peg$parseValue();
5263
+ if (s5 !== peg$FAILED) {
5264
+ peg$savedPos = s0;
5265
+ s0 = peg$f4(s1, s3, s5);
5266
+ }
5267
+ else {
5268
+ peg$currPos = s0;
5269
+ s0 = peg$FAILED;
5270
+ }
5271
+ }
5272
+ else {
5273
+ peg$currPos = s0;
5274
+ s0 = peg$FAILED;
5275
+ }
5276
+ }
5277
+ else {
5278
+ peg$currPos = s0;
5279
+ s0 = peg$FAILED;
5280
+ }
5281
+ return s0;
5282
+ }
5283
+ function peg$parseComparator() {
5284
+ let s0, s1, s2, s3;
5285
+ s0 = peg$currPos;
5286
+ s1 = peg$parse_();
5287
+ if (s1 === peg$FAILED) {
5288
+ s1 = null;
5289
+ }
5290
+ if (input.substr(peg$currPos, 3) === peg$c0) {
5291
+ s2 = peg$c0;
5292
+ peg$currPos += 3;
5293
+ }
5294
+ else {
5295
+ s2 = peg$FAILED;
5296
+ if (peg$silentFails === 0) {
5297
+ peg$fail(peg$e0);
5298
+ }
5299
+ }
5300
+ if (s2 !== peg$FAILED) {
5301
+ s3 = peg$parse_();
5302
+ if (s3 === peg$FAILED) {
5303
+ s3 = null;
5304
+ }
5305
+ peg$savedPos = s0;
5306
+ s0 = peg$f5(s2);
5307
+ }
5308
+ else {
5309
+ peg$currPos = s0;
5310
+ s0 = peg$FAILED;
5311
+ }
5312
+ if (s0 === peg$FAILED) {
5313
+ s0 = peg$currPos;
5314
+ s1 = peg$parse_();
5315
+ if (s1 === peg$FAILED) {
5316
+ s1 = null;
5317
+ }
5318
+ if (input.substr(peg$currPos, 2) === peg$c1) {
5319
+ s2 = peg$c1;
5320
+ peg$currPos += 2;
5321
+ }
5322
+ else {
5323
+ s2 = peg$FAILED;
5324
+ if (peg$silentFails === 0) {
5325
+ peg$fail(peg$e1);
5326
+ }
5327
+ }
5328
+ if (s2 !== peg$FAILED) {
5329
+ s3 = peg$parse_();
5330
+ if (s3 === peg$FAILED) {
5331
+ s3 = null;
5332
+ }
5333
+ peg$savedPos = s0;
5334
+ s0 = peg$f6(s2);
5335
+ }
5336
+ else {
5337
+ peg$currPos = s0;
5338
+ s0 = peg$FAILED;
5339
+ }
5340
+ }
5341
+ return s0;
5342
+ }
5343
+ function peg$parseWord() {
5344
+ let s0, s1, s2;
5345
+ s0 = peg$currPos;
5346
+ s1 = [];
5347
+ s2 = peg$parseLetter();
5348
+ if (s2 !== peg$FAILED) {
5349
+ while (s2 !== peg$FAILED) {
5350
+ s1.push(s2);
5351
+ s2 = peg$parseLetter();
5352
+ }
5353
+ }
5354
+ else {
5355
+ s1 = peg$FAILED;
5356
+ }
5357
+ if (s1 !== peg$FAILED) {
5358
+ peg$savedPos = s0;
5359
+ s1 = peg$f7(s1);
5360
+ }
5361
+ s0 = s1;
5362
+ return s0;
5363
+ }
5364
+ function peg$parseLetter() {
5365
+ let s0;
5366
+ s0 = input.charAt(peg$currPos);
5367
+ if (peg$r0.test(s0)) {
5368
+ peg$currPos++;
5369
+ }
5370
+ else {
5371
+ s0 = peg$FAILED;
5372
+ if (peg$silentFails === 0) {
5373
+ peg$fail(peg$e2);
5374
+ }
5375
+ }
5376
+ return s0;
5377
+ }
5378
+ function peg$parseValue() {
5379
+ let s0, s1;
5380
+ s0 = peg$parsequotedValue();
5381
+ if (s0 === peg$FAILED) {
5382
+ s0 = peg$currPos;
5383
+ s1 = peg$parseWord();
5384
+ if (s1 !== peg$FAILED) {
5385
+ peg$savedPos = s0;
5386
+ s1 = peg$f8(s1);
5387
+ }
5388
+ s0 = s1;
5389
+ if (s0 === peg$FAILED) {
5390
+ s0 = peg$currPos;
5391
+ s1 = peg$parsenumber();
5392
+ if (s1 !== peg$FAILED) {
5393
+ peg$savedPos = s0;
5394
+ s1 = peg$f9(s1);
5395
+ }
5396
+ s0 = s1;
5397
+ }
5398
+ }
5399
+ return s0;
5400
+ }
5401
+ function peg$parseFieldRef() {
5402
+ let s0;
5403
+ s0 = peg$parseFieldReference();
5404
+ if (s0 === peg$FAILED) {
5405
+ s0 = peg$parseMetadataFieldReference();
5406
+ }
5407
+ return s0;
5408
+ }
5409
+ function peg$parseMetadataFieldReference() {
5410
+ let s0, s1, s2, s3;
5411
+ s0 = peg$currPos;
5412
+ s1 = peg$parseopenSquare();
5413
+ if (s1 !== peg$FAILED) {
5414
+ s2 = peg$parseFieldReference();
5415
+ if (s2 !== peg$FAILED) {
5416
+ s3 = peg$parsecloseSquare();
5417
+ if (s3 !== peg$FAILED) {
5418
+ peg$savedPos = s0;
5419
+ s0 = peg$f10(s1, s2, s3);
5420
+ }
5421
+ else {
5422
+ peg$currPos = s0;
5423
+ s0 = peg$FAILED;
5424
+ }
5425
+ }
5426
+ else {
5427
+ peg$currPos = s0;
5428
+ s0 = peg$FAILED;
5429
+ }
5430
+ }
5431
+ else {
5432
+ peg$currPos = s0;
5433
+ s0 = peg$FAILED;
5434
+ }
5435
+ return s0;
5436
+ }
5437
+ function peg$parseFieldReference() {
5438
+ let s0, s1, s2;
5439
+ s0 = peg$currPos;
5440
+ s1 = [];
5441
+ s2 = input.charAt(peg$currPos);
5442
+ if (peg$r1.test(s2)) {
5443
+ peg$currPos++;
5444
+ }
5445
+ else {
5446
+ s2 = peg$FAILED;
5447
+ if (peg$silentFails === 0) {
5448
+ peg$fail(peg$e3);
5449
+ }
5450
+ }
5451
+ if (s2 !== peg$FAILED) {
5452
+ while (s2 !== peg$FAILED) {
5453
+ s1.push(s2);
5454
+ s2 = input.charAt(peg$currPos);
5455
+ if (peg$r1.test(s2)) {
5456
+ peg$currPos++;
5457
+ }
5458
+ else {
5459
+ s2 = peg$FAILED;
5460
+ if (peg$silentFails === 0) {
5461
+ peg$fail(peg$e3);
5462
+ }
5463
+ }
5464
+ }
5465
+ }
5466
+ else {
5467
+ s1 = peg$FAILED;
5468
+ }
5469
+ if (s1 !== peg$FAILED) {
5470
+ peg$savedPos = s0;
5471
+ s1 = peg$f11(s1);
5472
+ }
5473
+ s0 = s1;
5474
+ return s0;
5475
+ }
5476
+ function peg$parseopenSquare() {
5477
+ let s0;
5478
+ if (input.charCodeAt(peg$currPos) === 91) {
5479
+ s0 = peg$c2;
5480
+ peg$currPos++;
5481
+ }
5482
+ else {
5483
+ s0 = peg$FAILED;
5484
+ if (peg$silentFails === 0) {
5485
+ peg$fail(peg$e4);
5486
+ }
5487
+ }
5488
+ return s0;
5489
+ }
5490
+ function peg$parsecloseSquare() {
5491
+ let s0;
5492
+ if (input.charCodeAt(peg$currPos) === 93) {
5493
+ s0 = peg$c3;
5494
+ peg$currPos++;
5495
+ }
5496
+ else {
5497
+ s0 = peg$FAILED;
5498
+ if (peg$silentFails === 0) {
5499
+ peg$fail(peg$e5);
5500
+ }
5501
+ }
5502
+ return s0;
5503
+ }
5504
+ function peg$parsenumber() {
5505
+ let s0, s1;
5506
+ s0 = [];
5507
+ s1 = input.charAt(peg$currPos);
5508
+ if (peg$r2.test(s1)) {
5509
+ peg$currPos++;
5510
+ }
5511
+ else {
5512
+ s1 = peg$FAILED;
5513
+ if (peg$silentFails === 0) {
5514
+ peg$fail(peg$e6);
5515
+ }
5516
+ }
5517
+ if (s1 !== peg$FAILED) {
5518
+ while (s1 !== peg$FAILED) {
5519
+ s0.push(s1);
5520
+ s1 = input.charAt(peg$currPos);
5521
+ if (peg$r2.test(s1)) {
5522
+ peg$currPos++;
5523
+ }
5524
+ else {
5525
+ s1 = peg$FAILED;
5526
+ if (peg$silentFails === 0) {
5527
+ peg$fail(peg$e6);
5528
+ }
5529
+ }
5530
+ }
5531
+ }
5532
+ else {
5533
+ s0 = peg$FAILED;
5534
+ }
5535
+ return s0;
5536
+ }
5537
+ function peg$parsequotedValue() {
5538
+ let s0, s1, s2, s3;
5539
+ s0 = peg$currPos;
5540
+ if (input.charCodeAt(peg$currPos) === 34) {
5541
+ s1 = peg$c4;
5542
+ peg$currPos++;
5543
+ }
5544
+ else {
5545
+ s1 = peg$FAILED;
5546
+ if (peg$silentFails === 0) {
5547
+ peg$fail(peg$e7);
5548
+ }
5549
+ }
5550
+ if (s1 !== peg$FAILED) {
5551
+ s2 = [];
5552
+ s3 = input.charAt(peg$currPos);
5553
+ if (peg$r3.test(s3)) {
5554
+ peg$currPos++;
5555
+ }
5556
+ else {
5557
+ s3 = peg$FAILED;
5558
+ if (peg$silentFails === 0) {
5559
+ peg$fail(peg$e8);
5560
+ }
5561
+ }
5562
+ while (s3 !== peg$FAILED) {
5563
+ s2.push(s3);
5564
+ s3 = input.charAt(peg$currPos);
5565
+ if (peg$r3.test(s3)) {
5566
+ peg$currPos++;
5567
+ }
5568
+ else {
5569
+ s3 = peg$FAILED;
5570
+ if (peg$silentFails === 0) {
5571
+ peg$fail(peg$e8);
5572
+ }
5573
+ }
5574
+ }
5575
+ if (input.charCodeAt(peg$currPos) === 34) {
5576
+ s3 = peg$c4;
5577
+ peg$currPos++;
5578
+ }
5579
+ else {
5580
+ s3 = peg$FAILED;
5581
+ if (peg$silentFails === 0) {
5582
+ peg$fail(peg$e7);
5583
+ }
5584
+ }
5585
+ if (s3 !== peg$FAILED) {
5586
+ peg$savedPos = s0;
5587
+ s0 = peg$f12(s2);
5588
+ }
5589
+ else {
5590
+ peg$currPos = s0;
5591
+ s0 = peg$FAILED;
5592
+ }
5593
+ }
5594
+ else {
5595
+ peg$currPos = s0;
5596
+ s0 = peg$FAILED;
5597
+ }
5598
+ return s0;
5599
+ }
5600
+ function peg$parsebracket() {
5601
+ let s0, s1, s2, s3;
5602
+ s0 = peg$currPos;
5603
+ s1 = peg$parse_();
5604
+ if (s1 === peg$FAILED) {
5605
+ s1 = null;
5606
+ }
5607
+ s2 = [];
5608
+ if (input.charCodeAt(peg$currPos) === 40) {
5609
+ s3 = peg$c5;
5610
+ peg$currPos++;
5611
+ }
5612
+ else {
5613
+ s3 = peg$FAILED;
5614
+ if (peg$silentFails === 0) {
5615
+ peg$fail(peg$e9);
5616
+ }
5617
+ }
5618
+ if (s3 !== peg$FAILED) {
5619
+ while (s3 !== peg$FAILED) {
5620
+ s2.push(s3);
5621
+ if (input.charCodeAt(peg$currPos) === 40) {
5622
+ s3 = peg$c5;
5623
+ peg$currPos++;
5624
+ }
5625
+ else {
5626
+ s3 = peg$FAILED;
5627
+ if (peg$silentFails === 0) {
5628
+ peg$fail(peg$e9);
5629
+ }
5630
+ }
5631
+ }
5632
+ }
5633
+ else {
5634
+ s2 = peg$FAILED;
5635
+ }
5636
+ if (s2 !== peg$FAILED) {
5637
+ s3 = peg$parse_();
5638
+ if (s3 === peg$FAILED) {
5639
+ s3 = null;
5640
+ }
5641
+ s1 = [s1, s2, s3];
5642
+ s0 = s1;
5643
+ }
5644
+ else {
5645
+ peg$currPos = s0;
5646
+ s0 = peg$FAILED;
5647
+ }
5648
+ if (s0 === peg$FAILED) {
5649
+ s0 = peg$currPos;
5650
+ s1 = peg$parse_();
5651
+ if (s1 === peg$FAILED) {
5652
+ s1 = null;
5653
+ }
5654
+ s2 = [];
5655
+ if (input.charCodeAt(peg$currPos) === 41) {
5656
+ s3 = peg$c6;
5657
+ peg$currPos++;
5658
+ }
5659
+ else {
5660
+ s3 = peg$FAILED;
5661
+ if (peg$silentFails === 0) {
5662
+ peg$fail(peg$e10);
5663
+ }
5664
+ }
5665
+ if (s3 !== peg$FAILED) {
5666
+ while (s3 !== peg$FAILED) {
5667
+ s2.push(s3);
5668
+ if (input.charCodeAt(peg$currPos) === 41) {
5669
+ s3 = peg$c6;
5670
+ peg$currPos++;
5671
+ }
5672
+ else {
5673
+ s3 = peg$FAILED;
5674
+ if (peg$silentFails === 0) {
5675
+ peg$fail(peg$e10);
5676
+ }
5677
+ }
5678
+ }
5679
+ }
5680
+ else {
5681
+ s2 = peg$FAILED;
5682
+ }
5683
+ if (s2 !== peg$FAILED) {
5684
+ s3 = peg$parse_();
5685
+ if (s3 === peg$FAILED) {
5686
+ s3 = null;
5687
+ }
5688
+ s1 = [s1, s2, s3];
5689
+ s0 = s1;
5690
+ }
5691
+ else {
5692
+ peg$currPos = s0;
5693
+ s0 = peg$FAILED;
5694
+ }
5695
+ }
5696
+ return s0;
5697
+ }
5698
+ function peg$parseoperator() {
5699
+ let s0;
5700
+ if (input.charCodeAt(peg$currPos) === 61) {
5701
+ s0 = peg$c7;
5702
+ peg$currPos++;
5703
+ }
5704
+ else {
5705
+ s0 = peg$FAILED;
5706
+ if (peg$silentFails === 0) {
5707
+ peg$fail(peg$e11);
5708
+ }
5709
+ }
5710
+ if (s0 === peg$FAILED) {
5711
+ if (input.substr(peg$currPos, 2) === peg$c8) {
5712
+ s0 = peg$c8;
5713
+ peg$currPos += 2;
5714
+ }
5715
+ else {
5716
+ s0 = peg$FAILED;
5717
+ if (peg$silentFails === 0) {
5718
+ peg$fail(peg$e12);
5719
+ }
5720
+ }
5721
+ if (s0 === peg$FAILED) {
5722
+ if (input.substr(peg$currPos, 8) === peg$c9) {
5723
+ s0 = peg$c9;
5724
+ peg$currPos += 8;
5725
+ }
5726
+ else {
5727
+ s0 = peg$FAILED;
5728
+ if (peg$silentFails === 0) {
5729
+ peg$fail(peg$e13);
5730
+ }
5731
+ }
5732
+ }
5733
+ }
5734
+ return s0;
5735
+ }
5736
+ function peg$parsews() {
5737
+ let s0, s1;
5738
+ peg$silentFails++;
5739
+ s0 = input.charAt(peg$currPos);
5740
+ if (peg$r4.test(s0)) {
5741
+ peg$currPos++;
5742
+ }
5743
+ else {
5744
+ s0 = peg$FAILED;
5745
+ if (peg$silentFails === 0) {
5746
+ peg$fail(peg$e15);
5747
+ }
5748
+ }
5749
+ peg$silentFails--;
5750
+ if (s0 === peg$FAILED) {
5751
+ s1 = peg$FAILED;
5752
+ if (peg$silentFails === 0) {
5753
+ peg$fail(peg$e14);
5754
+ }
5755
+ }
5756
+ return s0;
5757
+ }
5758
+ function peg$parse_() {
5759
+ let s0, s1;
5760
+ peg$silentFails++;
5761
+ s0 = [];
5762
+ s1 = peg$parsews();
5763
+ if (s1 !== peg$FAILED) {
5764
+ while (s1 !== peg$FAILED) {
5765
+ s0.push(s1);
5766
+ s1 = peg$parsews();
5767
+ }
5768
+ }
5769
+ else {
5770
+ s0 = peg$FAILED;
5771
+ }
5772
+ peg$silentFails--;
5773
+ if (s0 === peg$FAILED) {
5774
+ s1 = peg$FAILED;
5775
+ if (peg$silentFails === 0) {
5776
+ peg$fail(peg$e16);
5777
+ }
5778
+ }
5779
+ return s0;
5780
+ }
4802
5781
  function flat(arr, depth = 1) {
4803
- var flatten = function (arr, depth = 1) {
4804
- if (depth) return arr;
4805
-
4806
- // Otherwise, concatenate into the parent array
4807
- return arr.reduce(function (acc, val) {
4808
- return acc.concat(Array.isArray(val) ? flatten(val, depth - 1) : val);
4809
- }, []);
4810
-
4811
- };
4812
-
4813
- return flatten(arr, depth - 1);
5782
+ var flatten = function (arr, depth = 1) {
5783
+ if (depth)
5784
+ return arr;
5785
+ // Otherwise, concatenate into the parent array
5786
+ return arr.reduce(function (acc, val) {
5787
+ return acc.concat(Array.isArray(val) ? flatten(val, depth - 1) : val);
5788
+ }, []);
5789
+ };
5790
+ return flatten(arr, depth - 1);
5791
+ }
5792
+ peg$result = peg$startRuleFunction();
5793
+ const peg$success = (peg$result !== peg$FAILED && peg$currPos === input.length);
5794
+ function peg$throw() {
5795
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
5796
+ peg$fail(peg$endExpectation());
5797
+ }
5798
+ throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? peg$getUnicode(peg$maxFailPos) : null, peg$maxFailPos < input.length
5799
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
5800
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
5801
+ }
5802
+ if (options.peg$library) {
5803
+ return /** @type {any} */ ({
5804
+ peg$result,
5805
+ peg$currPos,
5806
+ peg$FAILED,
5807
+ peg$maxFailExpected,
5808
+ peg$maxFailPos,
5809
+ peg$success,
5810
+ peg$throw: peg$success ? undefined : peg$throw,
5811
+ });
4814
5812
  }
4815
- }
4816
-
4817
- Start
4818
- = Formula
4819
-
4820
- Formula
4821
- = EnclosedFormula
4822
- / OpenFormula
4823
-
4824
- EnclosedFormula
4825
- = bracket formula:OpenFormula bracket join:(JoinComparator)*
4826
- { return flat([ [formula], join[0] ], 1) }
4827
-
4828
- OpenFormula
4829
- = eq:OpenEqualityCheck joins:(JoinComparator)*
4830
- { return flat([ eq, flat(joins) ]) }
4831
-
4832
- JoinComparator
4833
- = comp:Comparator eq:OpenEqualityCheck
4834
- { return [comp, eq]; }
4835
- / CompoundJoinComparator
4836
-
4837
- CompoundJoinComparator
4838
- = comp:Comparator bracket f:OpenFormula bracket
4839
- { return [comp, f ] }
4840
-
4841
- OpenEqualityCheck
4842
- = fr:FieldRef _? op:operator _? val:Value
4843
- { return { fieldReference: fr, comparator: op, value: val } }
4844
-
4845
- Comparator
4846
- = _? c:'AND' _?
4847
- { return c; }
4848
- / _? c:'OR' _?
4849
- { return c; }
4850
-
4851
- Word
4852
- = l:Letter+
4853
- { return l.join(""); }
4854
-
4855
- Letter
4856
- = [a-zA-Z]
4857
-
4858
- Value
4859
- = v:quotedValue / v:Word
4860
- { return v.join("") }
4861
- / v:number
4862
- { return parseInt(v.join("")) }
4863
-
4864
- FieldRef
4865
- = FieldReference / MetadataFieldReference
4866
-
4867
- MetadataFieldReference
4868
- = s1:openSquare fr:FieldReference s2:closeSquare
4869
- { return s1 + fr + s2 }
4870
-
4871
- FieldReference
4872
- = characters:[A-Za-z0-9._-]+ { return characters.join(""); }
4873
-
4874
- openSquare
4875
- = "["
4876
-
4877
- closeSquare
4878
- = "]"
4879
-
4880
- number
4881
- = [0-9]+
4882
-
4883
- quotedValue
4884
- = '"'val:[A-Za-z0-9.,* _&()/-]*'"'
4885
- { return val.join(""); }
4886
-
4887
- bracket
4888
- = (_? "("+ _? / _? ")"+ _? )
4889
-
4890
- operator
4891
- = "=" / "!=" / "CONTAINS"
4892
-
4893
- ws "Whitespace"
4894
- = [ \t]
4895
-
4896
- _ "One or more whitespaces"
4897
- = ws+
5813
+ if (peg$success) {
5814
+ return peg$result;
5815
+ }
5816
+ else {
5817
+ peg$throw();
5818
+ }
5819
+ }
5820
+ const peg$allowedStartRules = [
5821
+ "Start"
5822
+ ];
4898
5823
 
4899
- nl "New line"
4900
- = "\\n"`;
4901
- var peg = generate(conditionSource);
5824
+ var parser = /*#__PURE__*/Object.freeze({
5825
+ __proto__: null,
5826
+ StartRules: peg$allowedStartRules,
5827
+ SyntaxError: peg$SyntaxError,
5828
+ parse: peg$parse
5829
+ });
4902
5830
 
4903
5831
  class ConditionParser {
4904
5832
  static logger = new StructuredLoggerService();
@@ -4912,7 +5840,7 @@ class ConditionParser {
4912
5840
  return null;
4913
5841
  }
4914
5842
  condition = condition.replace(/CONTAINS/g, ' CONTAINS');
4915
- return peg.parse(condition.trim(), {});
5843
+ return parser.parse(condition.trim(), {});
4916
5844
  }
4917
5845
  /**
4918
5846
  * Evaluate the current fields against the conditions
@@ -8671,33 +9599,31 @@ class CaseAccessUtils {
8671
9599
  static CTSC_ROLE = 'ctsc';
8672
9600
  static CTSC_ROLE_CATEGORY = 'CTSC';
8673
9601
  static CTSC_ROLE_NAME = 'ctsc';
8674
- // fallback purely if roleCategories is not available in
8675
- getMappedRoleCategories(roles = []) {
9602
+ getMappedRoleCategory(roles = [], roleCategories = []) {
8676
9603
  const roleKeywords = roles.join().split('-').join().split(',');
8677
- const roleCategoryList = [];
8678
- if (this.roleOrCategoryExists(CaseAccessUtils.JUDGE_ROLE, roleKeywords)) {
8679
- roleCategoryList.push(CaseAccessUtils.JUDGE_ROLE_CATEGORY);
9604
+ if (this.roleOrCategoryExists(CaseAccessUtils.JUDGE_ROLE, CaseAccessUtils.JUDGE_ROLE_CATEGORY, roleKeywords, roleCategories)) {
9605
+ return CaseAccessUtils.JUDGE_ROLE_CATEGORY;
8680
9606
  }
8681
- if (this.roleOrCategoryExists(CaseAccessUtils.PROFESSIONAL_ROLE, roleKeywords)) {
8682
- roleCategoryList.push(CaseAccessUtils.PROFESSIONAL_ROLE_CATEGORY);
9607
+ else if (this.roleOrCategoryExists(CaseAccessUtils.PROFESSIONAL_ROLE, CaseAccessUtils.PROFESSIONAL_ROLE_CATEGORY, roleKeywords, roleCategories)) {
9608
+ return CaseAccessUtils.PROFESSIONAL_ROLE_CATEGORY;
8683
9609
  }
8684
- if (this.roleOrCategoryExists(CaseAccessUtils.CITIZEN_ROLE, roleKeywords)) {
8685
- roleCategoryList.push(CaseAccessUtils.CITIZEN_ROLE_CATEGORY);
9610
+ else if (this.roleOrCategoryExists(CaseAccessUtils.CITIZEN_ROLE, CaseAccessUtils.CITIZEN_ROLE_CATEGORY, roleKeywords, roleCategories)) {
9611
+ return CaseAccessUtils.CITIZEN_ROLE_CATEGORY;
8686
9612
  }
8687
- if (this.roleOrCategoryExists(CaseAccessUtils.ADMIN_ROLE, roleKeywords)) {
8688
- roleCategoryList.push(CaseAccessUtils.ADMIN_ROLE_CATEGORY);
9613
+ else if (this.roleOrCategoryExists(CaseAccessUtils.ADMIN_ROLE, CaseAccessUtils.ADMIN_ROLE_CATEGORY, roleKeywords, roleCategories)) {
9614
+ return CaseAccessUtils.ADMIN_ROLE_CATEGORY;
8689
9615
  }
8690
- if (this.roleOrCategoryExists(CaseAccessUtils.CTSC_ROLE, roleKeywords)) {
8691
- roleCategoryList.push(CaseAccessUtils.CTSC_ROLE_CATEGORY);
9616
+ else if (this.roleOrCategoryExists(CaseAccessUtils.CTSC_ROLE, CaseAccessUtils.CTSC_ROLE_CATEGORY, roleKeywords, roleCategories)) {
9617
+ return CaseAccessUtils.CTSC_ROLE_CATEGORY;
8692
9618
  }
8693
- if (this.roleOrCategoryExists(CaseAccessUtils.LEGAL_OPERATIONS_ROLE, roleKeywords)) {
8694
- roleCategoryList.push(CaseAccessUtils.LEGAL_OPERATIONS_ROLE_CATEGORY);
9619
+ else {
9620
+ return CaseAccessUtils.LEGAL_OPERATIONS_ROLE_CATEGORY;
8695
9621
  }
8696
- return roleCategoryList;
8697
9622
  }
8698
- roleOrCategoryExists(roleKeyword, roleKeywords) {
9623
+ roleOrCategoryExists(roleKeyword, roleCategory, roleKeywords, roleCategories) {
9624
+ const categoryExists = roleCategories.indexOf(roleCategory) > -1;
8699
9625
  const keywordExists = roleKeywords.indexOf(roleKeyword) > -1;
8700
- return keywordExists;
9626
+ return categoryExists ? categoryExists : keywordExists;
8701
9627
  }
8702
9628
  getAMRoleName(accessType, aMRole) {
8703
9629
  let roleName = '';
@@ -10585,21 +11511,16 @@ class CasesService {
10585
11511
  const userInfoStr = this.sessionStorageService.getItem('userDetails');
10586
11512
  const camUtils = new CaseAccessUtils();
10587
11513
  let userInfo;
10588
- userInfo = userInfoStr ? JSON.parse(userInfoStr) : null;
10589
- if (!userInfo) {
10590
- return throwError(() => new Error('User info not found in session storage'));
10591
- }
10592
- // EXUI-4758 - getMappedRoleCategories no longer returns a single string, checks all roles to get the most likely roleCategory
10593
- // Unsure whether we should be using mapped role categories any more - should trust the roleCategories from userInfo if they exist
10594
- const roleCategories = userInfo.roleCategories || camUtils.getMappedRoleCategories(userInfo.roles);
10595
- const roleName = camUtils.getAMRoleName('challenged', roleCategories[0]);
11514
+ if (userInfoStr) {
11515
+ userInfo = JSON.parse(userInfoStr);
11516
+ }
11517
+ const roleCategory = userInfo.roleCategory || camUtils.getMappedRoleCategory(userInfo.roles, userInfo.roleCategories);
11518
+ const roleName = camUtils.getAMRoleName('challenged', roleCategory);
10596
11519
  const beginTime = new Date();
10597
11520
  const endTime = new Date(new Date().setUTCHours(23, 59, 59, 999));
10598
11521
  const id = userInfo.id ? userInfo.id : userInfo.uid;
10599
11522
  const isNew = true;
10600
- const payload = camUtils.getAMPayload(id, id, roleName,
10601
- // EXUI-4758 - Return first roleCategory as the roleCategory
10602
- roleCategories[0], 'CHALLENGED', caseId, request, beginTime, endTime, isNew);
11523
+ const payload = camUtils.getAMPayload(id, id, roleName, roleCategory, 'CHALLENGED', caseId, request, beginTime, endTime, isNew);
10603
11524
  return this.http.post(`/api/challenged-access-request`, payload);
10604
11525
  }
10605
11526
  createSpecificAccessRequest(caseId, sar) {
@@ -10607,14 +11528,10 @@ class CasesService {
10607
11528
  const userInfoStr = this.sessionStorageService.getItem('userDetails');
10608
11529
  const camUtils = new CaseAccessUtils();
10609
11530
  let userInfo;
10610
- userInfo = userInfoStr ? JSON.parse(userInfoStr) : null;
10611
- if (!userInfo) {
10612
- return throwError(() => new Error('User info not found in session storage'));
10613
- }
10614
- // EXUI-4758 - See above comment
10615
- const roleCategories = userInfo.roleCategories || camUtils.getMappedRoleCategories(userInfo.roles);
10616
- // EXUI-4758 - Return first roleCategory as the roleCategory for now
10617
- const roleCategory = roleCategories[0];
11531
+ if (userInfoStr) {
11532
+ userInfo = JSON.parse(userInfoStr);
11533
+ }
11534
+ const roleCategory = userInfo.roleCategory || camUtils.getMappedRoleCategory(userInfo.roles, userInfo.roleCategories);
10618
11535
  const roleName = camUtils.getAMRoleName('specific', roleCategory);
10619
11536
  const id = userInfo.id ? userInfo.id : userInfo.uid;
10620
11537
  const payload = camUtils.getAMPayload(null, id, roleName, roleCategory, 'SPECIFIC', caseId, sar, null, null, true);