Passed
Push — task/batch-request-skills-step ( 70a28a...6605f8 )
by Tristan
14:13 queued 09:46
created

resources/assets/js/models/localizedConstants.tsx   A

Complexity

Total Complexity 11
Complexity/F 0

Size

Lines of Code 1381
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 11
eloc 1102
mnd 11
bc 11
fnc 0
dl 0
loc 1381
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
rs 9.192
1
/* eslint camelcase: "off", @typescript-eslint/camelcase: "off" */
2
import { defineMessages, MessageDescriptor, IntlShape } from "react-intl";
3
import {
4
  AssessmentTypeId,
5
  AssessmentTypeIdValues,
6
  CriteriaTypeId,
7
  CriteriaTypeIdValues,
8
  SkillLevelId,
9
  SkillLevelIdValues,
10
  SkillTypeId,
11
  SkillTypeIdValues,
12
  ProvinceId,
13
  SecurityClearanceId,
14
  LanguageRequirementId,
15
  FrequencyId,
16
  OvertimeRequirementId,
17
  TravelRequirementId,
18
  ClassificationId,
19
  LocationId,
20
  ResponseScreeningBuckets as ResponseBuckets,
21
} from "./lookupConstants";
22
import { getOrThrowError } from "../helpers/queries";
23
import { Experience } from "./types";
24
25
const skillLevelDescriptions = defineMessages({
26
  hardBasic: {
27
    id: "skillLevel.hard.basic.description",
28
    defaultMessage:
29
      "You have the ability to accomplish basic tasks with steady supervision and clear direction. The tasks you’re assigned are clear and don’t involve significant complexity. Their impact is usually locally felt. As you advance in this category, you should be developing the ability to accomplish tasks of moderate complexity with steady supervision. You will also need to be able to accomplish basic tasks with little or no supervision. This level is usually associated with tasks that form the bulk of the work for lower level positions, such as junior analysts or entry level developers.",
30
    description: "Description of basic hard skill level.",
31
  },
32
  hardIntermediate: {
33
    id: "skillLevel.hard.intermediate.description",
34
    defaultMessage:
35
      "You have the ability to accomplish tasks of moderate complexity or moderate impact with supervision. The approach to the tasks, and how they are delivered, is determined by the supervisor. You contribute input and advice. You are able to advance the task, even in the face of small to moderate hurdles and complications. As you advance in this category, you should be developing the ability to accomplish tasks of significant complexity or larger impact with steady supervision. You will also need to be able to accomplish tasks of moderate complexity or impact with little or no supervision. This level is usually associated with tasks that form the bulk of the work for mid-level positions, such as analysts or developers.",
36
    description: "Description of intermediate skill level.",
37
  },
38
  hardAdvanced: {
39
    id: "skillLevel.hard.advanced.description",
40
    defaultMessage:
41
      "You have the ability to accomplish tasks of significant complexity or impact with supervision. You provide advice and input on the approach to the tasks, and how they are delivered, for the supervisor’s consideration. You are able to advance the task, even in the face of moderate to large hurdles and complications. As you advance in this category, you should be developing the ability to accomplish tasks of significant complexity or larger impact with only light levels of supervision, where you are effectively the lead on the initiative. You may also take on a role of training others in this skills set or take on a light supervisory role for those at lower levels. This level is usually associated with tasks that form the bulk of the work for higher level positions, such as senior analysts or senior developers.",
42
    description: "Description of advanced hard skill level.",
43
  },
44
  hardExpert: {
45
    id: "skillLevel.hard.expert.description",
46
    defaultMessage:
47
      "You have the ability to accomplish tasks of significant complexity or impact, where you call the shots and answer to the organization’s senior management for your decisions. You bring forward the tasks, the approach and the delivery plan for senior management consideration. You often supervise others (individuals or teams) in delivering tasks of high complexity or system wide impact. You are able to advance these tasks, even in the face of significant unforeseen hurdles and complications. As you advance in this category, you should be developing the ability to assess others at more junior levels, becoming able to clearly identify the difference between beginner, intermediate and advanced tasks. You should be able to build teams, set direction and provide supervision. This level is usually associated with tasks that form the bulk of the work for management and executive level positions.",
48
    description: "Description of expert hard skill level.",
49
  },
50
  softBasic: {
51
    id: "skillLevel.soft.basic.description",
52
    defaultMessage:
53
      "You’re working on acquiring this skill or attribute. You are able to demonstrate it under favourable conditions (low stress, minimal difficulty) and can apply it in a work context intermittently.",
54
    description: "Description of soft basic skill level.",
55
  },
56
  softIntermediate: {
57
    id: "skillLevel.soft.intermediate.description",
58
    defaultMessage:
59
      "You’re able to consistently demonstrate this skill or attribute in the workplace, including under conditions of low-to-moderate stress or difficulty. Your peers and supervisors are able to attest to the fact that you have been able to demonstrate this skill or attribute on a regular basis.",
60
    description: "Description of soft intermediate skill level.",
61
  },
62
  softAdvanced: {
63
    id: "skillLevel.soft.advanced.description",
64
    defaultMessage:
65
      "You’re able to consistently demonstrate this skill or attribute in the workplace, including under conditions of high stress or difficulty. Your peers and supervisors recognize this as a strength you demonstrate in the workplace.",
66
    description: "Description of soft advanced skill level.",
67
  },
68
  softExpert: {
69
    id: "skillLevel.soft.expert.description",
70
    defaultMessage:
71
      "This is a foundational part of who you are. You consistently demonstrate this skill or attribute, even under conditions of extreme stress or difficulty. Your peers and supervisors recognize this as a significant strength you demonstrate in the workplace, providing an example to others.",
72
    description: "Description of expert soft skill level.",
73
  },
74
  asset: {
75
    id: "skillLevel.asset.description",
76
    defaultMessage:
77
      "This skill isn't required for the employee to do the job, but it provides an added benefit to their skillset and will improve the speed or effectiveness of their work.",
78
    description: "Description of what it means to be an 'Asset' skill.",
79
  },
80
});
81
82
const skillLevelNames = defineMessages({
83
  hardBasic: {
84
    id: "skillLevel.hard.basic.name",
85
    defaultMessage: "Beginner",
86
    description: "Single-word descriptor of basic hard skill level.",
87
  },
88
  hardIntermediate: {
89
    id: "skillLevel.hard.intermediate.name",
90
    defaultMessage: "Intermediate",
91
    description: "Single-word descriptor of intermediate hard skill level.",
92
  },
93
  hardAdvanced: {
94
    id: "skillLevel.hard.advanced.name",
95
    defaultMessage: "Advanced",
96
    description: "Single-word descriptor of advanced hard skill level.",
97
  },
98
  hardExpert: {
99
    id: "skillLevel.hard.expert.name",
100
    defaultMessage: "Expert",
101
    description: "Single-word descriptor of expert hard skill level.",
102
  },
103
  softBasic: {
104
    id: "skillLevel.soft.basic.name",
105
    defaultMessage: "In Early Development",
106
    description: "Single-word descriptor of soft basic skill level.",
107
  },
108
  softIntermediate: {
109
    id: "skillLevel.soft.intermediate.name",
110
    defaultMessage: "Moderately in Evidence",
111
    description: "Single-word descriptor of soft intermediate skill level.",
112
  },
113
  softAdvanced: {
114
    id: "skillLevel.soft.advanced.name",
115
    defaultMessage: "Strongly in Evidence",
116
    description: "Single-word descriptor of soft advanced skill level.",
117
  },
118
  softExpert: {
119
    id: "skillLevel.soft.expert.name",
120
    defaultMessage: "Deep Level Demonstration",
121
    description: "Single-word descriptor of soft expert skill level.",
122
  },
123
  asset: {
124
    id: "skillLevel.asset.name",
125
    defaultMessage: "Asset / No Level Required",
126
    description: "Name for 'Asset' skills.",
127
  },
128
});
129
130
const skillLevelL10n = (
131
  skillLevelId: number,
132
  skillTypeId: number,
133
  l10nObj: Record<
134
    string,
135
    {
136
      id: string;
137
      defaultMessage: string;
138
      description: string;
139
    }
140
  >,
141
): MessageDescriptor => {
142
  if (!SkillLevelIdValues.includes(skillLevelId)) {
143
    throw new Error("invalid SkillLevelIdValue");
144
  }
145
  if (!SkillTypeIdValues.includes(skillTypeId)) {
146
    throw new Error("invalid SkillTypeIdValue");
147
  }
148
  const basicKey = SkillLevelId.Basic.toString();
149
  const intermediateKey = SkillLevelId.Intermediate.toString();
150
  const advancedKey = SkillLevelId.Advanced.toString();
151
  const expertKey = SkillLevelId.Expert.toString();
152
  return {
153
    [SkillTypeId.Hard.toString()]: {
154
      [basicKey]: l10nObj.hardBasic,
155
      [intermediateKey]: l10nObj.hardIntermediate,
156
      [advancedKey]: l10nObj.hardAdvanced,
157
      [expertKey]: l10nObj.hardExpert,
158
    },
159
    [SkillTypeId.Soft.toString()]: {
160
      [basicKey]: l10nObj.softBasic,
161
      [intermediateKey]: l10nObj.softIntermediate,
162
      [advancedKey]: l10nObj.softAdvanced,
163
      [expertKey]: l10nObj.softExpert,
164
    },
165
  }[skillTypeId.toString()][skillLevelId.toString()];
166
};
167
168
export const skillLevelDescription = (
169
  skillLevelId: number,
170
  skillTypeId: number,
171
): MessageDescriptor =>
172
  skillLevelL10n(skillLevelId, skillTypeId, skillLevelDescriptions);
