File tree Expand file tree Collapse file tree 11 files changed +46
-15
lines changed
learner-web-app/src/components
libs/shared-lib-v2/src/DynamicForm/utils Expand file tree Collapse file tree 11 files changed +46
-15
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ const telemetryConfig = {
3030 ( typeof window !== 'undefined' && localStorage . getItem ( 'id' ) ) ||
3131 'Anonymous' ,
3232 sid : generateUUID ( ) ,
33- batchsize : 3 ,
33+ batchsize : 1 ,
3434 mode : '' ,
3535 host : hostURL , //TODO: Change this host and endpoint properly
3636 endpoint : '/v1/telemetry' ,
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export const GlobalProvider: React.FC<GlobalProviderProps> = ({ children }) => {
3636 localStorage . setItem ( 'channelId' , tenantInfo . channelId ) ;
3737 localStorage . setItem ( 'tenantId' , tenantInfo . tenantId ) ;
3838 localStorage . setItem ( 'userProgram' , tenantInfo . name ) ;
39+ localStorage . setItem ( 'uiConfig' , JSON . stringify ( tenantInfo ?. params ?. uiConfig || { } ) ) ;
3940 localStorage . setItem (
4041 'collectionFramework' ,
4142 tenantInfo . collectionFramework
Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ const SearchPage = () => {
1616 const [ searchValue , setSearchValue ] = React . useState ( '' ) ;
1717 const [ submitText , setSubmitText ] = React . useState ( '' ) ;
1818 const searchParams = useSearchParams ( ) ;
19-
19+ const storedConfig =
20+ typeof window !== 'undefined'
21+ ? JSON . parse ( localStorage . getItem ( 'uiConfig' ) || '{}' )
22+ : { } ;
2023 React . useEffect ( ( ) => {
2124 const queryParam = searchParams ?. get ( 'q' ) || '' ;
2225 setSearchValue ( queryParam ) ;
@@ -44,6 +47,8 @@ const SearchPage = () => {
4447 filters = { {
4548 query : submitText ,
4649 } }
50+ contentTabs = { storedConfig . showContent }
51+
4752 isShowLayout = { false }
4853 showFilter = { false }
4954 showSearch = { false }
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ const telemetryConfig = {
3434 ( typeof window !== 'undefined' && localStorage . getItem ( 'userName' ) ) ||
3535 'Anonymous' ,
3636 sid : generateUUID ( ) ,
37- batchsize : 3 ,
37+ batchsize : 1 ,
3838 mode : '' ,
3939 host : hostURL ,
4040 endpoint : '/v1/telemetry' ,
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ const telemetryConfig = {
3131 ( typeof window !== 'undefined' && localStorage . getItem ( 'id' ) ) ||
3232 'Anonymous' ,
3333 sid : generateUUID ( ) ,
34- batchsize : 3 ,
34+ batchsize : 1 ,
3535 mode : '' ,
3636 host : hostURL , //TODO: Change this host and endpoint properly
3737 endpoint : '/v1/telemetry' ,
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ import config from '../../config.json';
2626import ReactGA from 'react-ga4' ;
2727import { Snackbar , Alert } from "@mui/material" ;
2828import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline" ;
29+ import { Telemetry } from '../utils/app.constant' ;
30+ import { telemetryFactory } from '../utils/telemetry' ;
2931
3032
3133type LoginPageProps = {
@@ -52,7 +54,21 @@ const LoginPage: React.FC<LoginPageProps> = ({ onLoginSuccess }) => {
5254
5355 const passwordRef = useRef < HTMLInputElement > ( null ) ;
5456 const loginButtonRef = useRef < HTMLButtonElement > ( null ) ;
55-
57+ const telemetryOnSubmit = ( ) => {
58+ const telemetryInteract = {
59+ context : {
60+ env : 'sign-in' ,
61+ cdata : [ ] ,
62+ } ,
63+ edata : {
64+ id : 'login-success' ,
65+ type : Telemetry . CLICK ,
66+ subtype : '' ,
67+ pageid : 'sign-in' ,
68+ } ,
69+ } ;
70+ telemetryFactory . interact ( telemetryInteract ) ;
71+ } ;
5672 useEffect ( ( ) => {
5773 if ( typeof window !== 'undefined' && window . localStorage ) {
5874 let lang ;
@@ -104,6 +120,7 @@ const LoginPage: React.FC<LoginPageProps> = ({ onLoginSuccess }) => {
104120
105121 const userResponse = await getUserId ( ) ;
106122
123+ telemetryOnSubmit ( ) ;
107124 if ( onLoginSuccess ) {
108125 onLoginSuccess ( userResponse ) ;
109126 setLoading ( false )
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ const telemetryConfig = {
3434 ( typeof window !== 'undefined' && localStorage . getItem ( 'userName' ) ) ||
3535 'Anonymous' ,
3636 sid : generateUUID ( ) ,
37- batchsize : 3 ,
37+ batchsize : 1 ,
3838 mode : '' ,
3939 host : hostURL ,
4040 endpoint : '/v1/telemetry' ,
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ const SessionCardFooter: React.FC<SessionCardFooterProps> = ({
131131 }
132132 ) ;
133133 courseData = response ?. result ?. data [ 0 ] ;
134- courseId = courseData . _id ;
134+ courseId = courseData ? ._id ;
135135 }
136136
137137 // let courseData = response?.result?.data[0];
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ export const getUserProjectTemplate = async ({
9090 solutionId,
9191 role,
9292 entityId,
93- acl
93+ acl,
9494} : GetUserProjectTemplateParams ) : Promise < any > => {
9595 const apiUrl : string = `${ process . env . NEXT_PUBLIC_COURSE_PLANNER_API_URL } /userProjects/details?templateId=${ templateId } &solutionId=${ solutionId } ` ;
9696
@@ -106,7 +106,7 @@ export const getUserProjectTemplate = async ({
106106 // scope: {}
107107 // },
108108 entityId,
109- acl
109+ acl,
110110 } ;
111111
112112 try {
@@ -145,7 +145,7 @@ export const UserStatusDetails = async ({
145145export const fetchCourseIdFromSolution = async (
146146 solutionId : string ,
147147 cohortId : string ,
148- acl :any
148+ acl : any
149149) : Promise < any > => {
150150 try {
151151 const solutionResponse = await getSolutionDetails ( {
@@ -154,15 +154,23 @@ export const fetchCourseIdFromSolution = async (
154154 } ) ;
155155
156156 const externalId = solutionResponse ?. result ?. externalId ;
157- let response = await getUserProjectTemplate ( {
157+ await getUserProjectTemplate ( {
158158 templateId : externalId ,
159159 solutionId,
160160 role : Role . TEACHER ,
161161 entityId : cohortId ,
162- acl
162+ acl,
163+ } ) ;
164+ const updatedResponse = await getTargetedSolutions ( {
165+ subject : acl ?. subject ,
166+ class : acl ?. class ,
167+ board : acl ?. board ,
168+ courseType : acl ?. courseType ,
169+ medium : acl ?. medium ,
170+ entityId : cohortId ,
163171 } ) ;
164172
165- return response ;
173+ return updatedResponse ;
166174 } catch ( error ) {
167175 console . error ( 'Error fetching solution details:' , error ) ;
168176 // throw error;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ const telemetryConfig = {
3434 ( typeof window !== 'undefined' && localStorage . getItem ( 'userName' ) ) ||
3535 'Anonymous' ,
3636 sid : generateUUID ( ) ,
37- batchsize : 3 ,
37+ batchsize : 1 ,
3838 mode : '' ,
3939 host : hostURL ,
4040 endpoint : '/v1/telemetry' ,
You can’t perform that action at this time.
0 commit comments