keys = [];
anyKeys = [];
userDetails = (userDetails || {});
userDetails.firstName = userDetails.firstName || ({"value":null}).value;
userDetails.lastName = userDetails.lastName || ({"value":null}).value;
userDetails.email = userDetails.email || ({"value":null}).value;
userDetails.phone = userDetails.phone || ({"value":null}).value;
userDetails.country = userDetails.country || ({"value":null}).value;
userDetails.birthDate = userDetails.birthDate || ({"value":null}).value;
$component('global').userDetails = userDetails;
resets = {};
restart = () => {
$db('shirah').write('saved-calculator-info-study', null).then(() => $$form($refs.removeCheckpointForm).submit());
};
resetDetails = () => {
let mapped = {};
Object.keys(resets).forEach((key) => (mapped[key] = resets[key]()));
setDetails(mapped);
};
resetDetail = (key) => {
const static = $static;
const value = ((key in $native(resets)) ? resets[key]() : null);
if (Array.isArray(value)){
if (Array.isArray(details[key]) && details[key].length == 0){
return;
}
$nextTick(() => (details[key] = value));
}
else{
details[key] = value;
}
static();
};
setDetails = (value) => {
const state = $component('global');
details = value;
state.calculatorDetails = null;
state.calculatorRecommendation = null;
};
resolveValue = (key, checkAny) => {
if (checkAny && anyKeys.includes(key)){
return 'any';
}
return (Array.isArray(details[key]) ? JSON.stringify(details[key]) : details[key]);
};
composeScenarioKey = (checkAny) => {
let scenarioKey = '';
keys.forEach((key) => {
if (key in $native(details) && ((Array.isArray(details[key]) && details[key].length != 0) || (!Array.isArray(details[key]) && details[key]))){
const value = resolveValue(key, checkAny);
scenarioKey = (scenarioKey ? `${scenarioKey}.` : scenarioKey);
scenarioKey += `${key}.${value}`;
}
});
return scenarioKey;
};
getResolvedUrl = () => {
return `/calculator/study/recommendations/${resolvedScenario}?email=${encodeURI(userDetails.email)}`;
};
getResolvedScenario = () => {
const activeKeys = keys.filter((key) => (key in $native(details) && ((Array.isArray(details[key]) && details[key].length != 0) || (!Array.isArray(details[key]) && details[key]))));
for (const scenario of scenarios){
let totalQuestions = Object.keys(scenario.questionsAndAnswers).length, matchedQuestions = 0;
for (const key of activeKeys){
if ((key in $native(scenario.questionsAndAnswers)) && (scenario.questionsAndAnswers[key] === 'any' || scenario.questionsAndAnswers[key] === details[key])){
matchedQuestions += 1;
}
else if (key in $native(scenario.questionsAndAnswers)){
matchedQuestions = 0;
break;
}
}
if (matchedQuestions == totalQuestions){
return scenario.value;
}
}
return null;
};
proceedToRecommendation = () => {
if (resolvedScenario){
const state = $component('global');
state.calculatorRecommendation = resolvedScenario;
state.calculatorDetails = details;
$nextTick(() => $$form($refs.checkpointForm).submit());
}
};
updateCalculatorSaveDisallowed = (disallowed) => {
if (!!disallowed != !!calculatorSaveDisallowed){
$db('shirah').write('calculator-save-disallowed', (calculatorSaveDisallowed = !!disallowed)).then(() => loadData());
}
};
userDetailsAreValid = () => {
const requiredKeys = ['firstName', 'lastName', 'email', 'phone', 'country', 'birthDate'];
for (const key of requiredKeys){
if (!(key in userDetails) || !userDetails[key]){
return false;
}
}
checkBirthDate();
if (!validBirthDate){
return false;
}
return true;
};
afterLoad = () => {
if (!userDetailsAreValid()){
return;
}
if (validEmail){
setProceed().then(() => proceedToRecommendation());
}
};
loadData = () => {
$db('shirah').read('saved-calculator-info-study').then((data) => {
if (!data){
ready = true;
$db('shirah').read('calculator-fields').then((fields) => {
loaded = true;
if (!fields){
return;
}
dbFields = fields;
userDetails.firstName = (userDetails.firstName || fields.userDetails.firstName);
userDetails.lastName = (userDetails.lastName || fields.userDetails.lastName);
userDetails.email = (userDetails.email || fields.userDetails.email);
userDetails.phone = (userDetails.phone || fields.userDetails.phone);
userDetails.country = (userDetails.country || fields.userDetails.country);
userDetails.birthDate = (userDetails.birthDate || fields.userDetails.birthDate);
afterLoad();
});
}
else{
calculatorSaveDisallowed = true;
loaded = true;
userDetails.firstName = userDetails.firstName || data.userDetails.firstName;
userDetails.lastName = userDetails.lastName || data.userDetails.lastName;
userDetails.email = userDetails.email || data.userDetails.email;
userDetails.phone = userDetails.phone || data.userDetails.phone;
userDetails.country = userDetails.country || data.userDetails.country;
userDetails.birthDate = userDetails.birthDate || data.userDetails.birthDate;
resolvedScenario = data.resolvedScenario;
afterLoad();
}
});
};
saveData = () => {
if (calculatorSaveDisallowed || !loaded){
return;
}
$db('shirah').write('calculator-fields', {
userDetails: $native(userDetails),
});
};
showVisibleTarge = () => {
showVisibleRequested = false;
visibleTarget && visibleTarget.scrollIntoView({
behavior: 'smooth',
block: 'end',
});
visibleIndex = -1;
visibleTarget = null;
};
setVisibleIndex = (index, target) => {
const static = $static;
if ((!visibleIndex && visibleIndex !== 0) || visibleIndex < index){
visibleIndex = index;
visibleTarget = target;
if (!showVisibleRequested){
showVisibleRequested = true;
$nextTick(() => showVisibleTarge());
}
}
static();
};
checkBirthDate = () => {
if (!loaded){
return;
}
const diff = (Date.now() - (userDetails.birthDate ? new Date(userDetails.birthDate) : Date.now())), ageDate = new Date(diff);
if (!(validBirthDate = $rel.ge((userDetails.age = Math.abs(ageDate.getUTCFullYear() - 1970)), 16))){
if (userDetails.birthDate !== $static(oldBirthDate)){
$alert.notify({
type: 'warning',
title: 'Invalid Date',
message: 'You must be 16 years or older to continue',
toast: true,
});
}
}
else{
details.age = ($rel.lt(userDetails.age, 30) ? '29' : '30');
}
oldBirthDate = userDetails.birthDate;
};
setProceed = (clicked) => {
if (proceed || proceeding || !clicked){
return Promise.resolve();
}
proceeding = true;
return new Promise((resolve) => {
afterUser = (data) => {
afterUser = null;
if ((data || {}).redirectUrl){
$component('modal').successCallback = () => {
proceeding = false;
proceed = true;
resolve();
};
$router.goto(data.redirectUrl);
}
else{
proceeding = false;
proceed = true;
resolve();
}
};
$$form($$scope(this.parentElement).userForm).submit();
});
};
validEmail = false;
oldValidEmail = validEmail;
$component('global').calculatorOptions = {};
userDetails && saveData();
resolvedScenario && setVisibleIndex(999, proceedButtonContainer);
emailCheckHandler = (isValid, hasPassword) => {
if (!(validEmail = (isValid || !hasPassword))){
oldValidEmail != validEmail && $alert.notify({
type: 'warning',
title: 'Account Exists',
message: `Account already exists.Please ${hasPassword ? 'sign in' : 'set your password'} to continue.`,
toast: true,
});
const email = encodeURI(userDetails.email);
authUrl = `modal://auth?email=${email}`;
passwordSet = hasPassword;
}
else{
authUrl = null;
if (loaded && isFirstCheck && userDetailsAreValid()){
setProceed().then(() => proceedToRecommendation());
}
}
isFirstCheck = false;
oldValidEmail = validEmail;
};
if ($static(oldEmail) !== userDetails.email){
oldEmail = userDetails.email;
userDetails.email && emailInput.validity.valid && $$form(emailForm).submit();
}
userDetails.birthDate;
checkBirthDate();
scenarios = [];
$nextTick(() => {
const joinedScenarios = {};
joinedScenarios[`age.any.admission.yes.rejected.no.tuition.yes`] = 'study-visa';
joinedScenarios[`age.any.admission.yes.rejected.no.tuition.no.futureTuition.yes`] = 'study-visa';
joinedScenarios[`age.any.admission.yes.rejected.yes.gcms.yes.tuition.yes`] = 'study-visa-gcms-review';
joinedScenarios[`age.any.admission.yes.rejected.yes.gcms.yes.tuition.no.futureTuition.yes`] = 'study-visa-gcms-review';
joinedScenarios[`age.any.admission.yes.rejected.no.tuition.no.futureTuition.no`] = 'study-visa-tuition';
joinedScenarios[`age.any.admission.yes.rejected.yes.gcms.yes.tuition.no.futureTuition.no`] = 'study-visa-tuition';
joinedScenarios[`age.any.admission.yes.rejected.yes.gcms.no.tuition.yes`] = 'study-visa-gcms';
joinedScenarios[`age.any.admission.yes.rejected.yes.gcms.no.tuition.no.futureTuition.yes`] = 'study-visa-gcms';
joinedScenarios[`age.any.admission.yes.rejected.yes.gcms.no.tuition.no.futureTuition.no`] = 'study-visa-gcms';
joinedScenarios[`age.any.admission.no.educationLevel.any.major.any.proof.yes.province.any.rejected.yes.gcms.no`] = 'study-visa-school-gcms';
joinedScenarios[`age.any.admission.no.educationLevel.any.major.any.proof.yes.province.any.choiceProvince.any.rejected.yes.gcms.no`] = 'study-visa-school-gcms';
joinedScenarios[`age.any.admission.no.educationLevel.any.major.any.proof.yes.province.any.rejected.no`] = 'study-visa-school';
joinedScenarios[`age.any.admission.no.educationLevel.any.major.any.proof.yes.province.any.rejected.yes.gcms.yes`] = 'study-visa-school-gcms-review';
joinedScenarios[`age.any.admission.no.educationLevel.any.major.any.proof.yes.province.any.choiceProvince.any.rejected.no`] = 'study-visa-school';
joinedScenarios[`age.any.admission.no.educationLevel.any.major.any.proof.yes.province.any.choiceProvince.any.rejected.yes.gcms.yes`] = 'study-visa-school-gcms-review';
joinedScenarios[`age.any.admission.no.educationLevel.any.major.any.proof.no`] = 'study-visa-proof';
Object.entries(joinedScenarios).forEach(([key, value]) => {
const questionsAndAnswers = {}, questionAndAnswerPairs = key.split('.');
for (let i = 0; i < questionAndAnswerPairs.length; i += 2){
questionsAndAnswers[questionAndAnswerPairs[i]] = questionAndAnswerPairs[i + 1];
}
scenarios.push({
questionsAndAnswers,
value,
});
});
});
resetDetails();
resolvedScenario = getResolvedScenario();
if (oldResolvedScenario == resolvedScenario){
return;
}
oldResolvedScenario = resolvedScenario;
if (resolvedScenario){
$db('shirah').write('saved-calculator-info-study', {
resolvedScenario: resolvedScenario,
userDetails: $native(userDetails),
details: $native(details),
}).then(() => proceedToRecommendation());
}
else{
$db('shirah').write('saved-calculator-info-study', null);
}
$db('shirah').read('calculator-save-disallowed').then((disallowed) => {
calculatorSaveDisallowed = !!disallowed;
const state = $component('global');
if (state.calculatorRestart){
state.calculatorRestart = false;
state.userDetails = state.userDetails || {};
userDetails = userDetails || {};
userDetails.firstName = (userDetails.firstName || state.userDetails.firstName);
userDetails.lastName = (userDetails.lastName || state.userDetails.lastName);
userDetails.email = (userDetails.email || state.userDetails.email);
userDetails.phone = (userDetails.phone || state.userDetails.phone);
userDetails.country = (userDetails.country || state.userDetails.country);
userDetails.birthDate = (userDetails.birthDate || state.userDetails.birthDate);
restart();
}
!calculatorSaveDisallowed && !loaded && loadData();
});
Enter your email to continue
Before you get started, we require your email to ensure you can pick up from where you stop.
“Shirah has been an amazing partner on my journey of moving from Nigeria to Canada for studies. Honestly, I wasn’t sure how to get started with anything but after I went through Shirah’s Predictive Calculator, everything was clearer.”
Jasmin Nwankwo
keys.push('age');
anyKeys.push('age');
ageOptions = [];
$component('global').calculatorOptions.ageOptions = ageOptions;
(details && (true)) && setVisibleIndex(0, this.parentElement);
keys.push('admission');
admissionOptions = [];
$component('global').calculatorOptions.admissionOptions = admissionOptions;
How old are you?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
ageOptions.push('29');
$parent.columns.push(this.parentElement);
ageOptions.push('30');
(details && (details.age)) && setVisibleIndex(1, this.parentElement);
keys.push('educationLevel');
anyKeys.push('educationLevel');
educationLevelOptions = [];
$component('global').calculatorOptions.educationLevelOptions = educationLevelOptions;
Do you already have admission into a Canadian College or University?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
admissionOptions.push('yes');
$parent.columns.push(this.parentElement);
admissionOptions.push('no');
(details && (details.admission === 'no')) && setVisibleIndex(2, this.parentElement);
keys.push('major');
anyKeys.push('major');
majorOptions = [];
$component('global').calculatorOptions.majorOptions = majorOptions;
What is your current level of study? Check all that apply.
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
educationLevelOptions.push('High school Diploma (Secondary school)');
$parent.columns.push(this.parentElement);
educationLevelOptions.push('Diploma (OND)');
$parent.columns.push(this.parentElement);
educationLevelOptions.push('Post Graduate Diploma (HND)');
$parent.columns.push(this.parentElement);
educationLevelOptions.push('Bachelors Degree');
$parent.columns.push(this.parentElement);
educationLevelOptions.push('Masters Degree');
(details && ((details.educationLevel && details.educationLevel.length !== 0))) && setVisibleIndex(3, this.parentElement);
keys.push('proof');
proofOptions = [];
$component('global').calculatorOptions.proofOptions = proofOptions;
What are you planning on studying?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
majorOptions.push('Diploma (OND)');
$parent.columns.push(this.parentElement);
majorOptions.push('Post Graduate Diploma (HND)');
$parent.columns.push(this.parentElement);
majorOptions.push('Bachelors Degree');
$parent.columns.push(this.parentElement);
majorOptions.push('Masters Degree');
(details && (details.major)) && setVisibleIndex(4, this.parentElement);
keys.push('province');
anyKeys.push('province');
provinceOptions = [];
$component('global').calculatorOptions.provinceOptions = provinceOptions;
Do you have the required proof of funds or have someone to sponsor your study to Canada?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
See fee range chart
$parent.columns.push(this.parentElement);
proofOptions.push('yes');
$parent.columns.push(this.parentElement);
proofOptions.push('no');
(details && (details.proof === 'yes')) && setVisibleIndex(5, this.parentElement);
keys.push('choiceProvince');
anyKeys.push('choiceProvince');
choiceProvinceOptions = [];
$component('global').calculatorOptions.choiceProvinceOptions = choiceProvinceOptions;
Do you have a province of choice?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
provinceOptions.push('yes');
$parent.columns.push(this.parentElement);
provinceOptions.push('no');
(details && (details.province === 'yes')) && setVisibleIndex(6, this.parentElement);
keys.push('rejected');
rejectedOptions = [];
$component('global').calculatorOptions.rejectedOptions = rejectedOptions;
Select a Province of choice
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
choiceProvinceOptions.push('Alberta');
$parent.columns.push(this.parentElement);
choiceProvinceOptions.push('British Columbia');
$parent.columns.push(this.parentElement);
choiceProvinceOptions.push('Manitoba');
$parent.columns.push(this.parentElement);
choiceProvinceOptions.push('New Brunswick');
$parent.columns.push(this.parentElement);
choiceProvinceOptions.push('Newfoundland and Labrador');
$parent.columns.push(this.parentElement);
choiceProvinceOptions.push('Northwest Territories');
$parent.columns.push(this.parentElement);
choiceProvinceOptions.push('Nunavut');
$parent.columns.push(this.parentElement);
choiceProvinceOptions.push('Ontario');
$parent.columns.push(this.parentElement);
choiceProvinceOptions.push('Prince Edward Island');
$parent.columns.push(this.parentElement);
choiceProvinceOptions.push('Quebec');
$parent.columns.push(this.parentElement);
choiceProvinceOptions.push('Saskatchewan');
$parent.columns.push(this.parentElement);
choiceProvinceOptions.push('Yukon');
(details && ((details.admission === 'yes' || details.province === 'no' || details.choiceProvince))) && setVisibleIndex(7, this.parentElement);
keys.push('gcms');
gcmsOptions = [];
$component('global').calculatorOptions.gcmsOptions = gcmsOptions;
Have you ever been refused a Visa to Canada?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
rejectedOptions.push('yes');
$parent.columns.push(this.parentElement);
rejectedOptions.push('no');
(details && (details.rejected === 'yes')) && setVisibleIndex(8, this.parentElement);
keys.push('tuition');
tuitionOptions = [];
$component('global').calculatorOptions.tuitionOptions = tuitionOptions;
Have you ordered your GCMS Note (this is the note issued by IRCC to show the detailed reasons for study visa refusal)?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
gcmsOptions.push('yes');
$parent.columns.push(this.parentElement);
gcmsOptions.push('no');
(details && ($log.and(details.admission === 'yes', $log.or(details.rejected === 'no', details.gcms)))) && setVisibleIndex(9, this.parentElement);
keys.push('futureTuition');
futureTuitionOptions = [];
$component('global').calculatorOptions.futureTuitionOptions = futureTuitionOptions;
Have you paid your first year tuition?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
tuitionOptions.push('yes');
$parent.columns.push(this.parentElement);
tuitionOptions.push('no');
(details && (details.tuition === 'no')) && setVisibleIndex(10, this.parentElement);
Do you plan on paying your 1st year tuition before you submit your study visa application?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
futureTuitionOptions.push('yes');
$parent.columns.push(this.parentElement);
futureTuitionOptions.push('no');