);
}
diff --git a/src/components/status/use-status-translate.js b/src/components/status/use-status-translate.js
new file mode 100644
index 000000000..928a5c6d6
--- /dev/null
+++ b/src/components/status/use-status-translate.js
@@ -0,0 +1,23 @@
+import {useCallback} from "react";
+import useOrder from "lib/hooks/use-order";
+import useTranslate from "lib/hooks/use-translate";
+
+export default function useStatusTranslate({assessment} = {}) {
+ const order = useOrder();
+ const translate = useTranslate();
+
+ return useCallback((key, ...options) => {
+ const assessments = assessment ? [assessment] : order?.assessments || [];
+ const cognitive = assessments.some(({surveyType}) => surveyType === "cognitive");
+ const personality = assessments.some(({surveyType}) => surveyType === "personality");
+ const interview = assessments.some(({vendor}) => vendor === "crosschq");
+ const keys = [
+ personality && interview && "status.personality_interview",
+ cognitive && interview && "status.cognitive_interview",
+ interview && "status.interview",
+ "status"
+ ].filter(Boolean).map((prefix) => [prefix, key].join("."));
+
+ return translate(keys, ...options);
+ }, [assessment, order, translate]);
+}
diff --git a/src/lib/common/array/find-map.js b/src/lib/common/array/find-map.js
new file mode 100644
index 000000000..eba737b3e
--- /dev/null
+++ b/src/lib/common/array/find-map.js
@@ -0,0 +1,8 @@
+export default function findMap(array, callback) {
+ let result;
+ array.some((item, index) => {
+ result = callback(item, index);
+ return result;
+ });
+ return result || undefined;
+}
diff --git a/src/lib/common/order-from-query.js b/src/lib/common/order-from-query.js
index e38650254..b973069c8 100644
--- a/src/lib/common/order-from-query.js
+++ b/src/lib/common/order-from-query.js
@@ -11,7 +11,8 @@ export function assessmentFromQuery(response) {
profileID: response.profile_id || response.profileId || dig(response, "profile_ids", 0),
skipped: response.isSkipped || response.skipped || false,
surveyID: response.deck_id || response.surveyId || response.surveyKey,
- surveyName: response.surveyName || response.name
+ surveyName: response.surveyName || response.name,
+ vendor: response.vendor
};
// NOTE: Prevent overriding with blanks
diff --git a/src/lib/i18n-data/en-us.json b/src/lib/i18n-data/en-us.json
index ced98b4c3..164d046d6 100644
--- a/src/lib/i18n-data/en-us.json
+++ b/src/lib/i18n-data/en-us.json
@@ -213,8 +213,20 @@
"slide_error": "Unable to load more slides at this time",
"sort": "Sort",
"status": {
+ "cognitive_interview": {
+ "heading": "Cognitive Assessment & Interview"
+ },
"error": "There was an error with your assessments",
"heading": "Your Application Assessments",
+ "interview": {
+ "heading": "Interview",
+ "start": "Start Interview",
+ "survey": "Crosschq AI Interviewer",
+ "text": "Dive into an AI video chat to ask questions, practice your interview, and learn more about the details of this job.\n\nThis is a chat with an Artificial Employee that has been trained on our company culture and the details around this job."
+ },
+ "interview_personality": {
+ "heading": "Personality Assessment & Interview"
+ },
"loading": "Loading your assessment",
"start": "Start Assessment",
"text": "As part of your application, we'd like to ask you to complete the following assessments. Please click on the button next to the assessment name. This will take you to where you'll complete the assessment(s). Please return here once you've completed all assessments.",
@@ -245,4 +257,4 @@
"try_again": "Click Here to Try Again",
"view_on_onet": "View Career Details on O*Net",
"yes": "Yes"
-}
\ No newline at end of file
+}
diff --git a/src/lib/i18n.js b/src/lib/i18n.js
index 03958991a..686b086ab 100644
--- a/src/lib/i18n.js
+++ b/src/lib/i18n.js
@@ -1,5 +1,7 @@
+import findMap from "./common/array/find-map";
import dig from "./common/object/dig";
import merge from "./common/object/merge";
+import {isArray} from "./common/object/type";
import i18nData from "./i18n-data";
export default class I18n {
@@ -31,10 +33,14 @@ export default class I18n {
...originData
};
};
+ // NOTE: Returns first translation if key is an array
translate = (locale, _key, options) => {
- const keys = _key.split(".");
- let result = dig(this.data, locale.toLowerCase(), ...keys);
- if(!result && locale.toLowerCase() !== "en-us") { result = dig(this.data, "en-us", ...keys); }
+ const keys = isArray(_key) ? _key : [_key];
+ let result = findMap(keys, (key) => dig(this.data, locale.toLowerCase(), ...key.split(".")));
+
+ if(!result && locale.toLowerCase() !== "en-us") {
+ result = findMap(keys, (key) => dig(this.data, "en-us", ...key.split(".")));
+ }
if(!result || !options) { return result; }
return result.replace(/%\{[a-z_]*\}/g, (r) => options[r.slice(2, -1)]);
diff --git a/test/components/__snapshots__/status.test.js.snap b/test/components/__snapshots__/status.test.js.snap
index 750d62108..c2e0d1fe2 100644
--- a/test/components/__snapshots__/status.test.js.snap
+++ b/test/components/__snapshots__/status.test.js.snap
@@ -52,11 +52,11 @@ exports[`Status order renders component 1`] = `
/>
-
As part of your application, we'd like to ask you to complete the following assessments. Please click on the button next to the assessment name. This will take you to where you'll complete the assessment(s). Please return here once you've completed all assessments.
-
As part of your application, we'd like to ask you to complete the following assessments. Please click on the button next to the assessment name. This will take you to where you'll complete the assessment(s). Please return here once you've completed all assessments.
-