After more than seven weeks of heavy fighting, Israel and Hamas have agreed to an open-ended ceasefire.