Merge and sum array of objects with dynamic keys

I have a data structure of an array of objects with number of hours spent for a number of different roles like below:

    [{"week 01" : {"Developer" : 1}}, 
    {"week 01" : {"Project Manager" : 5}}, 
    {"week 01" : {"Project Manager" : 6}}, 
    {"week 01": {"Developer" : 8}},
    {"week 02" : {"Strategy" : 4}}]

The roles and weeks are dynamic (i.e. I don’t know the key/values beforehand) and I would like to sum all the hours for the same role and same week to get the below output:

[{"week 01" : {
   "Developer" : 9
   "Project Manager" : 11
    }
}, 
{"week 02" : {
    "Strategy" : 4
    }
}]

I have tried using the reduce function, but I can’t seem to get it right:

function reduceArray(arr) {
  const result = arr.reduce((result, item) => {
    let obj = {};
    const existing = result.find(function (x) { 
        for (var prop in x) {
           if (x[prop] === item[prop]) {
              //same week number found 
              //loop through roles 
              for (var subProp in x[prop]) {
                  if (x[prop][subProp] === item[prop][subProp]) {
                     obj[prop][subProp] += x[prop][subProp] + item[prop][subProp]
                     //This is where I lose myself in the prop-loops....

                  }
              }
           }
        }
    })
  }, [])
  return result; 
}

Answer

const data = [
  { "week 01": { Developer: 1 } },
  { "week 01": { "Project Manager": 5 } },
  { "week 01": { "Project Manager": 6 } },
  { "week 01": { Developer: 8 } },
  { "week 02": { Strategy: 4 } },
];

const result = data.reduce(
  (prev, item) => {
    for (const week in item) {
      if (prev[week]) {
        for (const act in item[week]) {
          if (prev[week][act]) {
            prev[week][act] += item[week][act];
          } else {
            prev[week][act] = item[week][act];
          }
        }
      } else {
        prev[week] = item[week];
      }
    }

    return prev;
  },
  {}
);

console.log(result);