Passed
Push — feature/application-skill-info... ( 2a7f8b...1281e5 )
by Chris
06:47
created

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

Complexity

Total Complexity 11
Complexity/F 0

Size

Lines of Code 1376
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 11
eloc 1098
mnd 11
bc 11
fnc 0
dl 0
loc 1376
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
rs 9.208
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
});
819
820
export const classificationCodeOption = (
821
  classificationId: number,
822
): MessageDescriptor =>
823
  getOrThrowError(
824
    classificationCodes,
825
    classificationId,
826
    "invalid ClassificationId",
827
  );
828
829
export const generalLocations = defineMessages({
830
  [LocationId.jobGeneric]: {
831
    id: "activityfeed.locations.review",
832
    defaultMessage: "Job Poster Builder",
833
    description: "Location where the activity is located.",
834
  },
835
  [LocationId.summary]: {
836
    id: "activityfeed.locations.hr.summary",
837
    defaultMessage: "HR Summary Page",
838
    description: "Location where the activity is located.",
839
  },
840
  [LocationId.preview]: {
841
    id: "activityfeed.locations.hr.preview",
842
    defaultMessage: "HR Preview Page",
843
    description: "Location where the activity is located.",
844
  },
845
  [LocationId.applicantsGeneric]: {
846
    id: "activityfeed.locations.applications",
847
    defaultMessage: "Applicant Review Page",
848
    description: "Location where the activity is located.",
849
  },
850
  [LocationId.screeningPlan]: {
851
    id: "activityfeed.locations.screeningPlan",
852
    defaultMessage: "Assessment Plan",
853
    description: "Location where the activity is located.",
854
  },
855
  notFound: {
856
    id: "activityfeed.locations.notFound",
857
    defaultMessage: "Location not found",
858
    description: "Error message if location id is not recognized",
859
  },
860
});
861
862
export const generalLocationOption = (
863
  locationId: string,
864
): MessageDescriptor => {
865
  switch (locationId) {
866
    /* Job Poster Review Page */
867
    case LocationId.jobGeneric:
868
    case LocationId.heading:
869
    case LocationId.basicInfo:
870
    case LocationId.impact:
871
    case LocationId.tasks:
872
    case LocationId.skills:
873
    case LocationId.langRequirements:
874
    case LocationId.environment:
875
      return generalLocations[LocationId.jobGeneric];
876
    /* Applicant Review Page */
877
    case LocationId.applicantsGeneric:
878
    case LocationId.underConsideration:
879
    case LocationId.optionalConsideration:
880
    case LocationId.notUnderConsideration:
881
      return generalLocations[LocationId.applicantsGeneric];
882
    /* Assessment Plan */
883
    case LocationId.screeningPlan:
884
    case LocationId.screeningPlanBuilder:
885
    case LocationId.screeningPlanSummary:
886
    case LocationId.screeningPlanRatings:
887
      return generalLocations[LocationId.screeningPlan];
888
    /* Hr Portal */
889
    case LocationId.summary:
890
      return generalLocations[LocationId.summary];
891
    case LocationId.preview:
892
      return generalLocations[LocationId.preview];
893
894
    default:
895
      return generalLocations.notFound;
896
  }
897
};
898
899
export const jobReviewLocations = defineMessages({
900
  [LocationId.jobGeneric]: {
901
    id: "activityfeed.locations.review.general",
902
    defaultMessage: "General",
903
    description: "Location of the activity.",
904
  },
905
  [LocationId.heading]: {
906
    id: "activityfeed.locations.review.heading",
907
    defaultMessage: "Job Page Heading",
908
    description: "Location of the activity.",
909
  },
910
  [LocationId.basicInfo]: {
911
    id: "activityfeed.locations.review.basicInfo",
912
    defaultMessage: "Basic Information",
913
    description: "Location of the activity.",
914
  },
915
  [LocationId.impact]: {
916
    id: "activityfeed.locations.review.impact",
917
    defaultMessage: "Impact",
918
    description: "Location of the activity.",
919
  },
920
  [LocationId.tasks]: {
921
    id: "activityfeed.locations.review.tasks",
922
    defaultMessage: "Tasks",
923
    description: "Location of the activity.",
924
  },
925
  [LocationId.skills]: {
926
    id: "activityfeed.locations.review.skills",
927
    defaultMessage: "Skills",
928
    description: "Location of the activity.",
929
  },
930
  [LocationId.langRequirements]: {
931
    id: "activityfeed.locations.review.langRequirements",
932
    defaultMessage: "Language Requirements",
933
    description: "Location of the activity.",
934
  },
935
  [LocationId.environment]: {
936
    id: "activityfeed.locations.review.environment",
937
    defaultMessage: "Environment",
938
    description: "Location of the activity.",
939
  },
940
});
941
942
export const applicantReviewLocations = defineMessages({
943
  [LocationId.applicantsGeneric]: {
944
    id: "activityfeed.locations.applicantReview.general",
945
    defaultMessage: "General",
946
    description: "Location of the activity.",
947
  },
948
  [LocationId.underConsideration]: {
949
    id: "activityfeed.locations.applicantReview.underConsideration",
950
    defaultMessage: "Under Consideration",
951
    description: "Location of the activity.",
952
  },
953
  [LocationId.optionalConsideration]: {
954
    id: "activityfeed.locations.applicantReview.optionalConsideration",
955
    defaultMessage: "Optional Consideration",
956
    description: "Location of the activity.",
957
  },
958
  [LocationId.notUnderConsideration]: {
959
    id: "activityfeed.locations.applicantReview.notUnderConsideration",
960
    defaultMessage: "No Longer Under Consideration",
961
    description: "Location of the activity.",
962
  },
963
});
964
965
export const screeningPlanLocations = defineMessages({
966
  [LocationId.screeningPlan]: {
967
    id: "activityfeed.locations.screeningPlan.general",
968
    defaultMessage: "General",
969
    description: "Location of the activity.",
970
  },
971
  [LocationId.screeningPlanBuilder]: {
972
    id: "activityfeed.locations.screeningPlan.builder",
973
    defaultMessage: "Assessment Plan Builder",
974
    description: "Location of the activity.",
975
  },
976
  [LocationId.screeningPlanSummary]: {
977
    id: "activityfeed.locations.screeningPlan.summary",
978
    defaultMessage: "Assessment Plan Summary",
979
    description: "Location of the activity.",
980
  },
981
  [LocationId.screeningPlanRatings]: {
982
    id: "activityfeed.locations.screeningPlan.ratings",
983
    defaultMessage: "Ratings Guide Builder",
984
    description: "Location of the activity.",
985
  },
986
});
987
export const hrPortalLocations = {
988
  [LocationId.summary]: jobReviewLocations[LocationId.jobGeneric],
989
  [LocationId.preview]: jobReviewLocations[LocationId.jobGeneric],
990
};
991
992
export const specificLocationOption = (locationId: string): MessageDescriptor =>
993
  getOrThrowError(
994
    {
995
      ...jobReviewLocations,
996
      ...applicantReviewLocations,
997
      ...hrPortalLocations,
998
      ...screeningPlanLocations,
999
    },
1000
    locationId,
1001
    "Invalid LocationId",
1002
  );