173
174
export const skillLevelName = (
175
  skillLevelId: number,
176
  skillTypeId: number,
177
): MessageDescriptor =>
178
  skillLevelL10n(skillLevelId, skillTypeId, skillLevelNames);
179
180
const assessmentTypes = defineMessages({
181
  narrativeAssessment: {
182
    id: "assessmentType.narrativeAssessment",
183
    defaultMessage: "Narrative Review",
184
    description: "Title of an assessment type.",
185
  },
186
  applicationScreeningQuestion: {
187
    id: "assessmentType.applicationScreeningQuestion",
188
    defaultMessage: "Application Screening Question",
189
    description: "Title of an assessment type.",
190
  },
191
  groupTest: {
192
    id: "assessmentType.groupTest",
193
    defaultMessage: "Group Test",
194
    description: "Title of an assessment type.",
195
  },
196
  informalPhoneConversation: {
197
    id: "assessmentType.informalPhoneConversation",
198
    defaultMessage: "Informal Phone Conversation",
199
    description: "Title of an assessment type.",
200
  },
201
  interview: {
202
    id: "assessmentType.interview",
203
    defaultMessage: "Interview",
204
    description: "Title of an assessment type.",
205
  },
206
  onlineExam: {
207
    id: "assessmentType.onlineExam",
208
    defaultMessage: "Online Exam",
209
    description: "Title of an assessment type.",
210
  },
211
  onSiteExam: {
212
    id: "assessmentType.onSiteExam",
213
    defaultMessage: "On-Site Exam",
214
    description: "Title of an assessment type.",
215
  },
216
  takeHomeExam: {
217
    id: "assessmentType.takeHomeExam",
218
    defaultMessage: "Take Home Exam",
219
    description: "Title of an assessment type.",
220
  },
221
  portfolioReview: {
222
    id: "assessmentType.portfolioReview",
223
    defaultMessage: "Portfolio Review",
224
    description: "Title of an assessment type.",
225
  },
226
  referenceCheck: {
227
    id: "assessmentType.referenceCheck",
228
    defaultMessage: "Reference Check",
229
    description: "Title of an assessment type.",
230
  },
231
  seriousGames: {
232
    id: "assessmentType.seriousGames",
233
    defaultMessage: "Serious Games",
234
    description: "Title of an assessment type.",
235
  },
236
});
237
238
export const assetSkillName = (): MessageDescriptor => skillLevelNames.asset;
239
export const assetSkillDescription = (): MessageDescriptor =>
240
  skillLevelDescriptions.asset;
