'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var api = require('./api.js');
var subscription = require('./subscription.js');
var errors = require('./errors.js');

/**
 * Returns a `Money` value representing the minimum a buyer can expect to pay at the current
 * step of checkout. This value excludes amounts yet to be negotiated. For example,
 * the information step might not have delivery costs calculated.
 */
function useTotalAmount() {
  const api$1 = api.useApi();
  const extensionTarget = api$1.extension.target;
  if (!('cost' in api$1)) {
    throw new errors.ExtensionHasNoFieldError('cost', extensionTarget);
  }
  return subscription.useSubscription(api$1.cost.totalAmount);
}

exports.useTotalAmount = useTotalAmount;