1003
1004
export const ResponseScreeningBuckets = {
1005
  [ResponseBuckets.Consideration]: defineMessages({
1006
    title: {
1007
      id: "responseScreening.buckets.consideration.title",
1008
      defaultMessage: "Employees Under Consideration",
1009
      description:
1010
        "Label for the 'Under Consideration' response screening bucket.",
1011
    },
1012
    description: {
1013
      id: "responseScreening.buckets.consideration.description",
1014
      defaultMessage:
1015
        "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.",
1016
      description:
1017
        "Descriptive text for the 'Under Consideration' response screening bucket. Takes three icons (iconReceived, iconReady, and iconAssessment) as input.",
1018
    },
1019
  }),
1020
  [ResponseBuckets.ReadyToAllocate]: defineMessages({
1021
    title: {
1022
      id: "responseScreening.buckets.readyToAllocate.title",
1023
      defaultMessage: "Ready to Allocate",
1024
      description:
1025
        "Label for the 'Ready to Allocate' response screening bucket.",
1026
    },
1027
    description: {
1028
      id: "responseScreening.buckets.readyToAllocate.description",
1029
      defaultMessage:
1030
        "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.",
1031
      description:
1032
        "Descriptive text for the 'Ready to Allocate' response screening bucket.",
1033
    },
1034
  }),
1035
  [ResponseBuckets.Allocated]: defineMessages({
1036
    title: {
1037
      id: "responseScreening.buckets.allocated.title",
1038
      defaultMessage: "Allocated",
1039
      description: "Label for the 'Allocated' response screening bucket.",
1040
    },
1041
    description: {
1042
      id: "responseScreening.buckets.allocated.description",
1043
      defaultMessage:
1044
        '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.',
1045
      description:
1046
        "Descriptive text for the 'Allocated' response screening bucket.",
1047
    },
1048
  }),
1049
  [ResponseBuckets.Unavailable]: defineMessages({
1050
    title: {
1051
      id: "responseScreening.buckets.unavailable.title",
1052
      defaultMessage: "Currently Unavailable",
1053
      description: "Label for the 'Unavailable' response screening bucket.",
1054
    },
1055
    description: {
1056
      id: "responseScreening.buckets.unavailable.description",
1057
      defaultMessage:
1058
        "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.)",
1059
      description:
1060
        "Descriptive text for the 'Currently Unavailable' response screening bucket.",
1061
    },
1062
  }),
1063
  [ResponseBuckets.DoesNotQualify]: defineMessages({
1064
    title: {
1065
      id: "responseScreening.buckets.doesNotQualify.title",
1066
      defaultMessage: "Does Not Qualify",
1067
      description:
1068
        "Label for the 'Does Not Qualify' response screening bucket.",
1069
    },
1070
    description: {
1071
      id: "responseScreening.buckets.doesNotQualify.description",
1072
      defaultMessage:
1073
        "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.",
1074
      description:
1075
        "Descriptive text for the 'Does Not Qualify' response screening bucket.",
1076
    },
1077
  }),
1078
};
1079
1080
export const ResponseReviewStatusMessages = defineMessages({
1081
  screened_out: {
1082
    id: "responseReviewStatus.screenedOut",
1083
    defaultMessage: "Does Not Qualify",
1084
    description: "Select option text for the 'Does Not Qualify' review status.",
1085
  },
1086
  ready_for_reference: {
1087
    id: "responseReviewStatus.readyForReference",
1088
    defaultMessage: "Ready for Reference Check",
1089
    description:
1090
      "Select option text for the 'Ready for Reference Check' review status.",
1091
  },
1092
  ready_to_allocate: {
1093
    id: "responseReviewStatus.readyToAllocate",
1094
    defaultMessage: "Ready to Allocate",
1095
    description:
1096
      "Select option text for the 'Ready to Allocate' review status.",
1097
  },
1098
  assessment_required: {
1099
    id: "responseReviewStatus.assessmentRequired",
1100
    defaultMessage: "Further Assessment Required",
1101
    description:
1102
      "Select option text for the 'Further Assessment Required' review status.",
1103
  },
1104
  allocated: {
1105
    id: "responseReviewStatus.allocated",
1106
    defaultMessage: "Allocated",
1107
    description: "Select option text for the 'Allocated' review status.",
1108
  },
1109
  not_available: {
1110
    id: "responseReviewStatus.notAvailable",
1111
    defaultMessage: "Not Available",
1112
    description: "Select option text for the 'Not Available' review status.",
1113
  },
1114
});
1115
1116
export const ResponseReviewStatuses = {
1117
  assessment_required: {
1118
    id: 6,
1119
    name: ResponseReviewStatusMessages.assessment_required,
1120
  },
1121
  ready_for_reference: {
1122
    id: 4,
1123
    name: ResponseReviewStatusMessages.ready_for_reference,
1124
  },
1125
  ready_to_allocate: {
1126
    id: 5,
1127
    name: ResponseReviewStatusMessages.ready_to_allocate,
1128
  },
1129
  allocated: {
1130
    id: 7,
1131
    name: ResponseReviewStatusMessages.allocated,
1132
  },
1133
  not_available: {
1134
    id: 8,
1135
    name: ResponseReviewStatusMessages.not_available,
1136
  },
1137
  screened_out: {
1138
    id: 1,
1139
    name: ResponseReviewStatusMessages.screened_out,
1140
  },
1141
};
1142
1143
const experienceHeadings = defineMessages({
1144
  award: {
1145
    id: "application.skills.awardHeading",
1146
    defaultMessage: "{title} from {issuedBy}",
1147
    description: "Accordion heading for experience on the Skills page.",
1148
  },
1149
  community: {
1150
    id: "application.skills.communityHeading",
1151
    defaultMessage: "{title} with {group}",
1152
    description: "Accordion heading for experience on the Skills page.",
1153
  },
1154
  education: {
1155
    id: "application.skills.educationHeading",
1156
    defaultMessage: "{areaOfStudy} at {institution}",
1157
    description: "Accordion heading for experience on the Skills page.",
1158
  },
1159
  personal: {
1160
    id: "application.skills.personalHeading",
1161
    defaultMessage: "{title}",
1162
    description: "Accordion heading for experience on the Skills page.",
1163
  },
1164
  work: {
1165
    id: "application.skills.workHeading",
1166
    defaultMessage: "{title} at {organization}",
1167
    description: "Accordion heading for experience on the Skills page.",
1168
  },
1169
  unknown: {
1170
    id: "application.skills.unknownHeading",
1171
    defaultMessage: "Error: Unknown experience type.",
1172
    description:
1173
      "Accordion heading error when an unknown experience type is used.",
1174
  },
1175
});
1176
1177
/**
1178
 * Returns a formatted localized heading for the accordion on
1179
 * the Skill UI page of the Job Application. Makes use of experienceHeadings
1180
 * messages defined above.
1181
 *
1182
 * @param experience Given Experience of multiple types defined by the user to apply to a certain Criteria.
1183
 * @param intl react-intl object used in formatting messages.
1184
 *
1185
 * @returns Formatted localized string.
1186
 */