241
242
export const assessmentType = (assessmentTypeId: number): MessageDescriptor => {
243
  if (!AssessmentTypeIdValues.includes(assessmentTypeId)) {
244
    throw new Error("invalid AssessmentTypeValue");
245
  }
246
  return {
247
    [AssessmentTypeId.ApplicationScreeningQuestion]:
248
      assessmentTypes.applicationScreeningQuestion,
249
    [AssessmentTypeId.GroupTest]: assessmentTypes.groupTest,
250
    [AssessmentTypeId.InformalPhoneConversation]:
251
      assessmentTypes.informalPhoneConversation,
252
    [AssessmentTypeId.Interview]: assessmentTypes.interview,
253
    [AssessmentTypeId.NarrativeAssessment]: assessmentTypes.narrativeAssessment,
254
    [AssessmentTypeId.OnSiteExam]: assessmentTypes.onSiteExam,
255
    [AssessmentTypeId.OnlineExam]: assessmentTypes.onlineExam,
256
    [AssessmentTypeId.PortfolioReview]: assessmentTypes.portfolioReview,
257
    [AssessmentTypeId.ReferenceCheck]: assessmentTypes.referenceCheck,
258
    [AssessmentTypeId.SeriousGames]: assessmentTypes.seriousGames,
259
    [AssessmentTypeId.TakeHomeExam]: assessmentTypes.takeHomeExam,
260
  }[assessmentTypeId.toString()];
261
};
262
263
const criteriaTypes = defineMessages({
264
  asset: {
265
    id: "criteriaType.asset",
266
    defaultMessage: "Asset",
267
    description: "Title of an asset criteria type.",
268
  },
269
  essential: {
270
    id: "criteriaType.essential",
271
    defaultMessage: "Essential",
272
    description: "Title of an essential criteria type.",
273
  },
274
});
275
276
export const criteriaType = (criteriaTypeId: number): MessageDescriptor => {
277
  if (!CriteriaTypeIdValues.includes(criteriaTypeId)) {
278
    throw new Error("invalid CriteriaTypeValue");
279
  }
280
  return {
281
    [CriteriaTypeId.Asset]: criteriaTypes.asset,
282
    [CriteriaTypeId.Essential]: criteriaTypes.essential,
283
  }[criteriaTypeId.toString()];
284
};
285
286
const assessmentTypeDescriptions = defineMessages({
287
  narrativeAssessment: {
288
    id: "assessmentType.narrativeAssessment.description",
289
    defaultMessage:
290
      "This is a description requested during the application process, in which applicants to self-identify and describe their experience and level of expertise with a skill.",
291
    description:
292
      "Description of an assessment type, to help a manager understand when to use it.",
293
  },
294
  applicationScreeningQuestion: {
295
    id: "assessmentType.applicationScreeningQuestion.description",
296
    defaultMessage:
297
      "These questions appear in the application form, and are submitted through Talent Cloud, they allow a first glance at the applicant’s understanding, process, knowledge, or cultural fit for the position.",
298
    description:
299
      "Description of an assessment type, to help a manager understand when to use it.",
300
  },
301
  groupTest: {
302
    id: "assessmentType.groupTest.description",
303
    defaultMessage:
304
      "Applicants perform this test in real-time in conjunction with other applicants, team members, or facilitators, to determine their skill prowess, team communication, and performance in a collaborative environment.",
305
    description:
306
      "Description of an assessment type, to help a manager understand when to use it.",
307
  },
308
  informalPhoneConversation: {
309
    id: "assessmentType.informalPhoneConversation.description",
310
    defaultMessage:
311
      "A loose structure chat between a member of the hiring board and an applicant, aimed at discovering the applicant’s knowledge, aptitudes, or personality traits, conversations may vary between applicants.",
312
    description:
313
      "Description of an assessment type, to help a manager understand when to use it.",
314
  },
315
  interview: {
316
    id: "assessmentType.interview.description",
317
    defaultMessage:
318
      "A formal question-and-answer examination performed in real-time between the hiring-board and an applicant. Questions are aimed at assessing skill expertise, level, and approach. Each question is crafted beforehand and follows the same structure between all interviewed applicants.",
319
    description:
320
      "Description of an assessment type, to help a manager understand when to use it.",
321
  },
322
  onlineExam: {
323
    id: "assessmentType.onlineExam.description",
324
    defaultMessage:
325
      "Prepared examination that does not require supervision, and can be performed from any location through internet access, with a defined time-frame for completion.",
326
    description:
327
      "Description of an assessment type, to help a manager understand when to use it.",
328
  },
329
  onSiteExam: {
330
    id: "assessmentType.onSiteExam.description",
331
    defaultMessage:
332
      "Prepared examination that requires the applicant to perform a test at a specific location under supervision, aimed at assessing skill expertise and technique.",
333
    description:
334
      "Description of an assessment type, to help a manager understand when to use it.",
335
  },
336
  takeHomeExam: {
337
    id: "assessmentType.takeHomeExam.description",
338
    defaultMessage:
339
      "Applicants receive a physical package containing the assessment tools, they complete the assessment at their own leisure and at their preferred location without supervision, and must return the materials before a specific deadline.",
340
    description:
341
      "Description of an assessment type, to help a manager understand when to use it.",
342
  },
343
  portfolioReview: {
344
    id: "assessmentType.portfolioReview.description",
345
    defaultMessage:
346
      "During the application process, applicants provide access to samples of their work to exhibit their skill level, and back-up their skill claims. ",
347
    description:
348
      "Description of an assessment type, to help a manager understand when to use it.",
349
  },
350
  referenceCheck: {
351
    id: "assessmentType.referenceCheck.description",
352
    defaultMessage:
353
      "During the application process, applicants provide contact information to an acquaintance who can validate and confirm their skill expertise, knowledge or aptitude.",
354
    description:
355
      "Description of an assessment type, to help a manager understand when to use it.",
356
  },
357
  seriousGames: {
358
    id: "assessmentType.seriousGames.description",
359
    defaultMessage:
360
      "Test involving the use of games to explore a candidate’s communication skills, resilience, emotional intelligence, among many other soft skills.",
361
    description:
362
      "Description of an assessment type, to help a manager understand when to use it.",
363
  },
364
});
365
366
export const assessmentTypeDescription = (
367
  assessmentTypeId: number,
368
): MessageDescriptor => {
369
  if (!AssessmentTypeIdValues.includes(assessmentTypeId)) {
370
    throw new Error("invalid AssessmentTypeValue");
371
  }
372
  return {
373
    [AssessmentTypeId.ApplicationScreeningQuestion]:
374
      assessmentTypeDescriptions.applicationScreeningQuestion,
375
    [AssessmentTypeId.GroupTest]: assessmentTypeDescriptions.groupTest,
376
    [AssessmentTypeId.InformalPhoneConversation]:
377
      assessmentTypeDescriptions.informalPhoneConversation,
378
    [AssessmentTypeId.Interview]: assessmentTypeDescriptions.interview,
379
    [AssessmentTypeId.NarrativeAssessment]:
380
      assessmentTypeDescriptions.narrativeAssessment,
381
    [AssessmentTypeId.OnSiteExam]: assessmentTypeDescriptions.onSiteExam,
382
    [AssessmentTypeId.OnlineExam]: assessmentTypeDescriptions.onlineExam,
383
    [AssessmentTypeId.PortfolioReview]:
384
      assessmentTypeDescriptions.portfolioReview,
385
    [AssessmentTypeId.ReferenceCheck]:
386
      assessmentTypeDescriptions.referenceCheck,
387
    [AssessmentTypeId.SeriousGames]: assessmentTypeDescriptions.seriousGames,
388
    [AssessmentTypeId.TakeHomeExam]: assessmentTypeDescriptions.takeHomeExam,
389
  }[assessmentTypeId];
390
};
391
392
const standardAssessmentText = defineMessages({
393
  narrativeReviewQuestion: {
394
    id: "assessmentType.narrativeReview.standardQuestion",
395
    defaultMessage:
396
      "Narrative Review of skill includes all descriptions added by the applicant in their application.",
397
    description:
398
      "Description which replaces 'interview question' for the Narrative Review assessment type.",
399
  },
400
  narrativeReviewAnswer: {
401
    id: "assessmentType.narrativeReview.standardAnswer",
402
    defaultMessage:
403
      "The provided description contains sufficient evidence to advance this candidate to the next screening steps.",
404
    description:
405
      "Standard evalutation statement which replaces 'expected answer' for all skills under the Narrative Review assessment type.",
406
  },
407
});
408
409
const provinceNames = defineMessages({
410
  [ProvinceId.AB]: {
411
    id: "province.ab",
412
    defaultMessage: "Alberta",
413
  },
414
  [ProvinceId.BC]: {
415
    id: "province.bc",
416
    defaultMessage: "British Columbia",
417
  },
418
  [ProvinceId.MB]: {
419
    id: "province.mb",
420
    defaultMessage: "Manitoba",
421
  },
422
  [ProvinceId.NL]: {
423
    id: "province.nl",
424
    defaultMessage: "Newfoundland and Labrador",
425
  },
426
  [ProvinceId.NB]: {
427
    id: "province.nb",
428
    defaultMessage: "New Brunswick",
429
  },
430
  [ProvinceId.NS]: {
431
    id: "province.ns",
432
    defaultMessage: "Nova Scotia",
433
  },
434
  [ProvinceId.NU]: {
435
    id: "province.nu",
436
    defaultMessage: "Nunavut",
437
  },
438
  [ProvinceId.NT]: {
439
    id: "province.nt",
440
    defaultMessage: "Northwest Territories",
441
  },
442
  [ProvinceId.ON]: {
443
    id: "province.on",
444
    defaultMessage: "Ontario",
445
  },
446
  [ProvinceId.PE]: {
447
    id: "province.pe",
448
    defaultMessage: "Prince Edward Island",
449
  },
450
  [ProvinceId.QC]: {
451
    id: "province.qc",
452
    defaultMessage: "Quebec",
453
  },
454
  [ProvinceId.SK]: {
455
    id: "province.sk",
456
    defaultMessage: "Saskatchewan",
457
  },
458
  [ProvinceId.YT]: {
459
    id: "province.yk",
460
    defaultMessage: "Yukon",
461
  },
462
});
463
464
export const provinceName = (provinceId: number): MessageDescriptor =>
465
  getOrThrowError(provinceNames, provinceId, "invalid ProvinceId");
