import { resumeSections } from 'https://esm.town/v/iamseeley/resumeSections';
import { oceanTheme } from 'https://esm.town/v/iamseeley/oceanTheme';
export async function resumeSetup(resumeConfig) {
const {
resumeJsonUrl,
resumeJson,
theme,
customStyleUrl,
sectionOrder,
customSections,
savePDFIsVisible
} = resumeConfig;
let resumeDetails = resumeJson;
try {
if (resumeJsonUrl) {
const response = await fetch(resumeJsonUrl);
if (!response.ok) {
throw new Error(`Failed to fetch resume details from URL: ${response.statusText}`);
}
resumeDetails = await response.json();
}
} catch (error) {
console.error(`Error fetching resume data: ${error.message}`);
}
const mergedSections = {
...resumeSections,
...customSections
};
const isOceanTheme = theme === oceanTheme;
return {
resumeDetails,
theme,
customStyleUrl,
sectionOrder,
sections: mergedSections,
savePDFIsVisible,
isOceanTheme
};
}