1187
export const getExperienceHeading = (
1188
  experience: Experience,
1189
  intl: IntlShape,
1190
): string => {
1191
  let heading: string;
1192
1193
  switch (experience.type) {
1194
    case "award":
1195
      heading = intl.formatMessage(experienceHeadings.award, {
1196
        title: experience.title,
1197
        issuedBy: experience.issued_by,
1198
      });
1199
      break;
1200
    case "community":
1201
      heading = intl.formatMessage(experienceHeadings.community, {
1202
        title: experience.title,
1203
        group: experience.group,
1204
      });
1205
      break;
1206
    case "education":
1207
      heading = intl.formatMessage(experienceHeadings.education, {
1208
        areaOfStudy: experience.area_of_study,
1209
        institution: experience.institution,
1210
      });
1211
      break;
1212
    case "personal":
1213
      heading = intl.formatMessage(experienceHeadings.personal, {
1214
        title: experience.title,
1215
      });
1216
      break;
1217
    case "work":
1218
      heading = intl.formatMessage(experienceHeadings.work, {
1219
        title: experience.title,
1220
        organization: experience.organization,
1221
      });
1222
      break;
1223
    default:
1224
      heading = intl.formatMessage(experienceHeadings.unknown);
1225
  }
1226
1227
  return heading;
1228
};
1229
1230
/**
1231
 * Returns a formatted localized subheading for the accordion on
1232
 * the Skill UI page of the Job Application. Makes use of date formatting
1233
 * to provide a range.
1234
 *
1235
 * @param experience Given Experience of multiple types defined by the user to apply to a certain Criteria.
1236
 * @param intl react-intl object used in formatting messages.
1237
 *
1238
 * @returns Formatted localized string.
1239
 */
