diff --git a/src/components/AttemptAssessmentButton/AttemptAssessmentButton.js b/src/components/AttemptAssessmentButton/AttemptAssessmentButton.js
index 5d218e9b..9b7a390d 100644
--- a/src/components/AttemptAssessmentButton/AttemptAssessmentButton.js
+++ b/src/components/AttemptAssessmentButton/AttemptAssessmentButton.js
@@ -72,7 +72,7 @@ const AttemptAssessmentButton = () => {
status: ['Live'],
primaryCategory: ['Practice Question Set'],
assessmentType: 'Eligibility Test',
- program: [TENANT_DATA.SECOND_CHANCE_PROGRAM, 'Second Chance'],
+ program: uiConfig?.program || [TENANT_DATA.SECOND_CHANCE_PROGRAM, 'Second Chance'],
...(preferredLanguage ? { contentLanguage: [preferredLanguage] } : {}),
},
sort_by: { lastUpdatedOn: 'desc' },
diff --git a/src/components/ContinueLearning/ContinueLearning.js b/src/components/ContinueLearning/ContinueLearning.js
index 1d4500a8..0cca3b44 100644
--- a/src/components/ContinueLearning/ContinueLearning.js
+++ b/src/components/ContinueLearning/ContinueLearning.js
@@ -24,6 +24,7 @@ import CoursesBox from '../CoursesBox/CoursesBox';
import CourseCard from '../CourseCard/CourseCard';
import { useNavigation } from '@react-navigation/native';
import { getDataFromStorage } from '../../utils/JsHelper/Helper';
+import { CONTENT_PLATFORM_IDS } from '../../utils/Constants/app-constants';
const ContinueLearning = ({ youthnet, t, userId }) => {
const [data, setData] = useState([]);
@@ -80,8 +81,10 @@ const ContinueLearning = ({ youthnet, t, userId }) => {
const channelId = tenantData?.[0]?.channelId;
let mergedFilter={}
- if(channelId == 'scp-channel'){
- mergedFilter.targetBoardIds = ["scp-framework_board_cocurricular"];
+ if (channelId == CONTENT_PLATFORM_IDS.SCP.channelId && CONTENT_PLATFORM_IDS.SCP.boardId) {
+ mergedFilter.targetBoardIds = [CONTENT_PLATFORM_IDS.SCP.boardId];
+ } else if (channelId == CONTENT_PLATFORM_IDS.SCP_PATHWAYS.channelId && CONTENT_PLATFORM_IDS.SCP_PATHWAYS.boardId) {
+ mergedFilter.targetBoardIds = [CONTENT_PLATFORM_IDS.SCP_PATHWAYS.boardId];
}
let data = await courseListApi_New({
inprogress_do_ids,
diff --git a/src/components/FilterModal/FilterList.js b/src/components/FilterModal/FilterList.js
index 7628df21..805f03e7 100644
--- a/src/components/FilterModal/FilterList.js
+++ b/src/components/FilterModal/FilterList.js
@@ -15,6 +15,7 @@ import {
getDataFromStorage,
getPreferredContentLanguageSelection,
} from '../../utils/JsHelper/Helper';
+import { CONTENT_PLATFORM_IDS } from '../../utils/Constants/app-constants';
const FilterList = ({
setParentFormData,
@@ -708,7 +709,10 @@ const FilterList = ({
// Remove grade from default form data, but keep board
const filteredDefaultFormData = { ...defaultFormData };
- if (filteredDefaultFormData.gradeLevel && channelId === 'scp-channel') {
+ const isScpChannel =
+ channelId === CONTENT_PLATFORM_IDS.SCP.channelId ||
+ channelId === CONTENT_PLATFORM_IDS.SCP_PATHWAYS.channelId;
+ if (filteredDefaultFormData.gradeLevel && isScpChannel) {
delete filteredDefaultFormData.gradeLevel;
}
// Keep board if it exists
@@ -789,7 +793,9 @@ const FilterList = ({
)}
{/* Dynamic Filters (Categories/Subdomains) */}
- {channelId !== 'scp-channel' && sortFilterSections(renderForm || []).map((item, key) => {
+ {channelId !== CONTENT_PLATFORM_IDS.SCP.channelId &&
+ channelId !== CONTENT_PLATFORM_IDS.SCP_PATHWAYS.channelId &&
+ sortFilterSections(renderForm || []).map((item, key) => {
return (
(item?.name !== 'Domain' || isExplore == true) && (
renderFilterSection(item, key, false)
diff --git a/src/components/Layout/SecondaryHeader.js b/src/components/Layout/SecondaryHeader.js
index 3fb21a58..f67a3079 100644
--- a/src/components/Layout/SecondaryHeader.js
+++ b/src/components/Layout/SecondaryHeader.js
@@ -19,6 +19,7 @@ import Logo from '../../assets/images/png/logo.png';
import PropTypes from 'prop-types';
import GlobalText from '@components/GlobalText/GlobalText';
import ProgramSwitch from '../ProgramSwitch/ProgramSwitch';
+import { TENANT_DATA } from '../../utils/Constants/app-constants';
const SecondaryHeader = ({ logo }) => {
const navigation = useNavigation();
@@ -26,6 +27,7 @@ const SecondaryHeader = ({ logo }) => {
const [selectedIndex, setSelectedIndex] = useState();
const [value, setValue] = useState();
const [userType, setUserType] = useState('');
+ const [programName, setProgramName] = useState('');
const [userId, setUserId] = useState('');
const [showProgramSwitch, setShowProgramSwitch] = useState(false);
@@ -57,13 +59,40 @@ const SecondaryHeader = ({ logo }) => {
try {
const storedUserType = await getDataFromStorage('userType');
const storedUserId = await getDataFromStorage('userId');
+ const storedTenantData = JSON.parse(
+ (await getDataFromStorage('tenantData')) || '[]'
+ );
setUserType(storedUserType || '');
setUserId(storedUserId || '');
+ setProgramName(storedTenantData?.[0]?.tenantName || '');
} catch (error) {
console.error('Error fetching userType or userId:', error);
}
};
+ const normalizeName = (name) => (name || '').trim().toLowerCase();
+ const normalizedProgramName = normalizeName(programName);
+
+ let displayProgramLabel;
+ if (normalizedProgramName === normalizeName(TENANT_DATA.SECOND_CHANCE_PROGRAM)) {
+ displayProgramLabel = t('second_chance_program');
+ } else if (normalizedProgramName === normalizeName(TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS)) {
+ displayProgramLabel = t('second_chance_program_pathways');
+ } else if (normalizedProgramName === normalizeName(TENANT_DATA.YOUTHNET)) {
+ displayProgramLabel = t('vocational_training');
+ } else if (programName) {
+ displayProgramLabel = programName;
+ } else if (userType === 'youthnet') {
+ displayProgramLabel = t('vocational_training');
+ } else if (userType === 'scp') {
+ // Tenant name unavailable — SCP and Pathways both map to userType
+ // 'scp', so we can't tell which one this is. Show nothing rather
+ // than guessing and risking the wrong program name.
+ displayProgramLabel = '';
+ } else {
+ displayProgramLabel = userType;
+ }
+
const onSelect = (index) => {
//setSelectedIndex(index);
const selectedValue = languages[index.row].value;
@@ -112,7 +141,7 @@ const SecondaryHeader = ({ logo }) => {
onPress={handleProgramSwitchToggle}
>
- {userType === "scp" ? "Second Chance Program" : userType === "youthnet" ? "Vocational Training" : userType}
+ {displayProgramLabel}
{
const [loading, setLoading] = useState(false);
const [currentUserType, setCurrentUserType] = useState('');
+ const [currentProgramName, setCurrentProgramName] = useState('');
const [enrolledPrograms, setEnrolledPrograms] = useState([]);
const [tenantData, setTenantData] = useState([]);
const navigation = useNavigation();
@@ -91,6 +92,11 @@ const ProgramSwitch = ({ userId, onSuccess, onError, onClose }) => {
const allTenantData = response.userData.tenantData;
setTenantData(allTenantData);
+ const currentTenant = allTenantData.find(
+ (tenant) => tenant.tenantId === currentTenantId
+ );
+ setCurrentProgramName(currentTenant?.tenantName || '');
+
// Filter tenants where role is "Learner" and status is "active" or "pending"
// AND exclude the current program
const filteredPrograms = allTenantData.filter((tenant) => {
@@ -236,7 +242,7 @@ const ProgramSwitch = ({ userId, onSuccess, onError, onClose }) => {
?.map((item) => item?.tenantId);
const scpTenantIds = tenantDetails
- ?.filter((item) => item?.name === TENANT_DATA.SECOND_CHANCE_PROGRAM)
+ ?.filter((item) => [TENANT_DATA.SECOND_CHANCE_PROGRAM, TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS].includes(item?.name))
?.map((item) => item?.tenantId);
const campToClubTenantIds = tenantDetails
@@ -295,7 +301,7 @@ const ProgramSwitch = ({ userId, onSuccess, onError, onClose }) => {
index: 0,
routes: [{ name: 'SCPUserTabScreen' }],
});
- } else if (selectedTenantName === TENANT_DATA.SECOND_CHANCE_PROGRAM) {
+ } else if ([TENANT_DATA.SECOND_CHANCE_PROGRAM, TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS].includes(selectedTenantName)) {
console.log('#### Navigating to SCP (matched by tenant name)');
await setDataInStorage('userType', 'scp');
navigation.reset({
@@ -608,6 +614,29 @@ const ProgramSwitch = ({ userId, onSuccess, onError, onClose }) => {
+ const normalizeName = (name) => (name || '').trim().toLowerCase();
+ const normalizedCurrentProgramName = normalizeName(currentProgramName);
+
+ let headerProgramLabel;
+ if (normalizedCurrentProgramName === normalizeName(TENANT_DATA.SECOND_CHANCE_PROGRAM)) {
+ headerProgramLabel = t('second_chance_program');
+ } else if (normalizedCurrentProgramName === normalizeName(TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS)) {
+ headerProgramLabel = t('second_chance_program_pathways');
+ } else if (normalizedCurrentProgramName === normalizeName(TENANT_DATA.YOUTHNET)) {
+ headerProgramLabel = t('vocational_training');
+ } else if (currentProgramName) {
+ headerProgramLabel = currentProgramName;
+ } else if (currentUserType === 'youthnet') {
+ headerProgramLabel = t('vocational_training');
+ } else if (currentUserType === 'scp') {
+ // Tenant name unavailable (e.g. fetch failed) — SCP and Pathways both
+ // map to userType 'scp', so we can't tell which one this is. Show
+ // nothing rather than guessing and risking the wrong program name.
+ headerProgramLabel = '';
+ } else {
+ headerProgramLabel = currentUserType;
+ }
+
return (
{loading ? (
@@ -616,14 +645,14 @@ const ProgramSwitch = ({ userId, onSuccess, onError, onClose }) => {
{t('loading_programs')}
) : (
-
{/* Current Program Header */}
- {currentUserType === 'scp' ? t('second_chance_program') : currentUserType === 'youthnet' ? t('vocational_training') : currentUserType}
+ {headerProgramLabel}
diff --git a/src/context/locales/ba.json b/src/context/locales/ba.json
index 9ffebe73..190d11cf 100644
--- a/src/context/locales/ba.json
+++ b/src/context/locales/ba.json
@@ -132,6 +132,7 @@
"no_data_found": "কোনও ডেটা পাওয়া যায়নি",
"my_profile": "আমার প্রোফাইল",
"second_chance_program": "দ্বিতীয় সুযোগ প্রোগ্রাম",
+ "second_chance_program_pathways": "দ্বিতীয় সুযোগ কর্মসূচির পথসমূহ",
"logout": "লগ আউট",
"general_instructions": "সাধারণ নির্দেশিকা",
"test_medium": "পরীক্ষার মাধ্যম",
@@ -625,4 +626,4 @@
"attempt_assessment": "Attempt Assessment",
"come_back_later": "Come Back Later",
"assessment_unavailable_message": "No pending assessment available at this time."
-}
\ No newline at end of file
+}
diff --git a/src/context/locales/en.json b/src/context/locales/en.json
index 9808e8e1..31b86a5a 100644
--- a/src/context/locales/en.json
+++ b/src/context/locales/en.json
@@ -132,6 +132,7 @@
"no_data_found": "No Data Found",
"my_profile": "My Profile",
"second_chance_program": "Second Chance Program",
+ "second_chance_program_pathways": "Second Chance Program Pathways",
"logout": "Log Out",
"general_instructions": "General Instructions",
"test_medium": "Test Medium",
diff --git a/src/context/locales/gu.json b/src/context/locales/gu.json
index 00d58d17..e40114ad 100644
--- a/src/context/locales/gu.json
+++ b/src/context/locales/gu.json
@@ -132,6 +132,7 @@
"no_data_found": "કોઈ ડેટા મળ્યો નથી",
"my_profile": "મારું પ્રોફાઈલ",
"second_chance_program": "સેકન્ડ ચાંસ પ્રોગ્રામ",
+ "second_chance_program_pathways": "બીજી તક કાર્યક્રમના માર્ગો",
"logout": "લોગઆઉટ",
"general_instructions": "સામાન્ય સૂચનાઓ",
"test_medium": "પરીક્ષા માધ્યમ",
@@ -637,4 +638,4 @@
"switched_to": "પર બદલાયું",
"failed_to_switch_program_please_try_again": "કાર્યક્રમ બદલવામાં નિષ્ફળ. કૃપા કરીને ફરી પ્રયાસ કરો.",
"show_all_programs": "બધા કાર્યક્રમો બતાવો"
-}
\ No newline at end of file
+}
diff --git a/src/context/locales/hi.json b/src/context/locales/hi.json
index f87dca96..fdf2ec68 100644
--- a/src/context/locales/hi.json
+++ b/src/context/locales/hi.json
@@ -132,6 +132,7 @@
"no_data_found": "कोई डेटा नहीं मिला",
"my_profile": "मेरा प्रोफाइल",
"second_chance_program": "दूसरा मौका कार्यक्रम",
+ "second_chance_program_pathways": "दूसरा मौका कार्यक्रम के मार्ग",
"logout": "लॉगआउट करें",
"general_instructions": "सामान्य निर्देश",
"test_medium": "परीक्षण माध्यम",
@@ -637,4 +638,4 @@
"switched_to": "बदलकर किया गया",
"failed_to_switch_program_please_try_again": "कार्यक्रम बदलने में विफल। कृपया पुनः प्रयास करें।",
"show_all_programs": "सभी कार्यक्रम दिखाएँ"
-}
\ No newline at end of file
+}
diff --git a/src/context/locales/ka.json b/src/context/locales/ka.json
index f30b5fa0..40c4144e 100644
--- a/src/context/locales/ka.json
+++ b/src/context/locales/ka.json
@@ -132,6 +132,7 @@
"no_data_found": "ಎ ಯಾವುದೇ ಡೇಟಾ ಕಂಡುಬಂದಿಲ್ಲ",
"my_profile": "ನನ್ನ ಪ್ರೊಫೈಲ್",
"second_chance_program": "ಸೆಕಂಡ್ ಚಾನ್ಸ್ ಪ್ರೋಗ್ರಾಂ",
+ "second_chance_program_pathways": "ಎರಡನೇ ಅವಕಾಶ ಕಾರ್ಯಕ್ರಮದ ಮಾರ್ಗಗಳು",
"logout": "ಲಾಗ್ಔಟ್",
"general_instructions": "ಸಾಮಾನ್ಯ ನಿರ್ದೇಶನಗಳು",
"test_medium": "ಪರೀಕ್ಷೆ ಮಾಧ್ಯಮ",
@@ -637,4 +638,4 @@
"switched_to": "ಗೆ ಬದಲಾಯಿಸಲಾಗಿದೆ",
"failed_to_switch_program_please_try_again": "ಕಾರ್ಯಕ್ರಮ ಬದಲಾಯಿಸಲು ವಿಫಲವಾಗಿದೆ. ದಯವಿಟ್ಟು ಮತ್ತೆ ಪ್ರಯತ್ನಿಸಿ.",
"show_all_programs": "ಎಲ್ಲಾ ಕಾರ್ಯಕ್ರಮಗಳನ್ನು ತೋರಿಸಿ"
-}
\ No newline at end of file
+}
diff --git a/src/context/locales/ma.json b/src/context/locales/ma.json
index d7cbc124..d71964dc 100644
--- a/src/context/locales/ma.json
+++ b/src/context/locales/ma.json
@@ -132,6 +132,7 @@
"no_data_found": "कोणतीही माहिती आढळली नाही",
"my_profile": "माझे प्रोफाइल",
"second_chance_program": "दुसरी संधी कार्यक्रम",
+ "second_chance_program_pathways": "दुसरी संधी कार्यक्रमाचे मार्ग",
"logout": "लॉगआउट करा",
"general_instructions": "सर्वसाधारण सूचना",
"test_medium": "चाचणी माध्यम",
@@ -637,4 +638,4 @@
"switched_to": "यावर बदलले",
"failed_to_switch_program_please_try_again": "कार्यक्रम बदलण्यात अयशस्वी. कृपया पुन्हा प्रयत्न करा.",
"show_all_programs": "सर्व कार्यक्रम दाखवा"
-}
\ No newline at end of file
+}
diff --git a/src/context/locales/odia.json b/src/context/locales/odia.json
index cecba6c3..f842a873 100644
--- a/src/context/locales/odia.json
+++ b/src/context/locales/odia.json
@@ -132,6 +132,7 @@
"no_data_found": "କୌଣସି ତଥ୍ୟ ମିଳିଲା ନାହିଁ",
"my_profile": "ମୋ ପ୍ରୋଫାଇଲ",
"second_chance_program": "ସେକେଣ୍ଡ ଚାନ୍ସ ପ୍ରୋଗ୍ରାମ",
+ "second_chance_program_pathways": "ଦ୍ୱିତୀୟ ସୁଯୋଗ କାର୍ଯ୍ୟକ୍ରମର ପଥଗୁଡ଼ିକ",
"logout": "ଲଗ୍ ଆଉଟ",
"general_instructions": "ସାଧାରଣ ନିର୍ଦ୍ଦେଶ",
"test_medium": "ପରୀକ୍ଷା ମାଧ୍ୟମ",
@@ -637,4 +638,4 @@
"switched_to": "ବଦଳାଇ ଦିଆଗଲା",
"failed_to_switch_program_please_try_again": "କାର୍ଯ୍ୟକ୍ରମ ବଦଳାଇବାରେ ବିଫଳ। ଦୟାକରି ପୁନଃ ଚେଷ୍ଟା କରନ୍ତୁ।",
"show_all_programs": "ସମସ୍ତ କାର୍ଯ୍ୟକ୍ରମ ଦେଖାନ୍ତୁ"
-}
\ No newline at end of file
+}
diff --git a/src/context/locales/ta.json b/src/context/locales/ta.json
index cb835967..2639eee7 100644
--- a/src/context/locales/ta.json
+++ b/src/context/locales/ta.json
@@ -132,6 +132,7 @@
"no_data_found": "தரவு எதுவும் இல்லை",
"my_profile": "எனது புரொஃபைல்",
"second_chance_program": "செகண்ட் சான்ஸ் புரோகிராம்",
+ "second_chance_program_pathways": "இரண்டாவது வாய்ப்பு திட்டத்தின் வழிகள்",
"logout": "லாக்அவுட்",
"general_instructions": "பொதுவான வழிமுறைகள்",
"test_medium": "தேர்வு மொழி",
@@ -637,4 +638,4 @@
"switched_to": "மாற்றப்பட்டது",
"failed_to_switch_program_please_try_again": "திட்டத்தை மாற்ற முடியவில்லை. மீண்டும் முயற்சிக்கவும்.",
"show_all_programs": "அனைத்து திட்டங்களையும் காட்டு"
-}
\ No newline at end of file
+}
diff --git a/src/context/locales/te.json b/src/context/locales/te.json
index e05343c2..577ca487 100644
--- a/src/context/locales/te.json
+++ b/src/context/locales/te.json
@@ -132,6 +132,7 @@
"no_data_found": "డేటా కనుగొనబడలేదు",
"my_profile": "నా ప్రొఫైల్",
"second_chance_program": "సెకండ్ ఛాన్స్ ప్రోగ్రామ్",
+ "second_chance_program_pathways": "రెండవ అవకాశం కార్యక్రమ మార్గాలు",
"logout": "లాగ్ అవుట్",
"general_instructions": "సాధారణ సూచనలు",
"test_medium": "పరీక్ష మాధ్యమం",
@@ -637,4 +638,4 @@
"switched_to": "కు మార్చబడింది",
"failed_to_switch_program_please_try_again": "ప్రోగ్రామ్ను మార్చడంలో విఫలమైంది. దయచేసి మళ్లీ ప్రయత్నించండి.",
"show_all_programs": "అన్ని ప్రోగ్రామ్లను చూపించు"
-}
\ No newline at end of file
+}
diff --git a/src/context/locales/ur.json b/src/context/locales/ur.json
index 085c4c01..4a7c4b59 100644
--- a/src/context/locales/ur.json
+++ b/src/context/locales/ur.json
@@ -132,6 +132,7 @@
"no_data_found": "کوئی ڈیٹا نہیں ملا",
"my_profile": "میرا پروفائل",
"second_chance_program": "سکنڈ چانس پروگرام",
+ "second_chance_program_pathways": "دوسرے موقع کے پروگرام کے راستے",
"logout": "لاگ آؤٹ",
"general_instructions": "عام ہدایات",
"test_medium": "ٹیسٹ کا ذریعہ",
@@ -637,4 +638,4 @@
"switched_to": "میں تبدیل کر دیا گیا",
"failed_to_switch_program_please_try_again": "پروگرام تبدیل کرنے میں ناکامی۔ براہ کرم دوبارہ کوشش کریں۔",
"show_all_programs": "تمام پروگرام دکھائیں"
-}
\ No newline at end of file
+}
diff --git a/src/screens/Dashboard/Contents.js b/src/screens/Dashboard/Contents.js
index e3e3ed48..53d0c2c6 100644
--- a/src/screens/Dashboard/Contents.js
+++ b/src/screens/Dashboard/Contents.js
@@ -25,6 +25,7 @@ import SyncCard from '../../components/SyncComponent/SyncCard';
import BackButtonHandler from '../../components/BackNavigation/BackButtonHandler';
import {
capitalizeName,
+ getContentPlatformIds,
getDataFromStorage,
logEventFunction,
} from '../../utils/JsHelper/Helper';
@@ -165,13 +166,7 @@ const Contents = () => {
setLoadingMore(true);
}
console.log('refreshed');
- let userType = await getDataFromStorage('userType');
- const instant =
- userType === 'youthnet'
- ? { frameworkId: 'pos-framework', channelId: 'pos-channel' }
- : userType === 'scp'
- ? { frameworkId: 'scp-framework', channelId: 'scp-channel' }
- : { frameworkId: 'pos-framework', channelId: 'pos-channel' };
+ const instant = await getContentPlatformIds();
const data = await contentListApi_Pratham({ searchText, instant, offset });
//found content progress
diff --git a/src/screens/Dashboard/Courses/Courses.js b/src/screens/Dashboard/Courses/Courses.js
index 7bb725d4..e36a46f0 100644
--- a/src/screens/Dashboard/Courses/Courses.js
+++ b/src/screens/Dashboard/Courses/Courses.js
@@ -36,10 +36,12 @@ import FilterList from '@components/FilterModal/FilterList';
import FilterDrawer from '@components/FilterModal/FilterDrawer';
import {
capitalizeName,
+ getContentPlatformIds,
getDataFromStorage,
logEventFunction,
setDataInStorage,
} from '../../../utils/JsHelper/Helper';
+import { CONTENT_PLATFORM_IDS } from '../../../utils/Constants/app-constants';
import { courseTrackingStatus } from '../../../utils/API/ApiCalls';
import ActiveLoading from '../../LoadingScreen/ActiveLoading';
import CustomSearchBox from '../../../components/CustomSearchBox/CustomSearchBox';
@@ -182,12 +184,7 @@ const Courses = ({ route, CopilotStopped, customProp = null }) => {
setYouthnet(isYouthnet);
let userId = await getDataFromStorage('userId');
setUserId(userId);
- const instant =
- userType === 'youthnet'
- ? { frameworkId: 'pos-framework', channelId: 'pos-channel' }
- : userType === 'scp'
- ? { frameworkId: 'scp-framework', channelId: 'scp-channel' }
- : { frameworkId: 'pos-framework', channelId: 'pos-channel' };
+ const instant = await getContentPlatformIds();
setInstant(instant);
};
fetch();
@@ -290,8 +287,10 @@ const Courses = ({ route, CopilotStopped, customProp = null }) => {
}
const tenantData = JSON.parse(await getDataFromStorage('tenantData'));
const channelId = tenantData?.[0]?.channelId;
- if(channelId == 'scp-channel'){
- mergedFilter.targetBoardIds = ["scp-framework_board_cocurricular"];
+ if (channelId == CONTENT_PLATFORM_IDS.SCP.channelId && CONTENT_PLATFORM_IDS.SCP.boardId) {
+ mergedFilter.targetBoardIds = [CONTENT_PLATFORM_IDS.SCP.boardId];
+ } else if (channelId == CONTENT_PLATFORM_IDS.SCP_PATHWAYS.channelId && CONTENT_PLATFORM_IDS.SCP_PATHWAYS.boardId) {
+ mergedFilter.targetBoardIds = [CONTENT_PLATFORM_IDS.SCP_PATHWAYS.boardId];
}
let data = await courseListApi_New({
searchText,
diff --git a/src/screens/LoginScreen/LoginScreen.js b/src/screens/LoginScreen/LoginScreen.js
index ce7cf7f2..835f095d 100644
--- a/src/screens/LoginScreen/LoginScreen.js
+++ b/src/screens/LoginScreen/LoginScreen.js
@@ -652,7 +652,12 @@ const LoginScreen = () => {
?.map((item) => item?.tenantId);
const scp = tenantDetails
- ?.filter((item) => item.name === 'Second Chance Program')
+ ?.filter((item) =>
+ [
+ TENANT_DATA.SECOND_CHANCE_PROGRAM,
+ TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS,
+ ].includes(item.name)
+ )
?.map((item) => item.tenantId);
// const role = roleName;
@@ -660,7 +665,7 @@ const LoginScreen = () => {
{
// console.log('#### loginmultirole role', role);
- if (tenantId === scp?.[0]) {
+ if (scp?.includes(tenantId)) {
console.log('####loginintoscp', scp);
await setDataInStorage('userType', 'scp');
navigation.navigate('SCPUserTabScreen');
@@ -786,11 +791,11 @@ const LoginScreen = () => {
// Determine program type using tenant name (reliable) as primary,
// tenant ID match from getProgramDetails as secondary.
// selectedTenantName comes directly from the user's enrolled tenant data via getUserDetails API.
- const scpTenantIds = tenantDetails?.filter((item) => item?.name === TENANT_DATA.SECOND_CHANCE_PROGRAM)?.map((item) => item?.tenantId);
+ const scpTenantIds = tenantDetails?.filter((item) => [TENANT_DATA.SECOND_CHANCE_PROGRAM, TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS].includes(item?.name))?.map((item) => item?.tenantId);
const youthnetTenantIds = tenantDetails?.filter((item) => item?.name === TENANT_DATA.YOUTHNET)?.map((item) => item?.tenantId);
const campToClubTenantIds = tenantDetails?.filter((item) => item?.name === TENANT_DATA.CAMP_TO_CLUB)?.map((item) => item?.tenantId);
- if (selectedTenantName === TENANT_DATA.SECOND_CHANCE_PROGRAM || scpTenantIds?.includes(selectedtenantId)) {
+ if ([TENANT_DATA.SECOND_CHANCE_PROGRAM, TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS].includes(selectedTenantName) || scpTenantIds?.includes(selectedtenantId)) {
console.log('#### selectedProgramLogin → SCPUserTabScreen');
await setDataInStorage('userType', 'scp');
navigation.reset({ index: 0, routes: [{ name: 'SCPUserTabScreen' }] });
diff --git a/src/screens/PlpWebViewScreen/PlpWebViewScreen.js b/src/screens/PlpWebViewScreen/PlpWebViewScreen.js
index c9e161e1..091fceda 100644
--- a/src/screens/PlpWebViewScreen/PlpWebViewScreen.js
+++ b/src/screens/PlpWebViewScreen/PlpWebViewScreen.js
@@ -245,7 +245,12 @@ const PlpWebViewScreen = () => {
?.map((item) => item?.tenantId);
const scp = tenantDetails
- ?.filter((item) => item.name === 'Second Chance Program')
+ ?.filter((item) =>
+ [
+ TENANT_DATA.SECOND_CHANCE_PROGRAM,
+ TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS,
+ ].includes(item.name)
+ )
?.map((item) => item.tenantId);
// const role = roleName;
@@ -253,7 +258,7 @@ const PlpWebViewScreen = () => {
{
// console.log('#### loginmultirole role', role);
- if (tenantId === scp?.[0]) {
+ if (scp?.includes(tenantId)) {
console.log('####loginintoscp', scp);
await setDataInStorage('userType', 'scp');
navigation.navigate('SCPUserTabScreen');
@@ -368,11 +373,11 @@ const PlpWebViewScreen = () => {
// Determine program type using tenant name (reliable) as primary,
// tenant ID match from getProgramDetails as secondary.
// selectedTenantName comes directly from the user's enrolled tenant data via getUserDetails API.
- const scpTenantIds = tenantDetails?.filter((item) => item?.name === TENANT_DATA.SECOND_CHANCE_PROGRAM)?.map((item) => item?.tenantId);
+ const scpTenantIds = tenantDetails?.filter((item) => [TENANT_DATA.SECOND_CHANCE_PROGRAM, TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS].includes(item?.name))?.map((item) => item?.tenantId);
const youthnetTenantIds = tenantDetails?.filter((item) => item?.name === TENANT_DATA.YOUTHNET)?.map((item) => item?.tenantId);
const campToClubTenantIds = tenantDetails?.filter((item) => item?.name === TENANT_DATA.CAMP_TO_CLUB)?.map((item) => item?.tenantId);
- if (selectedTenantName === TENANT_DATA.SECOND_CHANCE_PROGRAM || scpTenantIds?.includes(selectedtenantId)) {
+ if ([TENANT_DATA.SECOND_CHANCE_PROGRAM, TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS].includes(selectedTenantName) || scpTenantIds?.includes(selectedtenantId)) {
console.log('#### selectedProgramLogin → SCPUserTabScreen');
await setDataInStorage('userType', 'scp');
navigation.reset({ index: 0, routes: [{ name: 'SCPUserTabScreen' }] });
diff --git a/src/screens/Profile/Profile.js b/src/screens/Profile/Profile.js
index a290f43f..d19d05f4 100644
--- a/src/screens/Profile/Profile.js
+++ b/src/screens/Profile/Profile.js
@@ -39,6 +39,7 @@ import {
import { useInternet } from '../../context/NetworkContext';
import NetworkAlert from '../../components/NetworkError/NetworkAlert';
import { courseTrackingStatus } from '@src/utils/API/ApiCalls';
+import { TENANT_DATA } from '../../utils/Constants/app-constants';
const Profile = () => {
const { t, language } = useTranslation();
@@ -49,6 +50,7 @@ const Profile = () => {
const { isConnected } = useInternet();
const [networkstatus, setNetworkstatus] = useState(true);
const [userType, setUserType] = useState();
+ const [programName, setProgramName] = useState('');
const [cohortId, setCohortId] = useState();
const [courseList, setCourseList] = useState([]);
@@ -134,6 +136,10 @@ const Profile = () => {
const data = await getStudentForm();
let userType = await getDataFromStorage('userType');
setUserType(userType);
+ const storedTenantData = JSON.parse(
+ (await getDataFromStorage('tenantData')) || '[]'
+ );
+ setProgramName(storedTenantData?.[0]?.tenantName || '');
setDataInStorage('studentForm', JSON.stringify(data?.fields));
const tenantId = await getDataFromStorage('userTenantid');
@@ -278,6 +284,29 @@ const Profile = () => {
}
};
+ const normalizeName = (name) => (name || '').trim().toLowerCase();
+ const normalizedProgramName = normalizeName(programName);
+
+ let displayProgramLabel;
+ if (normalizedProgramName === normalizeName(TENANT_DATA.SECOND_CHANCE_PROGRAM)) {
+ displayProgramLabel = t('second_chance_program');
+ } else if (normalizedProgramName === normalizeName(TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS)) {
+ displayProgramLabel = t('second_chance_program_pathways');
+ } else if (normalizedProgramName === normalizeName(TENANT_DATA.YOUTHNET)) {
+ displayProgramLabel = t('vocational_training');
+ } else if (programName) {
+ displayProgramLabel = programName;
+ } else if (userType == 'youthnet') {
+ displayProgramLabel = t('vocational_training');
+ } else if (userType == 'scp') {
+ // Tenant name unavailable — SCP and Pathways both map to userType
+ // 'scp', so we can't tell which one this is. Show nothing rather
+ // than guessing and risking the wrong program name.
+ displayProgramLabel = '';
+ } else {
+ displayProgramLabel = userType;
+ }
+
return (
@@ -342,11 +371,7 @@ const Profile = () => {
- {userType == 'youthnet'
- ? 'Vocational Training'
- : userType == 'scp'
- ? t('Second Chance Program')
- : userType}
+ {displayProgramLabel}
diff --git a/src/screens/ProgramsScreen/ProgramsScreen.js b/src/screens/ProgramsScreen/ProgramsScreen.js
index 2dc5cc76..ad12b03d 100644
--- a/src/screens/ProgramsScreen/ProgramsScreen.js
+++ b/src/screens/ProgramsScreen/ProgramsScreen.js
@@ -213,7 +213,12 @@ const academicyear = await setAcademicYear({ tenantid: tenantId });
?.map((item) => item?.tenantId);
const scp = tenantDetails
- ?.filter((item) => item.name === 'Second Chance Program')
+ ?.filter((item) =>
+ [
+ TENANT_DATA.SECOND_CHANCE_PROGRAM,
+ TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS,
+ ].includes(item.name)
+ )
?.map((item) => item.tenantId);
// const role = roleName;
@@ -221,7 +226,7 @@ const academicyear = await setAcademicYear({ tenantid: tenantId });
{
// console.log('#### loginmultirole role', role);
- if (tenantId === scp?.[0]) {
+ if (scp?.includes(tenantId)) {
console.log('####loginintoscp', scp);
await setDataInStorage('userType', 'scp');
navigation.navigate('SCPUserTabScreen');
diff --git a/src/screens/RegisterScreen/RegistrationForm.js b/src/screens/RegisterScreen/RegistrationForm.js
index ab67a96d..6c76a5c5 100644
--- a/src/screens/RegisterScreen/RegistrationForm.js
+++ b/src/screens/RegisterScreen/RegistrationForm.js
@@ -225,7 +225,12 @@ const RegistrationForm = ({ fields }) => {
?.map((item) => item?.tenantId);
const scp = programData
- ?.filter((item) => item.name === 'Second Chance Program')
+ ?.filter((item) =>
+ [
+ TENANT_DATA.SECOND_CHANCE_PROGRAM,
+ TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS,
+ ].includes(item.name)
+ )
?.map((item) => item.tenantId);
const role = roleName;
@@ -233,7 +238,7 @@ const RegistrationForm = ({ fields }) => {
console.log('#### loginmultirole tenantid', tenantid);
if (role == 'Learner' || role == 'Student') {
- if (tenantid === scp?.[0]) {
+ if (scp?.includes(tenantid)) {
await setDataInStorage('userType', 'scp');
if (cohort_id) {
navigation.navigate('SCPUserTabScreen');
diff --git a/src/screens/YouthNet/L1Courses.js b/src/screens/YouthNet/L1Courses.js
index 188a19d8..0bb8b787 100644
--- a/src/screens/YouthNet/L1Courses.js
+++ b/src/screens/YouthNet/L1Courses.js
@@ -31,6 +31,7 @@ import SyncCard from '@src/components/SyncComponent/SyncCard';
import BackButtonHandler from '@src/components/BackNavigation/BackButtonHandler';
import {
capitalizeName,
+ getContentPlatformIds,
getDataFromStorage,
getTentantId,
logEventFunction,
@@ -80,12 +81,7 @@ const L1Courses = () => {
const userId = await getDataFromStorage('userId');
setUserId(userId);
- const instant =
- userType === 'youthnet'
- ? { frameworkId: 'pos-framework', channelId: 'pos-channel' }
- : userType === 'scp'
- ? { frameworkId: 'scp-framework', channelId: 'scp-channel' }
- : { frameworkId: 'pos-framework', channelId: 'pos-channel' };
+ const instant = await getContentPlatformIds();
setInstant(instant);
};
diff --git a/src/services/syncService.js b/src/services/syncService.js
index a90061b6..95f4c4d3 100644
--- a/src/services/syncService.js
+++ b/src/services/syncService.js
@@ -10,7 +10,7 @@ import {
syncCourseDetails,
updateCourseStatus,
} from '../utils/API/AuthService';
-import { getDataFromStorage, getTentantId } from '../utils/JsHelper/Helper';
+import { getDataFromStorage } from '../utils/JsHelper/Helper';
import {
contentTracking,
contentTrackingSync,
@@ -268,7 +268,7 @@ async function checkCriteriaForCertificate(reqBody) {
console.log('Question Set Data:', questionSetData);
//tenantId
- const tenantId = getTentantId();
+ const userType = await getDataFromStorage('userType');
// You can now use questionSetData array for further processing
// Example output: [{contentId: "do_214302433656496128152", unitId: "do_214373529013116928121"}]
@@ -313,7 +313,7 @@ async function checkCriteriaForCertificate(reqBody) {
const percentage = parseFloat(assessment.percentage);
//percentage comparison from program specific configuration
let percentageComparision = 40;
- if (tenantId === '914ca990-9b45-4385-a06b-05054f35d0b9') {
+ if (userType === 'scp') {
percentageComparision = 80;
}
return percentage >= percentageComparision;
diff --git a/src/utils/API/AuthService.js b/src/utils/API/AuthService.js
index 520dec22..ec8d1303 100644
--- a/src/utils/API/AuthService.js
+++ b/src/utils/API/AuthService.js
@@ -347,12 +347,18 @@ export const courseListApi_testing = async ({
Accept: 'application/json',
};
let userType = await getDataFromStorage('userType');
+ let uiConfig = {};
+ try {
+ uiConfig = JSON.parse((await getDataFromStorage('uiConfig')) || '{}');
+ } catch (e) {
+ console.log('Error parsing uiConfig:', e);
+ }
const payload = {
request: {
filters: {
program:
userType == 'scp'
- ? ['secondchance', 'Second Chance']
+ ? uiConfig?.program || ['secondchance', 'Second Chance']
: ['Youthnet', 'youthnet', 'YouthNet', TENANT_DATA.YOUTHNET],
...(inprogress_do_ids && { identifier: inprogress_do_ids }),
primaryCategory: ['Course'],
@@ -838,10 +844,19 @@ export const assessmentListApi = async (params = {}) => {
Accept: 'application/json',
};
let userType = await getDataFromStorage('userType');
+ let uiConfig = {};
+ try {
+ uiConfig = JSON.parse((await getDataFromStorage('uiConfig')) || '{}');
+ } catch (e) {
+ console.log('Error parsing uiConfig:', e);
+ }
const payload = {
request: {
filters: {
- program: userType == 'scp' ? ['Second Chance'] : [TENANT_DATA.YOUTHNET],
+ program:
+ userType == 'scp'
+ ? uiConfig?.program || ['Second Chance']
+ : [TENANT_DATA.YOUTHNET],
board: `${params?.boardName}`,
// "se_boards": [`${params?.boardName}`],
diff --git a/src/utils/Constants/app-constants.js b/src/utils/Constants/app-constants.js
index 799ad783..e3ee85fb 100644
--- a/src/utils/Constants/app-constants.js
+++ b/src/utils/Constants/app-constants.js
@@ -1,13 +1,38 @@
export const TENANT_DATA = {
- TENANT_NAME: 'tenantName',
- SECOND_CHANCE_PROGRAM: 'Second Chance Program',
- PRATHAM_SCP: 'pratham SCP',
- YOUTHNET: 'Vocational Training',
- MENTOR: 'mentor',
- LEADER: 'leader',
- CAMP_TO_CLUB : 'Camp to Club',
-
- POS :'Open School',
- PRAGYANPATH : 'Pragyanpath',
-
- };
\ No newline at end of file
+ TENANT_NAME: 'tenantName',
+ SECOND_CHANCE_PROGRAM: 'Second Chance Program',
+ SECOND_CHANCE_PROGRAM_PATHWAYS: 'Second Chance Program Pathways',
+ PRATHAM_SCP: 'pratham SCP',
+ YOUTHNET: 'Vocational Training',
+ MENTOR: 'mentor',
+ LEADER: 'leader',
+ CAMP_TO_CLUB: 'Camp to Club',
+
+ POS: 'Open School',
+ PRAGYANPATH: 'Pragyanpath',
+};
+
+// Content-platform (Ekstep) IDs used to fetch/filter content per program.
+// SCP and SCP Pathways are both routed to userType === 'scp', but they use
+// different content channels/frameworks on the backend, so lookups must be
+// keyed off the actual tenant name, not just userType.
+export const CONTENT_PLATFORM_IDS = {
+ DEFAULT: { frameworkId: 'pos-framework', channelId: 'pos-channel' },
+ SCP: {
+ frameworkId: 'scp-framework',
+ channelId: 'scp-channel',
+ collectionFramework: 'scp-framework',
+ questionSetFramework: 'scp-framework',
+ boardId: 'scp-framework_board_cocurricular',
+ },
+ SCP_PATHWAYS: {
+ frameworkId: 'pos-framework',
+ channelId: 'pathways-channel',
+ collectionFramework: 'pathwayFramework',
+ questionSetFramework: 'pathwayFramework',
+ // No confirmed board ID for Pathways content yet — leave unset (null)
+ // rather than reusing SCP's board ID, which would silently filter out
+ // every Pathways course whose content isn't tagged with that board.
+ boardId: null,
+ },
+};
diff --git a/src/utils/JsHelper/DeepLink.js b/src/utils/JsHelper/DeepLink.js
index fc95d03a..1ea882b4 100644
--- a/src/utils/JsHelper/DeepLink.js
+++ b/src/utils/JsHelper/DeepLink.js
@@ -127,7 +127,7 @@ const switchToProgram = async (tenant, navigation) => {
?.map((item) => item?.tenantId);
const scpTenantIds = tenantDetails
- ?.filter((item) => item?.name === TENANT_DATA.SECOND_CHANCE_PROGRAM)
+ ?.filter((item) => [TENANT_DATA.SECOND_CHANCE_PROGRAM, TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS].includes(item?.name))
?.map((item) => item?.tenantId);
const campToClubTenantIds = tenantDetails
@@ -168,7 +168,7 @@ const switchToProgram = async (tenant, navigation) => {
if (scpTenantIds?.includes(tenantId)) {
console.log('#### DeepLink: Setting userType to scp');
await setDataInStorage('userType', 'scp');
- } else if (selectedTenantName === TENANT_DATA.SECOND_CHANCE_PROGRAM) {
+ } else if ([TENANT_DATA.SECOND_CHANCE_PROGRAM, TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS].includes(selectedTenantName)) {
console.log('#### DeepLink: Setting userType to scp (by name)');
await setDataInStorage('userType', 'scp');
} else if (youthnetTenantIds?.includes(tenantId)) {
diff --git a/src/utils/JsHelper/Helper.js b/src/utils/JsHelper/Helper.js
index 8a4aac1c..ac6d28c6 100644
--- a/src/utils/JsHelper/Helper.js
+++ b/src/utils/JsHelper/Helper.js
@@ -6,6 +6,7 @@ import RNFS from 'react-native-fs';
import messaging from '@react-native-firebase/messaging';
import { getCurrentRouteParams } from '../NavigationService';
import { readContent } from '../API/ApiCalls';
+import { TENANT_DATA, CONTENT_PLATFORM_IDS } from '../Constants/app-constants';
// Get Saved Data from AsyncStorage
@@ -19,6 +20,23 @@ export const getDataFromStorage = async (value) => {
}
};
+// Resolve the content-platform (Ekstep) framework/channel IDs for the
+// currently logged-in user's program. SCP and SCP Pathways both store
+// userType === 'scp', so the actual tenant name (not userType) is what
+// distinguishes which set of IDs to use.
+export const getContentPlatformIds = async () => {
+ const userType = await getDataFromStorage('userType');
+ if (userType !== 'scp') {
+ return CONTENT_PLATFORM_IDS.DEFAULT;
+ }
+ const tenantData = JSON.parse((await getDataFromStorage('tenantData')) || '[]');
+ const tenantName = (tenantData?.[0]?.tenantName || '').trim().toLowerCase();
+ const pathwaysName = TENANT_DATA.SECOND_CHANCE_PROGRAM_PATHWAYS.trim().toLowerCase();
+ return tenantName === pathwaysName
+ ? CONTENT_PLATFORM_IDS.SCP_PATHWAYS
+ : CONTENT_PLATFORM_IDS.SCP;
+};
+
// Save Refresh Token
export const setDataInStorage = async (name, data) => {