This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"main": "dist/index.js", | |
"scripts": { | |
"transpile": "babel src/index.js", | |
"prebuild": "shx mkdir -p dist", | |
"build": "npm run transpile -- -o dist/index.js", | |
"start:dev": "babel-node src/index.js", | |
"watch": "nodemon -w src/* -x \"npm run build &> /dev/null && node .\"" | |
}, | |
"devDependencies": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { handleActions } from 'redux-actions' | |
import { combineReducers } from 'redux' | |
import { pluck, indexBy, prop, assocPath, without, of, dissoc } from 'ramda' | |
import actions from './actions' | |
const { wastage } = actions | |
const wastageTypesInitialState = { | |
isFetching: false, | |
didInvalidate: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import faker from 'faker' | |
import { compose, map, applySpec, always } from 'ramda' | |
// TODO: Write MockModel Class to code gen the generate methods | |
// Wastage | |
export const wastageModel = { | |
_id: faker.random.uuid, | |
StoreID: faker.random.alphaNumeric, | |
ProductID: faker.random.alphaNumeric, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { pluck } from 'ramda' | |
import { callApi } from '~features/network/operations' | |
import { orderOperations, orderSelectors } from '~features/order' | |
import actions from './actions' | |
import selectors from './selectors' | |
const wastageActions = actions.wastage | |
export const fetchWastageTypes = () => dispatch => { | |
dispatch(wastageActions.requestWastageTypes()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { pluck, indexBy, prop } from 'ramda' | |
import operations from '../operations' | |
import { | |
wastageTypes as wastageTypesReducer, | |
wastageProcessing as wastageProcessingReducer, | |
wastageEntities as wastageEntitiesReducer | |
} from '../reducers' | |
import { | |
generateWastage, | |
generateWastageTypeArray, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import configureMockStore from 'redux-mock-store' | |
import thunk from 'redux-thunk' | |
import fetchMock from 'fetch-mock' | |
import expect from 'expect' | |
import { indexBy, pluck, prop } from 'ramda' | |
import operations from '../operations' | |
import { generateWastageTypeArray, generateWastageArray } from '../__fixtures__' | |
const middleWares = [thunk] | |
const mockStore = configureMockStore(middleWares) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import configureMockStore from 'redux-mock-store' | |
import thunk from 'redux-thunk' | |
import fetchMock from 'fetch-mock' | |
import expect from 'expect' | |
import { indexBy, pluck, prop } from 'ramda' | |
import operations from '../operations' | |
import { generateWastageTypeArray, generateWastageArray } from '../__fixtures__' | |
const middleWares = [thunk] | |
const mockStore = configureMockStore(middleWares) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import faker from 'faker' | |
import { compose, map, applySpec, always } from 'ramda' | |
/** | |
* Usage: | |
* | |
* import { generateWastage, generateWastageArray } from './fixtures | |
* | |
* const wastageFixture = generateWastage() | |
* const wastageFixtures = generateWastageArray(3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { map, apply, zip, times } from 'ramda' | |
import { v4 } from 'uuid' | |
import Box from 'grommet/components/Box' | |
const propArray = [ | |
'Supplier Code', | |
'PackSize', | |
'In Stock', | |
'On Order', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ProgressPromise = { | |
/** | |
* Process a list of Promises asynchronously and report the progress after each Promise completes | |
* | |
* @param {Promise[]} promises. An array of promise to execute - are passed internally to Promise.all. | |
* @param {Function} reporter. | |
* A function that will be executed after each promise completes that receives the proportion of | |
* completed promises as a decimal | |
* @return {Promise} | |
*/ |