1240
export const getExperienceSubheading = (
1241
  experience: Experience,
1242
  intl: IntlShape,
1243
): string => {
1244
  let subHeading: string;
1245
  let startDate: string;
1246
  let endDate: string;
1247
1248
  switch (experience.type) {
1249
    case "award":
1250
      subHeading = intl.formatDate(experience.awarded_date, {
1251
        month: "short",
1252
        year: "numeric",
1253
      });
1254
      break;
1255
    case "community":
1256
    case "education":
1257
    case "personal":
1258
    case "work":
1259
      startDate = intl.formatDate(experience.start_date, {
1260
        month: "short",
1261
        year: "numeric",
1262
      });
1263
1264
      if (experience.end_date !== null && !experience.is_active) {
1265
        endDate = intl.formatDate(experience.end_date, {
1266
          month: "short",
1267
          year: "numeric",
1268
        });
1269
      } else {
1270
        endDate = intl.formatMessage({
1271
          id: "application.skills.currentSubheading",
1272
          defaultMessage: "Current",
1273
          description:
1274
            "Text for the end date of a current experience on the Skills page.",
1275
        });
1276
      }
1277
1278
      subHeading = `${startDate} - ${endDate}`;
1279
      break;
1280
    default:
1281
      subHeading = intl.formatMessage(experienceHeadings.unknown);
1282
  }
1283
1284
  return subHeading;
1285
};
1286
1287
const experienceJustificationLabels = defineMessages({
1288
  award: {
1289
    id: "application.skills.awardJustificationLabel",
1290
    defaultMessage: "How I used {skillName} to achieve {title}",
1291
    description: "Accordion heading for experience on the Skills page.",
1292
  },
1293
  community: {
1294
    id: "application.skills.communityJustificationLabel",
1295
    defaultMessage: "How I used {skillName} with {group}",
1296
    description: "Accordion heading for experience on the Skills page.",
1297
  },
1298
  education: {
1299
    id: "application.skills.educationJustificationLabel",
1300
    defaultMessage: "How I used {skillName} at {institution}",
1301
    description: "Accordion heading for experience on the Skills page.",
1302
  },
1303
  personal: {
1304
    id: "application.skills.personalJustificationLabel",
1305
    defaultMessage: "How I used {skillName} for {title}",
1306
    description: "Accordion heading for experience on the Skills page.",
1307
  },
1308
  work: {
1309
    id: "application.skills.workJustificationLabel",
1310
    defaultMessage: "How I used {skillName} at {organization}",
1311
    description: "Accordion heading for experience on the Skills page.",
1312
  },
1313
  unknown: {
1314
    id: "application.skills.unknownJustificationLabel",
1315
    defaultMessage: "Error: Unknown experience type.",
1316
    description:
1317
      "Accordion heading error when an unknown experience type is used.",
1318
  },
1319
});
1320
1321
/**
1322
 * Returns a formatted localized input label for the text area
1323
 * inside the experience accordion on the Skill UI page of the
1324
 * Job Application. Makes use of experienceJustificationLabels
1325
 * messages defined above.
1326
 *
1327
 * @param experience Given Experience of multiple types defined by the user to apply to a certain Criteria.
1328
 * @param intl react-intl object used in formatting messages.
1329
 *
1330
 * @returns Formatted localized string.
1331
 */
