Update a customer's points total

Get the logged in customer's details and update their points in a DOM element.

<script type="text/javascript">
  document.addEventListener("rivo-js-loaded", function() {
    if (window.Rivo?.common?.customer) {
      RivoJS.getCustomerDetails().then(function(resp) {
        if (resp.pretty_points_tally) {
          document.querySelector(".rivo-points-total").innerHTML = resp.pretty_points_tally;
        }
      })
    }
  });
</script>