466
467
const provinceAbreviations = defineMessages({
468
  [ProvinceId.AB]: {
469
    id: "province.ab.abreviation",
470
    defaultMessage: "Alb.",
471
  },
472
  [ProvinceId.BC]: {
473
    id: "province.bc.abreviation",
474
    defaultMessage: "B.C.",
475
  },
476
  [ProvinceId.MB]: {
477
    id: "province.mb.abreviation",
478
    defaultMessage: "Man.",
479
  },
480
  [ProvinceId.NL]: {
481
    id: "province.nl.abreviation",
482
    defaultMessage: "N.L.",
483
  },
484
  [ProvinceId.NB]: {
485
    id: "province.nb.abreviation",
486
    defaultMessage: "N.B.",
487
  },
488
  [ProvinceId.NS]: {
489
    id: "province.ns.abreviation",
490
    defaultMessage: "N.S.",
491
  },
492
  [ProvinceId.NU]: {
493
    id: "province.nu.abreviation",
494
    defaultMessage: "Nvt.",
495
  },
496
  [ProvinceId.NT]: {
497
    id: "province.nt.abreviation",
498
    defaultMessage: "N.W.T.",
499
  },
500
  [ProvinceId.ON]: {
501
    id: "province.on.abreviation",
502
    defaultMessage: "Ont.",
503
  },
504
  [ProvinceId.PE]: {
505
    id: "province.pe.abreviation",
506
    defaultMessage: "P.E.I.",
507
  },
508
  [ProvinceId.QC]: {
509
    id: "province.qc.abreviation",
510
    defaultMessage: "Que.",
511
  },
512
  [ProvinceId.SK]: {
513
    id: "province.sk.abreviation",
514
    defaultMessage: "Sask.",
515
  },
516
  [ProvinceId.YT]: {
517
    id: "province.yk.abreviation",
518
    defaultMessage: "Y.T.",
519
  },
520
});
521
522
export const provinceAbreviation = (provinceId: number): MessageDescriptor =>
523
  getOrThrowError(provinceAbreviations, provinceId, "invalid ProvinceId");
524
525
const securityClearances = defineMessages({
526
  [SecurityClearanceId.reliability]: {
527
    id: "securityClearance.reliability",
528
    defaultMessage: "Reliability",
529
  },
530
  [SecurityClearanceId.secret]: {
531
    id: "securityClearance.secret",
532
    defaultMessage: "Secret",
533
  },
534
  [SecurityClearanceId.topSecret]: {
535
    id: "securityClearance.topSecret",
536
    defaultMessage: "Top Secret",
537
  },
538
});
539
540
export const securityClearance = (
541
  securityClearanceId: number,
542
): MessageDescriptor =>
543
  getOrThrowError(
544
    securityClearances,
545
    securityClearanceId,
546
    "invalid security clearance id",
547
  );
548
549
const languageRequirements = defineMessages({
550
  [LanguageRequirementId.english]: {
551
    id: "languageRequirement.english",
552
    defaultMessage: "English Essential",
553
  },
554
  [LanguageRequirementId.french]: {
555
    id: "languageRequirement.french",
556
    defaultMessage: "French Essential",
557
  },
558
  [LanguageRequirementId.bilingualIntermediate]: {
559
    id: "languageRequirement.bilingualIntermediate",
560
    defaultMessage: "Bilingual - Intermediate",
561
  },
562
  [LanguageRequirementId.bilingualAdvanced]: {
563
    id: "languageRequirement.bilingualAdvanced",
564
    defaultMessage: "Bilingual - Advanced",
565
  },
566
  [LanguageRequirementId.englishOrFrench]: {
567
    id: "languageRequirement.englishOrFrench",
568
    defaultMessage: "English or French",
569
  },
570
});
571
572
export const languageRequirement = (
573
  languageRequirementId: number,
574
): MessageDescriptor =>
575
  getOrThrowError(
576
    languageRequirements,
577
    languageRequirementId,
578
    "invalid LanguageRequirementId",
579
  );
580
581
const languageRequirementDescriptions = defineMessages({
582
  [LanguageRequirementId.english]: {
583
    id: "languageRequirement.description.english",
584
    defaultMessage:
585
      "This position requires fluency in English in both written and verbal communication. As part of the assessment of your language abilities, the hiring manager may ask you to complete some assessment steps in English, such as interview questions or an exam.",
586
  },
587
  [LanguageRequirementId.french]: {
588
    id: "languageRequirement.description.french",
589
    defaultMessage:
590
      "This position requires fluency in French in both written and verbal communication. As part of the assessment of your language abilities, the hiring manager may ask you to complete some assessment steps in French, such as interview questions or an exam.",
591
  },
592
  [LanguageRequirementId.bilingualIntermediate]: {
593
    id: "languageRequirement.description.bilingualIntermediate",
594
    // TODO: turn "Public Service Commission of Canada" into a link to https://www.canada.ca/en/public-service-commission/jobs/services/gc-jobs/information-candidates/language-requirements-candidates.html
595
    defaultMessage:
596
      "This position requires working knowledge of both French and English. This means that you can take on job duties in either French or English, and you have intermediate reading, writing and verbal communication skills in both official languages. As part of this selection process, your language abilities will be tested by the Public Service Commission of Canada.",
597
  },
598
  [LanguageRequirementId.bilingualAdvanced]: {
599
    id: "languageRequirement.description.bilingualAdvanced",
600
    // TODO: turn "Public Service Commission of Canada" into a link to https://www.canada.ca/en/public-service-commission/jobs/services/gc-jobs/information-candidates/language-requirements-candidates.html
601
    defaultMessage:
602
      "This position requires advanced knowledge of both French and English. This means that you can take on job duties in either French or English, and you have strong reading, writing and verbal communication skills in both official languages. As part of this selection process, your language abilities will be tested by the Public Service Commission of Canada Public Service Commission of Canada.",
603
  },
604
  [LanguageRequirementId.englishOrFrench]: {
605
    id: "languageRequirement.description.englishOrFrench",
606
    defaultMessage:
607
      "For this position, you meet the language requirements if you have strong reading, writing and verbal communication skills in either English or French, or both (bilingual).",
608
  },
609
});
610
611
export const languageRequirementDescription = (
612
  languageRequirementId: number,
613
): MessageDescriptor =>
614
  getOrThrowError(
615
    languageRequirementDescriptions,
616
    languageRequirementId,
617
    "invalid LanguageRequirementId",
618
  );
619
620
const languageRequirementContexts = defineMessages({
621
  basic: {
622
    id: "languageRequirement.context.basic",
623
    defaultMessage:
624
      "You can submit this initial application in either official language of your choice (English or French).",
625
  },
626
  expanded: {
627
    id: "languageRequirement.context.expanded",
628
    defaultMessage:
629
      "You can complete all other steps of this assessment process in the official language of your choice, including the initial application, interview, exam and any other evaluation components.",
630
  },
631
});
632
633
export const languageRequirementContext = (
634
  languageRequirementId: number,
635
): MessageDescriptor => {
636
  switch (languageRequirementId) {
637
    case LanguageRequirementId.bilingualIntermediate:
638
    case LanguageRequirementId.bilingualAdvanced:
639
      return languageRequirementContexts.expanded;
640
641
    case LanguageRequirementId.englishOrFrench:
642
    case LanguageRequirementId.english:
643
    case LanguageRequirementId.french:
644
    default:
645
      return languageRequirementContexts.basic;
646
  }
647
};
648
649
export const narrativeReviewStandardQuestion = (): MessageDescriptor =>
650
  standardAssessmentText.narrativeReviewQuestion;