1332
export const getExperienceJustificationLabel = (
1333
  experience: Experience,
1334
  intl: IntlShape,
1335
  skillName: string,
1336
): string => {
1337
  let label: string;
1338
1339
  switch (experience.type) {
1340
    case "award":
1341
      label = intl.formatMessage(experienceJustificationLabels.award, {
1342
        skillName,
1343
        title: experience.title,
1344
      });
1345
      break;
1346
    case "community":
1347
      label = intl.formatMessage(experienceJustificationLabels.community, {
1348
        skillName,
1349
        group: experience.group,
1350
      });
1351
      break;
1352
    case "education":
1353
      label = intl.formatMessage(experienceJustificationLabels.education, {
1354
        skillName,
1355
        institution: experience.institution,
1356
      });
1357
      break;
1358
    case "personal":
1359
      label = intl.formatMessage(experienceJustificationLabels.personal, {
1360
        skillName,
1361
        title: experience.title,
1362
      });
1363
      break;
1364
    case "work":
1365
      label = intl.formatMessage(experienceJustificationLabels.work, {
1366
        skillName,
1367
        organization: experience.organization,
1368
      });
1369
      break;
1370
    default:
1371
      label = intl.formatMessage(experienceHeadings.unknown);
1372
  }
1373
1374
  return label;
1375
};
1376