Skip to content

Commit 48e0902

Browse files
authored
Merge pull request #2540 from tekdi/release-1.13.0-prod-register
Release 1.13.0 prod register to learner qa
2 parents b015867 + 402731d commit 48e0902

File tree

4 files changed

+39
-61
lines changed

4 files changed

+39
-61
lines changed

apps/learner-web-app/src/app/enroll-profile-completion/page.tsx

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -127,23 +127,11 @@ const EnrollProfileCompletionInner = () => {
127127
localStorage.removeItem('previousTenantId');
128128

129129
// Store landing page for later navigation
130-
const finalLandingPage = landingPage || '/home';
131-
setLandingPage(finalLandingPage);
132-
133-
// Check if isForNavaPatham is true, skip popup and directly trigger start learning action
134-
const isForNavaPatham =
135-
typeof window !== 'undefined'
136-
? localStorage.getItem('isForNavaPatham') === 'true'
137-
: false;
138-
139-
if (isForNavaPatham) {
140-
// Skip popup and directly trigger start learning action
141-
onSigin(finalLandingPage);
142-
} else {
143-
// Show success modal instead of redirecting immediately
144-
setSignupSuccessModal(true);
145-
}
146-
}
130+
setLandingPage(landingPage || '/home');
131+
132+
// Show success modal instead of redirecting immediately
133+
setSignupSuccessModal(true);
134+
}
147135
} catch (error) {
148136
console.error('Failed to access program:', error);
149137
router.push('/programs');
@@ -154,36 +142,35 @@ const EnrollProfileCompletionInner = () => {
154142
setSignupSuccessModal(false);
155143
};
156144

157-
const onSigin = (customLandingPage?: string) => {
145+
const onSigin = () => {
158146
setSignupSuccessModal(false);
159147
console.log('enroll user to tenant', localStorage.getItem('tenantId'));
160-
const targetLandingPage = customLandingPage || landingPage || '/home';
148+
if(localStorage.getItem('isAndroidApp') == 'yes')
149+
{
150+
// Send message to React Native WebView
161151

162-
if (localStorage.getItem('isAndroidApp') == 'yes') {
163-
// Send message to React Native WebView
152+
// const enrolledProgramData = localStorage.getItem('enrolledProgramData');
164153

165-
// const enrolledProgramData = localStorage.getItem('enrolledProgramData');
154+
// const program = JSON.parse(enrolledProgramData || '{}');
166155

167-
// const program = JSON.parse(enrolledProgramData || '{}');
168156

169-
if (window.ReactNativeWebView) {
170-
window.ReactNativeWebView.postMessage(
171-
JSON.stringify({
172-
type: 'ENROLL_PROGRAM_EVENT', // Event type identifier
173-
data: {
174-
userId: localStorage.getItem('userId'),
175-
tenantId: localStorage.getItem('tenantId'),
176-
token: localStorage.getItem('token'),
177-
refreshToken: localStorage.getItem('refreshTokenForAndroid'),
157+
if (window.ReactNativeWebView) {
158+
window.ReactNativeWebView.postMessage(JSON.stringify({
159+
type: 'ENROLL_PROGRAM_EVENT', // Event type identifier
160+
data: {
161+
userId: localStorage.getItem('userId'),
162+
tenantId: localStorage.getItem('tenantId'),
163+
token: localStorage.getItem('token'),
164+
refreshToken: localStorage.getItem('refreshTokenForAndroid'),
178165

179-
// Add any data you want to send
180-
},
181-
})
182-
);
166+
// Add any data you want to send
167+
}
168+
}));
169+
}
183170
}
184-
} else {
185-
localStorage.removeItem('enrollTenantId');
186-
router.push(targetLandingPage);
171+
else{
172+
localStorage.removeItem('enrollTenantId')
173+
router.push(landingPage || '/home');
187174
}
188175
// Navigate to landing page
189176
};

apps/learner-web-app/src/app/landing/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ export default function LandingPage() {
6969
};
7070

7171
fetchPrograms();
72+
if (typeof window !== 'undefined' && window.localStorage) {
73+
localStorage.removeItem('isForNavaPatham');
74+
}
7275
}, []);
7376

7477
const handleGetStarted = async () => {
File renamed without changes.

apps/learner-web-app/src/app/registration/RegisterationFlow.tsx

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -486,30 +486,18 @@ const RegisterationFlow = () => {
486486

487487
//sent username and password
488488
sendMessage({
489-
sms: {
490-
to: [updated_payload.mobile],
491-
body: 'Hey',
492-
templateId: '6948f41681326042a2454bb2',
493-
replacements: {
494-
var1: username,
495-
var2: password,
496-
},
497-
},
489+
"sms": {
490+
"to": [updated_payload.mobile],
491+
"body":"Hey",
492+
"templateId": "6948f41681326042a2454bb2",
493+
"replacements": {
494+
"var1": username,
495+
"var2": password
496+
}
497+
}
498498
});
499499

500-
// Check if isForNavaPatham is true, skip popup and directly trigger login
501-
const isForNavaPatham =
502-
typeof window !== 'undefined'
503-
? localStorage.getItem('isForNavaPatham') === 'true'
504-
: false;
505-
506-
if (isForNavaPatham) {
507-
// Skip popup and directly trigger start exploring action
508-
await onSigin();
509-
} else {
510-
// Show success popup as usual
511-
setSignupSuccessModal(true);
512-
}
500+
setSignupSuccessModal(true);
513501
} else {
514502
showToastMessage(
515503
t('LEARNER_APP.REGISTRATION_FLOW.USERNAME_ALREADY_EXIST'),

0 commit comments

Comments
 (0)