/**!
 *
 * Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.
 * @private
 */

// Note: this file is written using commonjs instead of import/export to
// simplify consumption by those less familiar with the current state of
// JavaScript modularization

/* eslint camelcase: [0] */

require(`@ciscospark/plugin-authorization`);
require(`@ciscospark/plugin-phone`);
// explicitly load wdm, since we're relying on preDiscoveryServices and the
// url interceptor
require(`@ciscospark/internal-plugin-wdm`);
require(`@ciscospark/plugin-logger`);
require(`@ciscospark/plugin-people`);

const {merge} = require(`lodash`);
const {registerPlugin} = require(`@ciscospark/spark-core`);
const SparkCore = require(`@ciscospark/spark-core`).default;
const Memberships = require(`./plugins/memberships`).default;
const Messages = require(`./plugins/messages`).default;
const Rooms = require(`./plugins/rooms`).default;
const Teams = require(`./plugins/teams`).default;
const TeamMemberships = require(`./plugins/team-memberships`).default;
const Webhooks = require(`./plugins/webhooks`).default;
const config = require(`./config`);

registerPlugin(`memberships`, Memberships);
registerPlugin(`messages`, Messages);
registerPlugin(`rooms`, Rooms);
registerPlugin(`teams`, Teams);
registerPlugin(`teamMemberships`, TeamMemberships);
registerPlugin(`webhooks`, Webhooks);

// documentation.js puts hashes in relative urls, so need to specify full urls
// here
/**
 * See {@link https://ciscospark.github.io/spark-js-sdk/example/browsers|Browser Guide} and
 * {@link https://ciscospark.github.io/spark-js-sdk/example/servers|Server Guide}
 * @see {@link /example/browsers|Browser Guide}
 * @see {@link /example/servers|Server Guide}
 * @class CiscoSpark
 * @extends SparkCore
 */
const CiscoSpark = SparkCore.extend({
  ciscospark: true,
  version: PACKAGE_VERSION
});

CiscoSpark.version = PACKAGE_VERSION;

/**
 * Create a new ciscospark instance.
 *
 * Note: ciscospark.init() really only applies to node apps at this time. In web
 * browsers, you'll want to stick with manipulating the ciscospark instance you
 * get from `require('ciscospark')`.
 *
 * In addition to creating spark instances when you need more than one at a time
 * (for example, on an Express route handler), you can use `ciscospark.init()`
 * to create instances with an alternate config object. You'll typically do this
 * when you want to provide an alternate storage backend:
 * ```javascript
 * const spark = ciscospark.init({
 *   config: {
 *     storage: {
 *       boundedAdapter: youCustomAdapter
 *     }
 *   }
 * })
 * ```
 * Previous versions of the sdk suggested you should pass credentials here.
 * While that still possible, we no longer document it because you should rely
 * on the storage layer instead.
 * @param {Object} attrs
 * @param {Object} attrs.config (optional)
 * @memberof CiscoSpark
 * @returns {CiscoSpark}
 */
CiscoSpark.init = function init(attrs = {}) {
  attrs.config = merge({}, config, attrs.config);
  return new CiscoSpark(attrs);
};

module.exports = CiscoSpark;

@@ -1939,529 +1939,376 @@
 ance
-.
 %0A *%0A * 
-Note: ciscospark.init() really only applies to node apps at this time. In web%0A * browsers, you'll want to stick with manipulating the ciscospark instance you%0A * get from %60require('ciscospark')%60.%0A *%0A * In addition to creating spark instances when you need more than one at a time%0A * (for example, on an Express route handler), you can use %60c
+@example%0A * %3Ccaption%3ECreate a new CiscoSpark instance configured for your OAuth client%3C/caption%3E%0A * const ciscospark = CiscoSpark.init(%7B%0A *   config: %7B%0A *     credentials: %7B%0A *       authorizationString: %60%3CAUTHORIZATION URL FROM DEVELOPER PORTAL%3E%60%0A *     %7D%0A *   %7D%0A * %7D);%0A *%0A * @example%0A * %3Ccaption%3ECreate a new C
 isco
-s
+S
 park
-.init()%60%0A * to create instances with an alternate config object. You'll typically do this%0A * when you want to provide an alternate storage backend:%0A * %60%60%60javascript
+ instance configured for a Bot%3C/caption%3E
 %0A * 
@@ -2313,24 +2313,29 @@
 * const 
+cisco
 spark = 
 ciscospa
@@ -2326,22 +2326,22 @@
 spark = 
-c
+C
 isco
-s
+S
 park.ini
@@ -2370,69 +2370,56 @@
     
-storage: %7B%0A *       boundedAdapter: youCustomAdapter%0A *     %7D
+credentials: %60%3CBOT TOKEN FROM DEVELOPER PORTAL%3E%60
 %0A * 
@@ -2431,203 +2431,15 @@
 * %7D)
+;
 %0A *
- %60%60%60%0A * Previous versions of the sdk suggested you should pass credentials here.%0A * While that still possible, we no longer document it because you should rely%0A * on the storage layer instead.
+%0A *
 %0A * 

remove misleading docs for CiscoSpark.init()