'use strict';

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

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

/**
 * Returns the currency of the checkout, and automatically re-renders
 * your component if the currency changes.
 */
function useCurrency() {
  const api$1 = api.useApi();
  const extensionTarget = api$1.extension.target;
  if (!('currency' in api$1.localization)) {
    throw new errors.ExtensionHasNoFieldError('currency', extensionTarget);
  }
  return subscription.useSubscription(api$1.localization.currency);
}

exports.useCurrency = useCurrency;
