Configs
========

Configs are used to pass client-specific values to spaces-utils.

Example usage (in the client app):

```js
import SpacesUtils from "spaces-utils/main";

SpacesUtils.config({
    // [OPTIONAL] Required when using the "webservices" module. This will be the value of the "x-product-location" header
    // when making requests to the remote servers.
    productLocation: "in-app-search/development",

    // [OPTIONAL] Required when using the Highbeam feature in the "analytics" module. This will set the default category
    // when logging Highbeam events.
    highbeamCategory: "search"

    // [OPTIONAL] Required when using the "image" module and the shortcut parsing in the "shortcut" module.
    // These are the available local images
    localImages: require.context("app/assets/image/", true, /.(png|gif|svg|psdt)$/),

    // [OPTIONAL] Output spaces-utils debug messages. If not set, the value is read from the "debug" feature_flag,
    // which is false by default.
    verbose: true
});
```

Debug
==========

Clients can use the `DEBUG` constant from `spaces-utils/main` to control features/codes that should be disabled in release mode.
One example is the `debug` function from the `log` module. It uses the constant so that it can automatically disable the debug logs for a release build. Below is an example of how to use the `DEBUG` constant:

```js
import { DEBUG } from "spaces-utils/main";

if (DEBUG) {
    // This code block is only executed in debug mode.
    window._printMessages = function () {
        // ...
    }
}
```

There are two ways to control the value of the `DEBUG` constant. The first one is via WebPack's [DefinePlugin](https://webpack.js.org/plugins/define-plugin/) feature by creating a global constant called `Env.DEBUG`,
and set the value to false when creating a release build. For `Torq-WebPack`, you can use `.setEnv("DEBUG", true|false)`.

The second way is by appending a query string to the start_url in the `manifest.json` file. This will force running the debug code
even if `Env.DEBUG` is set to false, which is convenient for debugging a release build. To do so, append `?debug=true` to the start_url
in the `manifest.json` file as shown below:

```json
{
    "left" : 0,
    "top" : 0,
    "width" : 278,
    "start_url" : "./build/index.html?debug=true",
}
```

Manifest Query String
==========
Arbitrary key/value pairs can be added to the `start_url` in the manifest file and are made available on the Config object.  One exception: you must not use any of the property keys defined within `main.js6`.

This allows for simple "runtime feature flags".

```
// manifest.json
{
    "left" : 0,
    "top" : 0,
    "width" : 278,
    "start_url" : "./build/index.html?kittens=please",
}

// js
import SpacesUtils from "spaces-utils/main";

console.log("yes ", SpacesUtils.kittens);
```