651
652
export const narrativeReviewStandardAnswer = (): MessageDescriptor =>
653
  standardAssessmentText.narrativeReviewAnswer;
654
655
const frequencyMessages = defineMessages({
656
  [FrequencyId.always]: {
657
    id: "jobBuilder.details.frequencyAlwaysLabel",
658
    defaultMessage: "Almost Always",
659
    description: "The form label displayed on 'always' frequency options.",
660
  },
661
  [FrequencyId.often]: {
662
    id: "jobBuilder.details.frequencyFrequentlyLabel",
663
    defaultMessage: "Frequently",
664
    description: "The form label displayed on 'frequently' frequency options.",
665
  },
666
  [FrequencyId.sometimes]: {
667
    id: "jobBuilder.details.frequencySometimesLabel",
668
    defaultMessage: "Sometimes",
669
    description: "The form label displayed on 'sometimes' frequency options.",
670
  },
671
  [FrequencyId.rarely]: {
672
    id: "jobBuilder.details.frequencyOccasionallyLabel",
673
    defaultMessage: "Occasionally",
674
    description:
675
      "The form label displayed on 'occasionally' frequency options.",
676
  },
677
  [FrequencyId.never]: {
678
    id: "jobBuilder.details.frequencyNeverLabel",
679
    defaultMessage: "Never",
680
    description: "The form label displayed on 'never' frequency options.",
681
  },
682
});
683
684
export const frequencyName = (frequencyId: number): MessageDescriptor =>
685
  getOrThrowError(frequencyMessages, frequencyId, "invalid FrequencyId");
686
687
const overtimeRequirmentDescriptions = defineMessages({
688
  [OvertimeRequirementId.frequently]: {
689
    id: "jobBuilder.details.overtimeFrequentlyLabel",
690
    defaultMessage: "Yes, overtime is frequently required for the position.",
691
    description: "The form label displayed on 'frequently' overtime options",
692
  },
693
  [OvertimeRequirementId.available]: {
694
    id: "jobBuilder.details.overtimeOpportunitiesAvailableLabel",
695
    defaultMessage:
696
      "Yes, overtime opportunities are available for those that are interested.",
697
    description:
698
      "The form label displayed on 'overtime opportunities available' overtime options",
699
  },
700
  [OvertimeRequirementId.none]: {
701
    id: "jobBuilder.details.overtimeNoneRequiredLabel",
702
    defaultMessage: "No, overtime is not required for the position.",
703
    description:
704
      "The form label displayed on 'no overtime required' overtime options",
705
  },
706
});
707
708
export const overtimeRequirementDescription = (
709
  overtimeRequirementId: number,
710
): MessageDescriptor =>
711
  getOrThrowError(
712
    overtimeRequirmentDescriptions,
713
    overtimeRequirementId,
714
    "invalid OvertimeRequirementId",
715
  );
716
717
const travelRequirementDescriptions = defineMessages({
718
  [TravelRequirementId.frequently]: {
719
    id: "jobBuilder.details.travelFrequentlyLabel",
720
    defaultMessage: "Yes, travel is frequently required for the position.",
721
    description: "The form label displayed on 'frequently' travel options",
722
  },
723
  [TravelRequirementId.available]: {
724
    id: "jobBuilder.details.travelOpportunitiesAvailableLabel",
725
    defaultMessage:
726
      "Yes, travel opportunities are available for those that are interested.",
727
    description:
728
      "The form label displayed on 'travel opportunities available' travel options",
729
  },
730
  [TravelRequirementId.none]: {
731
    id: "jobBuilder.details.travelNoneRequiredLabel",
732
    defaultMessage: "No, travel is not required for the position.",
733
    description:
734
      "The form label displayed on 'no travel required' travel options",
735
  },
736
});
737
738
export const travelRequirementDescription = (
739
  travelRequirementId: number,
740
): MessageDescriptor =>
741
  getOrThrowError(
742
    travelRequirementDescriptions,
743
    travelRequirementId,
744
    "invalid TravelRequirementId",
745
  );
746
747
export const classificationCodes = defineMessages({
748
  [ClassificationId.AS]: {
749
    id: "jobBuilder.details.classificationOptions.AS",
750
    defaultMessage: "AS - Administrative Services",
751
    description: "Job Classification from list of Classifications",
752
  },
753
  [ClassificationId.BI]: {
754
    id: "jobBuilder.details.classificationOptions.BI",
755
    defaultMessage: "BI - Biological Sciences",
756
    description: "Job Classification from list of Classifications",
757
  },
758
  [ClassificationId.CO]: {
759
    id: "jobBuilder.details.classificationOptions.CO",
760
    defaultMessage: "CO - Commerce",
761
    description: "Job Classification from list of Classifications",
762
  },
763
  [ClassificationId.CR]: {
764
    id: "jobBuilder.details.classificationOptions.CR",
765
    defaultMessage: "CR - Clerical and Regulatory",
766
    description: "Job Classification from list of Classifications",
767
  },
768
  [ClassificationId.CS]: {
769
    id: "jobBuilder.details.classificationOptions.CS",
770
    defaultMessage: "CS - Computer Systems",
771
    description: "Job Classification from list of Classifications",
772
  },
773
  [ClassificationId.EC]: {
774
    id: "jobBuilder.details.classificationOptions.EC",
775
    defaultMessage: "EC - Economics and Social Science Services",
776
    description: "Job Classification from list of Classifications",
777
  },
778
  [ClassificationId.EX]: {
779
    id: "jobBuilder.details.classificationOptions.EX",
780
    defaultMessage: "EX - Executive",
781
    description: "Job Classification from list of Classifications",
782
  },
783
  [ClassificationId.FO]: {
784
    id: "jobBuilder.details.classificationOptions.FO",
785
    defaultMessage: "FO - Forestry",
786
    description: "Job Classification from list of Classifications",
787
  },
788
  [ClassificationId.IS]: {
789
    id: "jobBuilder.details.classificationOptions.IS",
790
    defaultMessage: "IS - Information Services",
791
    description: "Job Classification from list of Classifications",
792
  },
793
  [ClassificationId.PC]: {
794
    id: "jobBuilder.details.classificationOptions.PC",
795
    defaultMessage: "PC - Physical Sciences",
796
    description: "Job Classification from list of Classifications",
797
  },
798
  [ClassificationId.PE]: {
799
    id: "jobBuilder.details.classificationOptions.PE",
800
    defaultMessage: "PE - Personnel Administration",
801
    description: "Job Classification from list of Classifications",
802
  },
803
  [ClassificationId.PM]: {
804
    id: "jobBuilder.details.classificationOptions.PM",
805
    defaultMessage: "PM - Programme Administration",
806
    description: "Job Classification from list of Classifications",
807
  },
808
  [ClassificationId.AD]: {
809
    id: "jobBuilder.details.classificationOptions.AD",
810
    defaultMessage: "AD - Administrative Services",
811
    description: "Job Classification from list of Classifications",
812
  },
813
  [ClassificationId["EN-ENG"]]: {
814
    id: "jobBuilder.details.classificationOptions.EN-ENG",
815
    defaultMessage: "EN-ENG - Engineering",
816
    description: "Job Classification from list of Classifications",
817
  },
818
  [ClassificationId.FI]: {
819
    id: "jobBuilder.details.classificationOptions.FI",
820
    defaultMessage: "FI - Financial Management",
821
    description: "Job Classification from list of Classifications",
822
  },
823
});
824
825
export const classificationCodeOption = (
826
  classificationId: number,
827
): MessageDescriptor =>
828
  getOrThrowError(
829
    classificationCodes,
830
    classificationId,
831
    "invalid ClassificationId",
832
  );
