reward-data-layer
Advanced tools
Comparing version 1.1.1 to 1.2.0
33
index.js
@@ -6,11 +6,24 @@ /** | ||
export withOrders from "./src/withOrders"; | ||
export withBrands from "./src/withBrands"; | ||
export withCredits from "./src/withCredits"; | ||
export withPaymentCards from "./src/withPaymentCards"; | ||
export withFavouriteBrands from "./src/withFavouriteBrands"; | ||
export withDeliveryAddresses from "./src/withDeliveryAddresses"; | ||
export withCurrentUser from "./src/withCurrentUser"; | ||
export withCurrentDevice from "./src/withCurrentDevice"; | ||
export withCurrentSubscription from "./src/withCurrentSubscription"; | ||
export withCurrentL2SCard from "./src/withCurrentL2SCard"; | ||
import withOrders from "./src/withOrders"; | ||
import withBrands from "./src/withBrands"; | ||
import withCredits from "./src/withCredits"; | ||
import withPaymentCards from "./src/withPaymentCards"; | ||
import withFavouriteBrands from "./src/withFavouriteBrands"; | ||
import withDeliveryAddresses from "./src/withDeliveryAddresses"; | ||
import withCurrentUser from "./src/withCurrentUser"; | ||
import withCurrentDevice from "./src/withCurrentDevice"; | ||
import withCurrentSubscription from "./src/withCurrentSubscription"; | ||
import withCurrentL2SCard from "./src/withCurrentL2SCard"; | ||
module.exports = { | ||
withOrders, | ||
withBrands, | ||
withCredits, | ||
withPaymentCards, | ||
withFavouriteBrands, | ||
withDeliveryAddresses, | ||
withCurrentUser, | ||
withCurrentDevice, | ||
withCurrentSubscription, | ||
withCurrentL2SCard | ||
}; |
{ | ||
"name": "reward-data-layer", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "The 'Reward Me Now' data layer is a frontend library which uses higher order reducers to consume data from the reward-network-layer.", | ||
@@ -20,4 +20,2 @@ "main": "index.js", | ||
"dependencies": { | ||
"dayjs": "^1.8.14", | ||
"fuse.js": "^3.4.4", | ||
"lodash": "^4.17.11" | ||
@@ -27,3 +25,4 @@ }, | ||
"@redu/reward-network-layer": "2.*" | ||
} | ||
}, | ||
"gitHead": "99bc4ef86a8fee1a782f04731a4990a14d8908ce" | ||
} |
@@ -1,38 +0,1 @@ | ||
<p align="center"> | ||
<img src="./icon.png" height="200"> | ||
<br /> | ||
</p> | ||
The "Reward Me Now" data layer is a frontend library which uses higher order reducers to consume data from the reward-network-layer. | ||
## Install | ||
Install with npm: | ||
``` | ||
npm install @redu/reward-data-layer --save | ||
``` | ||
## Usage | ||
The reducers consume actions from the reward-network-layer by default. This packages exposes multiple higher order reducers which you can use to automatically populate your store and run complex selectors on the data. | ||
```js | ||
import { withOrders } from "@redu/reward-data-layer"; | ||
/** Combines all our domain data reducers */ | ||
export default combineReducers({ | ||
orders: withOrders()((state, action) => state), | ||
}); | ||
``` | ||
You can use the exported reducer to wrap your own reducer and overwrite actions. As default | ||
the code above will populate the `orders` store key with: `{ data: [] }` and conume actions from the reward-network-layer to populate this data. | ||
## Dependencies | ||
- [lodash](https://lodash.com/docs/4.17.11) to perform advance data parsing. | ||
- [fuse.js](https://fusejs.io/) to perform advanced search in our selectors. | ||
- [dayjs](https://github.com/iamkun/dayjs) is used to parse dates in the selectors. | ||
# reward-data-layer |
@@ -210,8 +210,8 @@ /** | ||
* @param brands | ||
* @param orders - "asc" or "desc" | ||
* @param sort - "asc" or "desc" | ||
* | ||
* @return {*} | ||
*/ | ||
export const getBrandsSortedAtoZ = (brands, orders = "asc") => { | ||
return _orderBy(brands, [brand => brand.name.toLowerCase()], [orders]); | ||
export const getBrandsSortedAtoZ = (brands, sort = "asc") => { | ||
return _orderBy(brands, [brand => brand.name.toLowerCase()], [sort]); | ||
}; | ||
@@ -218,0 +218,0 @@ |
2
1168
61671
2
- Removeddayjs@^1.8.14
- Removedfuse.js@^3.4.4
- Removeddayjs@1.11.13(transitive)
- Removedfuse.js@3.6.1(transitive)