## How is this app used? 

This app is currently served in MediaWiki and on feeds and posts. 

### MediaWiki

On MediaWiki the app is served via the `TriviaQuizzes` extension which replaces the Recent Wiki Activity
module in the right rail. All parts of the application are built in the content-types repo. 
See the [README](https://github.com/Wikia/app/blob/dev/extensions/wikia/TriviaQuizzes/README.md)
for more information.

## FEPO

On feeds and posts the application is bundled as a seperate chunk that is lazy loaded. The entry points are 
built in FEPO itself rather than this repo. See [PostDetailsContainer](https://github.com/Wikia/fepo/blob/master/app/client/containers/PostDetails/index.js#L73)
for more information. 

## Quick start

```bash
    yarn            // install deps
    yarn start      // start developing
    yarn build      // create dist files
    yarn publish    // create dist files and publish to artifactory
```

### Usage

Clients need to pass the `options` object either to the component or function initializing the library.

```javascript
const options = {
    environment: 'fepo', // or `media-wiki`
    pageType: 'Feed', // one of: `Feed`, `Post Details`, `Article`
    community: {
        id: 1001, // initial quiz is loaded from this site id
        dbName: 'foo',
    },
    user: {
        id: 1234,
        isGDPRApproved: true, // any other value than true will assume `false`
    },
    theme: {
        primaryColor: 'rgb(172, 50, 50)',
        backgroundColor: 'rgb(50, 1, 10)',
    },
};
```

All but `community` and `pageType` options are optional.

#### Integration with React apps

```javascript
import Consumption from 'content-types-consumption/dist/consumption.cjs';

const options = {
    /* see `options` above */
};

<Consumption open options={options} />

```

#### Non-React App

```javascript
import consumption from 'content-types-consumption/dist/consumption.umd';

const options = {
    /* see `options` above */
};

consumption('#where_to_put_the_rail_module', options);
```