833
834
export const generalLocations = defineMessages({
835
  [LocationId.jobGeneric]: {
836
    id: "activityfeed.locations.review",
837
    defaultMessage: "Job Poster Builder",
838
    description: "Location where the activity is located.",
839
  },
840
  [LocationId.summary]: {
841
    id: "activityfeed.locations.hr.summary",
842
    defaultMessage: "HR Summary Page",
843
    description: "Location where the activity is located.",
844
  },
845
  [LocationId.preview]: {
846
    id: "activityfeed.locations.hr.preview",
847
    defaultMessage: "HR Preview Page",
848
    description: "Location where the activity is located.",
849
  },
850
  [LocationId.applicantsGeneric]: {
851
    id: "activityfeed.locations.applications",
852
    defaultMessage: "Applicant Review Page",
853
    description: "Location where the activity is located.",
854
  },
855
  [LocationId.screeningPlan]: {
856
    id: "activityfeed.locations.screeningPlan",
857
    defaultMessage: "Assessment Plan",
858
    description: "Location where the activity is located.",
859
  },
860
  notFound: {
861
    id: "activityfeed.locations.notFound",
862
    defaultMessage: "Location not found",
863
    description: "Error message if location id is not recognized",
864
  },
865
});
866
867
export const generalLocationOption = (
868
  locationId: string,
869
): MessageDescriptor => {
870
  switch (locationId) {
871
    /* Job Poster Review Page */
872
    case LocationId.jobGeneric:
873
    case LocationId.heading:
874
    case LocationId.basicInfo:
875
    case LocationId.impact:
876
    case LocationId.tasks:
877
    case LocationId.skills:
878
    case LocationId.langRequirements:
879
    case LocationId.environment:
880
      return generalLocations[LocationId.jobGeneric];
881
    /* Applicant Review Page */
882
    case LocationId.applicantsGeneric:
883
    case LocationId.underConsideration:
884
    case LocationId.optionalConsideration:
885
    case LocationId.notUnderConsideration:
886
      return generalLocations[LocationId.applicantsGeneric];
887
    /* Assessment Plan */
888
    case LocationId.screeningPlan:
889
    case LocationId.screeningPlanBuilder:
890
    case LocationId.screeningPlanSummary:
891
    case LocationId.screeningPlanRatings:
892
      return generalLocations[LocationId.screeningPlan];
893
    /* Hr Portal */
894
    case LocationId.summary:
895
      return generalLocations[LocationId.summary];
896
    case LocationId.preview:
897
      return generalLocations[LocationId.preview];
898
899
    default:
900
      return generalLocations.notFound;
901
  }
902
};
903
904
export const jobReviewLocations = defineMessages({
905
  [LocationId.jobGeneric]: {
906
    id: "activityfeed.locations.review.general",
907
    defaultMessage: "General",
908
    description: "Location of the activity.",
909
  },
910
  [LocationId.heading]: {
911
    id: "activityfeed.locations.review.heading",
912
    defaultMessage: "Job Page Heading",
913
    description: "Location of the activity.",
914
  },
915
  [LocationId.basicInfo]: {
916
    id: "activityfeed.locations.review.basicInfo",
917
    defaultMessage: "Basic Information",
918
    description: "Location of the activity.",
919
  },
920
  [LocationId.impact]: {
921
    id: "activityfeed.locations.review.impact",
922
    defaultMessage: "Impact",
923
    description: "Location of the activity.",
924
  },
925
  [LocationId.tasks]: {
926
    id: "activityfeed.locations.review.tasks",
927
    defaultMessage: "Tasks",
928
    description: "Location of the activity.",
929
  },
930
  [LocationId.skills]: {
931
    id: "activityfeed.locations.review.skills",
932
    defaultMessage: "Skills",
933
    description: "Location of the activity.",
934
  },
935
  [LocationId.langRequirements]: {
936
    id: "activityfeed.locations.review.langRequirements",
937
    defaultMessage: "Language Requirements",
938
    description: "Location of the activity.",
939
  },
940
  [LocationId.environment]: {
941
    id: "activityfeed.locations.review.environment",
942
    defaultMessage: "Environment",
943
    description: "Location of the activity.",
944
  },
945
});
946
947
export const applicantReviewLocations = defineMessages({
948
  [LocationId.applicantsGeneric]: {
949
    id: "activityfeed.locations.applicantReview.general",
950
    defaultMessage: "General",
951
    description: "Location of the activity.",
952
  },
953
  [LocationId.underConsideration]: {
954
    id: "activityfeed.locations.applicantReview.underConsideration",
955
    defaultMessage: "Under Consideration",
956
    description: "Location of the activity.",
957
  },
958
  [LocationId.optionalConsideration]: {
959
    id: "activityfeed.locations.applicantReview.optionalConsideration",
960
    defaultMessage: "Optional Consideration",
961
    description: "Location of the activity.",
962
  },
963
  [LocationId.notUnderConsideration]: {
964
    id: "activityfeed.locations.applicantReview.notUnderConsideration",
965
    defaultMessage: "No Longer Under Consideration",
966
    description: "Location of the activity.",
967
  },
968
});
969
970
export const screeningPlanLocations = defineMessages({
971
  [LocationId.screeningPlan]: {
972
    id: "activityfeed.locations.screeningPlan.general",
973
    defaultMessage: "General",
974
    description: "Location of the activity.",
975
  },
976
  [LocationId.screeningPlanBuilder]: {
977
    id: "activityfeed.locations.screeningPlan.builder",
978
    defaultMessage: "Assessment Plan Builder",
979
    description: "Location of the activity.",
980
  },
981
  [LocationId.screeningPlanSummary]: {
982
    id: "activityfeed.locations.screeningPlan.summary",
983
    defaultMessage: "Assessment Plan Summary",
984
    description: "Location of the activity.",
985
  },
986
  [LocationId.screeningPlanRatings]: {
987
    id: "activityfeed.locations.screeningPlan.ratings",
988
    defaultMessage: "Ratings Guide Builder",
989
    description: "Location of the activity.",
990
  },
991
});
992
export const hrPortalLocations = {
993
  [LocationId.summary]: jobReviewLocations[LocationId.jobGeneric],
994
  [LocationId.preview]: jobReviewLocations[LocationId.jobGeneric],
995
};
996
997
export const specificLocationOption = (locationId: string): MessageDescriptor =>
998
  getOrThrowError(
999
    {
1000
      ...jobReviewLocations,
1001
      ...applicantReviewLocations,
1002
      ...hrPortalLocations,
1003
      ...screeningPlanLocations,
1004
    },
1005
    locationId,
1006
    "Invalid LocationId",
1007
  );
