export const sortVariants = (a, b) => {
    const compareDefault = (a, b) => (a.language?.isDefault ? -1 : 1) - (b.language?.isDefault ? -1 : 1);
    // Make sure mandatory variants goes on top.
    const compareMandatory = (a, b) => (a.language?.isMandatory ? -1 : 1) - (b.language?.isMandatory ? -1 : 1);
    const compareName = (a, b) => a.variant?.name.localeCompare(b.variant?.name || '') || 99;
    return compareDefault(a, b) || compareMandatory(a, b) || compareName(a, b);
};
