index.js

'use strict';
/**
 * @module braintree
 * @description This is the top-level module exported by the Braintree JavaScript SDK. In a browser environment, this will be the global <code>braintree</code> object. In a CommonJS environment, it will be the default export of the <code>braintree-web</code> package.
 * @example
 * <caption>CommonJS</caption>
 * var braintree = require('braintree-web');
 *
 * braintree.client.create(...);
 * @example
 * <caption>In the browser</caption>
 * <script href="https://js.braintreegateway.com/web/VERSION/js/client.min.js"></script>
 * <script>
 *   window.braintree.client.create(...);
 * </script>
 * @example
 * <caption>AMD</caption>
 * // main.js
 * require.config({
 *   paths: {
 *     braintreeClient: "https://js.braintreegateway.com/web/VERSION/js/client.min.js"
 *   }
 * });
 *
 * require(["braintreeClient"], function (braintreeClient) {
 *   braintreeClient.create(...);
 * });
 */

/**
 * @global
 * @callback errback
 * @param {?BraintreeError} err null if there was no error
 * @param {?any} data The successful result of the asynchronous function call
 * @description The Node.js-style callback pattern used throughout the SDK.
 */

/**
 * @global
 * @callback errorCallback
 * @param {?BraintreeError} err null if there was no error
 * @description Similar to {@link errback}, though no data is expected.
 */

var client = require('./client');
var paypal = require('./paypal');
var hostedFields = require('./hosted-fields');
var dataCollector = require('./data-collector');
var packageVersion = require('package.version');

module.exports = {
  /** @see module:braintree/client */
  client: client,
  /** @see module:braintree/paypal */
  paypal: paypal,
  /** @see module:braintree/hosted-fields */
  hostedFields: hostedFields,
  /** @see module:braintree/data-collector */
  dataCollector: dataCollector,
  /** @property {string} VERSION the current version of the SDK */
  VERSION: packageVersion
};