1008
1009
export const ResponseScreeningBuckets = {
1010
  [ResponseBuckets.Consideration]: defineMessages({
1011
    title: {
1012
      id: "responseScreening.buckets.consideration.title",
1013
      defaultMessage: "Employees Under Consideration",
1014
      description:
1015
        "Label for the 'Under Consideration' response screening bucket.",
1016
    },
1017
    description: {
1018
      id: "responseScreening.buckets.consideration.description",
1019
      defaultMessage:
1020
        "Employees in this category have volunteered to be placed in a team with a critical needs shortage. Employees in this category are: Pending initial application review ({iconReceived}), indicating that a submission has been received, but it has not yet been assessed by a member of the review team; Ready for reference checks and home-department approval ({iconReady}), indicating that the employee is heading to the Ready to Allocate category if references and approval are in order; and Further Assessment Required ({iconAssessment}), indicating that the review team is unsure of their qualifications for this role and is undertaking further assessment.",
1021
      description:
1022
        "Descriptive text for the 'Under Consideration' response screening bucket. Takes three icons (iconReceived, iconReady, and iconAssessment) as input.",
1023
    },
1024
  }),
1025
  [ResponseBuckets.ReadyToAllocate]: defineMessages({
1026
    title: {
1027
      id: "responseScreening.buckets.readyToAllocate.title",
1028
      defaultMessage: "Ready to Allocate",
1029
      description:
1030
        "Label for the 'Ready to Allocate' response screening bucket.",
1031
    },
1032
    description: {
1033
      id: "responseScreening.buckets.readyToAllocate.description",
1034
      defaultMessage:
1035
        "Employees in this category have the necessary skills for this stream of work, have successfully completed reference checks and have been given preliminary authorization to participate by a member of their management team. They are currently working in their substantive position, awaiting a request from a department with a critical talent gap.",
1036
      description:
1037
        "Descriptive text for the 'Ready to Allocate' response screening bucket.",
1038
    },
1039
  }),
1040
  [ResponseBuckets.Allocated]: defineMessages({
1041
    title: {
1042
      id: "responseScreening.buckets.allocated.title",
1043
      defaultMessage: "Allocated",
1044
      description: "Label for the 'Allocated' response screening bucket.",
1045
    },
1046
    description: {
1047
      id: "responseScreening.buckets.allocated.description",
1048
      defaultMessage:
1049
        'Employees in this category have been allocated to a department. Their name has been removed from all other GC Reserve processes to which they have applied (and will appear in those processes under "Not Currently Available".) Following the completion of an allocation, employees may elect to be placed back in the Ready to Allocate category, should they be needed again.',
1050
      description:
1051
        "Descriptive text for the 'Allocated' response screening bucket.",
1052
    },
1053
  }),
1054
  [ResponseBuckets.Unavailable]: defineMessages({
1055
    title: {
1056
      id: "responseScreening.buckets.unavailable.title",
1057
      defaultMessage: "Currently Unavailable",
1058
      description: "Label for the 'Unavailable' response screening bucket.",
1059
    },
1060
    description: {
1061
      id: "responseScreening.buckets.unavailable.description",
1062
      defaultMessage:
1063
        "Employees in this stream have been allocated to a department in need or have temporarily removed their names from consideration for a specific period of time (e.g. illness, family care needs), and wish to be considered for allocation at a later date. Employees in this category have been qualified for this talent stream, and will be placed back into the Ready to Allocate when they become available again. (If an employee permanently withdraws their name, their submission will be removed from the GC Talent Reserve.)",
1064
      description:
1065
        "Descriptive text for the 'Currently Unavailable' response screening bucket.",
1066
    },
1067
  }),
1068
  [ResponseBuckets.DoesNotQualify]: defineMessages({
1069
    title: {
1070
      id: "responseScreening.buckets.doesNotQualify.title",
1071
      defaultMessage: "Does Not Qualify",
1072
      description:
1073
        "Label for the 'Does Not Qualify' response screening bucket.",
1074
    },
1075
    description: {
1076
      id: "responseScreening.buckets.doesNotQualify.description",
1077
      defaultMessage:
1078
        "Employees in this category have volunteered their names, but a review of their application and/or reference checks has led the review team to conclude that the employee would not be an asset to a department needing to fill a critical talent gap in this field of work. This determination is, in no way, reflected in the employee's performance status with their home department, and does not affect their evaluation for other GC Reserve talent streams to which they may have applied.",
1079
      description:
1080
        "Descriptive text for the 'Does Not Qualify' response screening bucket.",
1081
    },
1082
  }),
1083
};
1084
1085
export const ResponseReviewStatusMessages = defineMessages({
1086
  screened_out: {
1087
    id: "responseReviewStatus.screenedOut",
1088
    defaultMessage: "Does Not Qualify",
1089
    description: "Select option text for the 'Does Not Qualify' review status.",
1090
  },
1091
  ready_for_reference: {
1092
    id: "responseReviewStatus.readyForReference",
1093
    defaultMessage: "Ready for Reference Check",
1094
    description:
1095
      "Select option text for the 'Ready for Reference Check' review status.",
1096
  },
1097
  ready_to_allocate: {
1098
    id: "responseReviewStatus.readyToAllocate",
1099
    defaultMessage: "Ready to Allocate",
1100
    description:
1101
      "Select option text for the 'Ready to Allocate' review status.",
1102
  },
1103
  assessment_required: {
1104
    id: "responseReviewStatus.assessmentRequired",
1105
    defaultMessage: "Further Assessment Required",
1106
    description:
1107
      "Select option text for the 'Further Assessment Required' review status.",
1108
  },
1109
  allocated: {
1110
    id: "responseReviewStatus.allocated",
1111
    defaultMessage: "Allocated",
1112
    description: "Select option text for the 'Allocated' review status.",
1113
  },
1114
  not_available: {
1115
    id: "responseReviewStatus.notAvailable",
1116
    defaultMessage: "Not Available",
1117
    description: "Select option text for the 'Not Available' review status.",
1118
  },
1119
});
1120
1121
export const ResponseReviewStatuses = {
1122
  assessment_required: {
1123
    id: 6,
1124
    name: ResponseReviewStatusMessages.assessment_required,
1125
  },
1126
  ready_for_reference: {
1127
    id: 4,
1128
    name: ResponseReviewStatusMessages.ready_for_reference,
1129
  },
1130
  ready_to_allocate: {
1131
    id: 5,
1132
    name: ResponseReviewStatusMessages.ready_to_allocate,
1133
  },
1134
  allocated: {
1135
    id: 7,
1136
    name: ResponseReviewStatusMessages.allocated,
1137
  },
1138
  not_available: {
1139
    id: 8,
1140
    name: ResponseReviewStatusMessages.not_available,
1141
  },
1142
  screened_out: {
1143
    id: 1,
1144
    name: ResponseReviewStatusMessages.screened_out,
1145
  },
1146
};
1147
1148
const experienceHeadings = defineMessages({
1149
  award: {
1150
    id: "application.skills.awardHeading",
1151
    defaultMessage: "{title} from {issuedBy}",
1152
    description: "Accordion heading for experience on the Skills page.",
1153
  },
1154
  community: {
1155
    id: "application.skills.communityHeading",
1156
    defaultMessage: "{title} with {group}",
1157
    description: "Accordion heading for experience on the Skills page.",
1158
  },
1159
  education: {
1160
    id: "application.skills.educationHeading",
1161
    defaultMessage: "{areaOfStudy} at {institution}",
1162
    description: "Accordion heading for experience on the Skills page.",
1163
  },
1164
  personal: {
1165
    id: "application.skills.personalHeading",
1166
    defaultMessage: "{title}",
1167
    description: "Accordion heading for experience on the Skills page.",
1168
  },
1169
  work: {
1170
    id: "application.skills.workHeading",
1171
    defaultMessage: "{title} at {organization}",
1172
    description: "Accordion heading for experience on the Skills page.",
1173
  },
1174
  unknown: {
1175
    id: "application.skills.unknownHeading",
1176
    defaultMessage: "Error: Unknown experience type.",
1177
    description:
1178
      "Accordion heading error when an unknown experience type is used.",
1179
  },
1180
});
1181
1182
/**
1183
 * Returns a formatted localized heading for the accordion on
1184
 * the Skill UI page of the Job Application. Makes use of experienceHeadings
1185
 * messages defined above.
1186
 *
1187
 * @param experience Given Experience of multiple types defined by the user to apply to a certain Criteria.
1188
 * @param intl react-intl object used in formatting messages.
1189
 *
1190
 * @returns Formatted localized string.
1191
 */
