# oms-widget

> A widget style front end for the OPTUM Messenger API

Latest version **1.6.1-rc7** (published 2018-04-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install oms-widget
pnpm add oms-widget
yarn add oms-widget
bun add oms-widget
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.1-rc7 |
| Published | 2018-04-12 |
| First published | 2018-04-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 18 |
| Unpacked size | 832.3 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Author | The Optum Messenger Team |
| Maintainers | sethmusulin |

## Links

- npm: https://www.npmjs.com/package/oms-widget
- Repository: git@github.optum.com:commplatform/OMS-Widget
- npm.io page: https://npm.io/package/oms-widget

## Dependencies (18)

- [qs](https://npm.io/package/qs.md) ^6.5.0
- [mobx](https://npm.io/package/mobx.md) ^3.2.2
- [axios](https://npm.io/package/axios.md) ^0.18.0
- [dotenv](https://npm.io/package/dotenv.md) ^4.0.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [moment](https://npm.io/package/moment.md) ^2.18.1
- [filesize](https://npm.io/package/filesize.md) ^3.5.10
- [linkifyjs](https://npm.io/package/linkifyjs.md) ^2.1.4
- [classnames](https://npm.io/package/classnames.md) ^2.2.5
- [file-saver](https://npm.io/package/file-saver.md) ^1.3.3
- [mobx-react](https://npm.io/package/mobx-react.md) ^4.2.2
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.1
- [font-awesome](https://npm.io/package/font-awesome.md) ^4.7.0
- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.26.0
- [react-dropzone](https://npm.io/package/react-dropzone.md) ^3.13.4
- [react-split-pane](https://npm.io/package/react-split-pane.md) ^0.1.65
- [less-plugin-lists](https://npm.io/package/less-plugin-lists.md) ^1.1.1
- [css-element-queries](https://npm.io/package/css-element-queries.md) ^0.4.0

## Recent versions

- 1.6.1-rc7 (latest) — 2018-04-12
- 1.6.1-rc6 — 2018-04-12
- 1.6.1-rc5 — 2018-04-11
- 1.6.1-rc4 — 2018-04-11
- 1.6.1-rc3 — 2018-04-11
- 1.6.1-rc2 — 2018-04-11
- 1.6.1-rc1 — 2018-04-11
- 1.6.0 — 2018-04-11

## README

Optum Messenger Standalone Client and Widget
============================================

A javascript app to connect to the secure messenging API directly, and designed 
to be included directly in other webpages.

## Dev Setup
This project uses yarn instead of npm. If you don't have yarn, `brew install yarn`.

Install the dependencies:
```sh
yarn install
```

Setup your env:
```sh
cp example.env .env
$EDITOR .env        # edit as needed
```
And configure client-facing settings for you environment:
```sh
cp public/setup.example.js public/setup.js
$EDITOR public/setup.js        # edit as needed
```

(Optionally) run the tests: 
```sh
yarn run test
```

Start the webpack dev server:
```sh
yarn run start
```

## Publishing and Deploying

Code is served from an AWS S3 bucket through a Cloudfront site. Manually publishing is the following steps:

### Checkout the Master Branch, pull to make sure you are up to date and Fast Forward Merge the Develop Branch

```sh
git checkout origin master
```

```sh
git pull origin master
```

```sh
git fetch origin
```

```sh
git merge origin develop
```

### Run the build and publish combined script
If you trust a computer to not make mistakes, you can publish to aws just by running
```sh
yarn run build_and_publish
```
and **then committing and pushing your changes** (this isn't automatic).

the script automatically does the following steps:

####  1. Update and tag the version: 
Please make sure to check the version numbers on S3 so we dont get out of step:
(make sure aws cli is 
[installed](https://github.com/aws/aws-cli/issues/727) 
and [configured](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)
)
```sh
yarn run aws:list_versions
```

(makes a commit with the new version, as well as tagging that commit with a `v.x.x.x` tag)
```sh
yarn version  # runs an interactive prompt to set the version number
```

#### 2. Clean previous artifacts: 

(especially important for the docs, which don't always clean up after themselves)
```sh
yarn run build:clean
```

**Note:** don't run `yarn clean`! It will cause the build to fail, as older versions 
of yarn (pre v1.0) [mess with the installed packages](https://github.com/yarnpkg/yarn/issues/3517)
when that command is run. If the build is failing for compile reasons try:
- `rm .yarnclean`
- `yarn install --force`

#### 3. Run the webpack build: 

(produces the output-prod.js and styles.css files from the source)
```sh
yarn run build:prod
```

#### 4. Generate the docs:

```sh
yarn run docs:gen
```

**Doc URL on Amazon**

Because of Amazon S3 limitations, the docs are located at:
https://dufpv36ciwr6n.cloudfront.net/doc/latest/index.html instead of the 
usual place for the CSS and js files (https://messenger-widget.optum.com/)

#### 5. Create versioned file copies:

creates copies of the built files with the version names added to them, in the `build` directory

```sh
yarn run build:prod:versions
```

#### 6. Upload to S3:

uploads every thing in `build/js` and `build/css` to S3

requires aws cli to be 
[installed](https://github.com/aws/aws-cli/issues/727) 
and [configured](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)

```sh
yarn run aws:publish -- --bucket=my-bucket # aws-website-messenger-widget-0sips by default
```

### Push the tag and commit to git:
**Finally**, please make sure to push the master branch with tags.  Tags will not be pushed without the `--tags` flag. 

```sh
git push origin master --tags
```

## Conventions and Structure

The stack is React with Mobx for state management. CSS is packaged with css modules, 
so that when used as a widget, there is no conflict with the global namespace. 
As a general design goal, if you can isolate anything so global won't interfere with it, do so.


[Mobx](https://mobx.js.org) allows registering observers on javascript objects, so that observer components 
(and anything else that needs to be reactive to state changes) can update when things change. Sometimes, though, 
this requires that a component dereference a value from a parent, instead of just using the value, 
in order to observe the changes. Be aware of that, and read the mobx [docs](https://mobx.js.org/best/react.html), 
if you can't get a component to update.

If you need to make an ajax request, use the configured instance of [axios](https://github.com/mzabriskie/axios) 
in `src/axios_config`. By convention this is imported as `axios`:
```js 
import axios from '~/axios_config'
```

If you come across any other gotchas or oddities, please add them to this section


## Pre-commit hooks

after you run yarn, pre-commit hooks are automatically setup using [`husky`](https://github.com/typicode/husky).

### Code Reformatting

[`prettier-standard`](https://github.com/sheerun/prettier-standard) is used to reformat all code before being committed, 
so that style complaints aren't an issue. [`lint-stage`](https://github.com/okonet/lint-staged) is ran before commit, 
and reformats all the code to standard style. Any changes are automatically added to the commit.

**Caveat:** if you have partially staged a file, the entire file will be staged after the code is reformatted.
to get around this, stash your un-staged changes with `git stash -k` before you commit, or commit using the 
`--no-verify` or `-n` option when committing in order to skip the hooks, and then run `yarn run reformat` 
and commit any relevant changes that were reformatted.

---
_Source: https://npm.io/package/oms-widget · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
