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-work', 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/work/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-work').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[`residency_status.overseas.job_offer.yes.refusal.no.spouse.any.children.any`] = 'overseas';
joinedScenarios[`residency_status.overseas.job_offer.yes.refusal.yes.gcms.no.spouse.any.children.any`] = 'overseas-gcms';
joinedScenarios[`residency_status.overseas.job_offer.yes.refusal.yes.gcms.yes.spouse.any.children.any`] = 'overseas-refused';
joinedScenarios[`residency_status.overseas.job_offer.no.category.trades.interest.any`] = 'overseas-trades';
joinedScenarios[`residency_status.overseas.job_offer.no.category.stem`] = 'overseas-workers';
joinedScenarios[`residency_status.resident.status.student.graduate.yes.student_status.yes`] = 'resident-graduate';
joinedScenarios[`residency_status.resident.status.student.graduate.yes.student_status.no`] = 'resident-graduate-status';
joinedScenarios[`residency_status.resident.status.student.graduate.no.student_status.yes`] = 'resident-undergrad';
joinedScenarios[`residency_status.resident.status.student.graduate.no.student_status.no`] = 'resident-undergrad-status';
joinedScenarios[`residency_status.resident.status.spousal.valid_status.yes`] = 'resident-spousal';
joinedScenarios[`residency_status.resident.status.spousal.valid_status.no`] = 'resident-spousal-status';
joinedScenarios[`residency_status.resident.status.lmia.valid_status.yes`] = 'resident-lmia';
joinedScenarios[`residency_status.resident.status.lmia.valid_status.no`] = 'resident-lmia-status';
joinedScenarios[`residency_status.resident.status.pgwp.valid_status.yes`] = 'resident-pgwp';
joinedScenarios[`residency_status.resident.status.pgwp.valid_status.no`] = 'resident-pgwp-status';
joinedScenarios[`residency_status.resident.status.caregiver.valid_status.yes`] = 'resident-caregiver';
joinedScenarios[`residency_status.resident.status.caregiver.valid_status.no`] = 'resident-caregiver-status';
joinedScenarios[`residency_status.resident.status.other.valid_status.yes`] = 'resident-others';
joinedScenarios[`residency_status.resident.status.other.valid_status.no`] = 'resident-others-status';
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-work', {
resolvedScenario: resolvedScenario,
userDetails: $native(userDetails),
details: $native(details),
}).then(() => proceedToRecommendation());
}
else{
$db('shirah').write('saved-calculator-info-work', 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('residency_status');
residency_statusOptions = [];
$component('global').calculatorOptions.residency_statusOptions = residency_statusOptions;
(details && (true)) && setVisibleIndex(0, this.parentElement);
keys.push('job_offer');
job_offerOptions = [];
$component('global').calculatorOptions.job_offerOptions = job_offerOptions;
What is your current residency status in Canada?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
residency_statusOptions.push('overseas');
$parent.columns.push(this.parentElement);
residency_statusOptions.push('resident');
(details && (details.residency_status === 'overseas')) && setVisibleIndex(1, this.parentElement);
keys.push('refusal');
refusalOptions = [];
$component('global').calculatorOptions.refusalOptions = refusalOptions;
Do you have a valid job offer accompanied by LMIA in Canada?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
job_offerOptions.push('yes');
$parent.columns.push(this.parentElement);
job_offerOptions.push('no');
(details && (details.job_offer === 'yes')) && setVisibleIndex(2, this.parentElement);
keys.push('gcms');
gcmsOptions = [];
$component('global').calculatorOptions.gcmsOptions = gcmsOptions;
Have you been refused a Work Visa before?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
refusalOptions.push('yes');
$parent.columns.push(this.parentElement);
refusalOptions.push('no');
(details && (details.refusal === 'yes')) && setVisibleIndex(3, this.parentElement);
keys.push('spouse');
spouseOptions = [];
$component('global').calculatorOptions.spouseOptions = spouseOptions;
Have you ordered your GCMS Note (this is a note issued by IRCC to show the detailed reasons for work 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.or(details.gcms, details.refusal === 'no'))) && setVisibleIndex(4, this.parentElement);
keys.push('children');
childrenOptions = [];
$component('global').calculatorOptions.childrenOptions = childrenOptions;
Are you being accompanied by your partner or spouse?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
spouseOptions.push('yes');
$parent.columns.push(this.parentElement);
spouseOptions.push('no');
(details && (details.spouse)) && setVisibleIndex(5, this.parentElement);
keys.push('category');
categoryOptions = [];
$component('global').calculatorOptions.categoryOptions = categoryOptions;
How many dependent children below 22 years of age are you adding to the application?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
childrenOptions.push('0');
$parent.columns.push(this.parentElement);
childrenOptions.push('1');
$parent.columns.push(this.parentElement);
childrenOptions.push('2');
$parent.columns.push(this.parentElement);
childrenOptions.push('3');
$parent.columns.push(this.parentElement);
childrenOptions.push('4');
(details && (details.job_offer === 'no')) && setVisibleIndex(6, this.parentElement);
keys.push('interest');
interestOptions = [];
$component('global').calculatorOptions.interestOptions = interestOptions;
What is your category?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
categoryOptions.push('stem');
$parent.columns.push(this.parentElement);
categoryOptions.push('trades');
(details && (details.category === 'trades')) && setVisibleIndex(7, this.parentElement);
keys.push('status');
statusOptions = [];
$component('global').calculatorOptions.statusOptions = statusOptions;
Would you be interested in our service: “Executive Job Search” for Skilled Trade Professionals? We have successfully assisted over 100 people since we launched in December 2023.
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
interestOptions.push('yes');
$parent.columns.push(this.parentElement);
interestOptions.push('no');
(details && (details.residency_status === 'resident')) && setVisibleIndex(8, this.parentElement);
keys.push('graduate');
graduateOptions = [];
$component('global').calculatorOptions.graduateOptions = graduateOptions;
What is your current status in Canada?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
statusOptions.push('student');
$parent.columns.push(this.parentElement);
statusOptions.push('spousal');
$parent.columns.push(this.parentElement);
statusOptions.push('lmia');
$parent.columns.push(this.parentElement);
statusOptions.push('pgwp');
$parent.columns.push(this.parentElement);
statusOptions.push('caregiver');
$parent.columns.push(this.parentElement);
statusOptions.push('other');
(details && (details.status === 'student')) && setVisibleIndex(9, this.parentElement);
keys.push('student_status');
student_statusOptions = [];
$component('global').calculatorOptions.student_statusOptions = student_statusOptions;
Have you graduated from University or College?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
graduateOptions.push('yes');
$parent.columns.push(this.parentElement);
graduateOptions.push('no');
(details && (details.graduate)) && setVisibleIndex(10, this.parentElement);
keys.push('valid_status');
valid_statusOptions = [];
$component('global').calculatorOptions.valid_statusOptions = valid_statusOptions;
Is your status as a student still valid?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
student_statusOptions.push('yes');
$parent.columns.push(this.parentElement);
student_statusOptions.push('no');
(details && ($log.and(details.status, details.status !== 'student'))) && setVisibleIndex(11, this.parentElement);
Is your status still valid?
$scope.deselectAll = (except) => {
$$scope(this.parentElement).columns.forEach(column => ((column !== except) && ($$scope(column).checked = false)));
};
$parent.columns.push(this.parentElement);
valid_statusOptions.push('yes');
$parent.columns.push(this.parentElement);
valid_statusOptions.push('no');