1192
export const getExperienceHeading = (
1193
  experience: Experience,
1194
  intl: IntlShape,
1195
): string => {
1196
  let heading: string;
1197
1198
  switch (experience.type) {
1199
    case "experience_award":
1200
      heading = intl.formatMessage(experienceHeadings.award, {
1201
        title: experience.title,
1202
        issuedBy: experience.issued_by,
1203
      });
1204
      break;
1205
    case "experience_community":
1206
      heading = intl.formatMessage(experienceHeadings.community, {
1207
        title: experience.title,
1208
        group: experience.group,
1209
      });
1210
      break;
1211
    case "experience_education":
1212
      heading = intl.formatMessage(experienceHeadings.education, {
1213
        areaOfStudy: experience.area_of_study,
1214
        institution: experience.institution,
1215
      });
1216
      break;
1217
    case "experience_personal":
1218
      heading = intl.formatMessage(experienceHeadings.personal, {
1219
        title: experience.title,
1220
      });
1221
      break;
1222
    case "experience_work":
1223
      heading = intl.formatMessage(experienceHeadings.work, {
1224
        title: experience.title,
1225
        organization: experience.organization,
1226
      });
1227
      break;
1228
    default:
1229
      heading = intl.formatMessage(experienceHeadings.unknown);
1230
  }
1231
1232
  return heading;
1233
};
1234
1235
/**
1236
 * Returns a formatted localized subheading for the accordion on
1237
 * the Skill UI page of the Job Application. Makes use of date formatting
1238
 * to provide a range.
1239
 *
1240
 * @param experience Given Experience of multiple types defined by the user to apply to a certain Criteria.
1241
 * @param intl react-intl object used in formatting messages.
1242
 *
1243
 * @returns Formatted localized string.
1244
 */
1245
export const getExperienceSubheading = (
1246
  experience: Experience,
1247
  intl: IntlShape,
1248
): string => {
1249
  let subHeading: string;
1250
  let startDate: string;
1251
  let endDate: string;
1252
1253
  switch (experience.type) {
1254
    case "experience_award":
1255
      subHeading = intl.formatDate(experience.awarded_date, {
1256
        month: "short",
1257
        year: "numeric",
1258
      });
1259
      break;
1260
    case "experience_community":
1261
    case "experience_education":
1262
    case "experience_personal":
1263
    case "experience_work":
1264
      startDate = intl.formatDate(experience.start_date, {
1265
        month: "short",
1266
        year: "numeric",
1267
      });
1268
1269
      if (experience.end_date !== null && !experience.is_active) {
1270
        endDate = intl.formatDate(experience.end_date, {
1271
          month: "short",
1272
          year: "numeric",
1273
        });
1274
      } else {
1275
        endDate = intl.formatMessage({
1276
          id: "application.skills.currentSubheading",
1277
          defaultMessage: "Current",
1278
          description:
1279
            "Text for the end date of a current experience on the Skills page.",
1280
        });
1281
      }
1282
1283
      subHeading = `${startDate} - ${endDate}`;
1284
      break;
1285
    default:
1286
      subHeading = intl.formatMessage(experienceHeadings.unknown);
1287
  }
1288
1289
  return subHeading;
1290
};
1291
1292
const experienceJustificationLabels = defineMessages({
1293
  award: {
1294
    id: "application.skills.awardJustificationLabel",
1295
    defaultMessage: "How I used {skillName} to achieve {title}",
1296
    description: "Accordion heading for experience on the Skills page.",
1297
  },
1298
  community: {
1299
    id: "application.skills.communityJustificationLabel",
1300
    defaultMessage: "How I used {skillName} with {group}",
1301
    description: "Accordion heading for experience on the Skills page.",
1302
  },
1303
  education: {
1304
    id: "application.skills.educationJustificationLabel",
1305
    defaultMessage: "How I used {skillName} at {institution}",
1306
    description: "Accordion heading for experience on the Skills page.",
1307
  },
1308
  personal: {
1309
    id: "application.skills.personalJustificationLabel",
1310
    defaultMessage: "How I used {skillName} for {title}",
1311
    description: "Accordion heading for experience on the Skills page.",
1312
  },
1313
  work: {
1314
    id: "application.skills.workJustificationLabel",
1315
    defaultMessage: "How I used {skillName} at {organization}",
1316
    description: "Accordion heading for experience on the Skills page.",
1317
  },
1318
  unknown: {
1319
    id: "application.skills.unknownJustificationLabel",
1320
    defaultMessage: "Error: Unknown experience type.",
1321
    description:
1322
      "Accordion heading error when an unknown experience type is used.",
1323
  },
1324
});
1325
1326
/**
1327
 * Returns a formatted localized input label for the text area
1328
 * inside the experience accordion on the Skill UI page of the
1329
 * Job Application. Makes use of experienceJustificationLabels
1330
 * messages defined above.
1331
 *
1332
 * @param experience Given Experience of multiple types defined by the user to apply to a certain Criteria.
1333
 * @param intl react-intl object used in formatting messages.
1334
 *
1335
 * @returns Formatted localized string.
1336
 */
1337
export const getExperienceJustificationLabel = (
1338
  experience: Experience,
1339
  intl: IntlShape,
1340
  skillName: string,
1341
): string => {
1342
  let label: string;
1343
1344
  switch (experience.type) {
1345
    case "experience_award":
1346
      label = intl.formatMessage(experienceJustificationLabels.award, {
1347
        skillName,
1348
        title: experience.title,
1349
      });
1350
      break;
1351
    case "experience_community":
1352
      label = intl.formatMessage(experienceJustificationLabels.community, {
1353
        skillName,
1354
        group: experience.group,
1355
      });
1356
      break;
1357
    case "experience_education":
1358
      label = intl.formatMessage(experienceJustificationLabels.education, {
1359
        skillName,
1360
        institution: experience.institution,
1361
      });
1362
      break;
1363
    case "experience_personal":
1364
      label = intl.formatMessage(experienceJustificationLabels.personal, {
1365
        skillName,
1366
        title: experience.title,
1367
      });
1368
      break;
1369
    case "experience_work":
1370
      label = intl.formatMessage(experienceJustificationLabels.work, {
1371
        skillName,
1372
        organization: experience.organization,
1373
      });
1374
      break;
1375
    default:
1376
      label = intl.formatMessage(experienceHeadings.unknown);
1377
  }
1378
1379
  return label;
1380
};
1381