vineanova-redux-artifacts 1.119.310 → 1.119.312

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vineanova-redux-artifacts",
3
- "version": "1.119.310",
3
+ "version": "1.119.312",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -593,6 +593,15 @@ const ducksActions = createActions({
593
593
  UPDATEPARTIALENTITY:[(payload) => payload, ()=> ({ reducerName: 'identityConsumable' })],
594
594
  },
595
595
  },
596
+ identityConsumableTransactions: {
597
+ get: {
598
+ REQUEST: [(payload) => payload, ()=> ({ reducerName: 'identityConsumableTransactions' })],
599
+ RECEIVE: [(payload) => payload, ()=> ({ reducerName: 'identityConsumableTransactions' })],
600
+ ERROR: [(payload) => payload, ()=> ({ reducerName: 'identityConsumableTransactions' })],
601
+ CLEARDATA: [(payload) => payload, ()=> ({ reducerName: 'identityConsumableTransactions' })],
602
+ UPDATEPARTIALENTITY:[(payload) => payload, ()=> ({ reducerName: 'identityConsumableTransactions' })],
603
+ },
604
+ },
596
605
  identityContactMethod: {
597
606
  get: {
598
607
  REQUEST: [(payload) => payload, ()=> ({ reducerName: 'identityContactMethod' })],
@@ -35,6 +35,7 @@ export * from "./useFetchidentityAccommodation";
35
35
  export * from "./useFetchidentityActivity";
36
36
  export * from "./useFetchidentityClassification";
37
37
  export * from "./useFetchidentityConsumable";
38
+ export * from "./useFetchidentityConsumableTransactions";
38
39
  export * from "./useFetchidentityContactMethod";
39
40
  export * from "./useFetchcontactMethod";
40
41
  export * from "./useFetchidentityContactMethodAddress";
@@ -0,0 +1,38 @@
1
+ import { useEffect } from 'react';
2
+ import { useSelector, useDispatch } from 'react-redux';
3
+ import { VineaNovaActions } from '../actions';
4
+ import * as VineaNovaSelectors from '../selectors';
5
+
6
+ export const useFetchIdentityConsumableTransactions = (props) => {
7
+ // selectors
8
+ const data = useSelector(
9
+ VineaNovaSelectors.getIdentityConsumableTransactionsEntityData,
10
+ );
11
+ const dispatchAPI = useDispatch();
12
+ const { queryParams = {} } = props;
13
+
14
+ useEffect(() => {
15
+ dispatchAPI(
16
+ VineaNovaActions.api.v1.identityConsumableTransactions.get.request({
17
+ queryParams: {
18
+ ...queryParams,
19
+ },
20
+ }),
21
+ );
22
+ }, []);
23
+
24
+ const useQuery = (queryParams) => {
25
+ dispatchAPI(
26
+ VineaNovaActions.api.v1.identityConsumableTransactions.get.request({
27
+ queryParams: {
28
+ ...queryParams,
29
+ },
30
+ }),
31
+ );
32
+ };
33
+
34
+ return {
35
+ data,
36
+ useQuery,
37
+ };
38
+ };
@@ -39,6 +39,7 @@ const rootReducer = {
39
39
  identityActivity: createNamedReducer('identityActivity'),
40
40
  identityClassification: createNamedReducer('identityClassification'),
41
41
  identityConsumable: createNamedReducer('identityConsumable'),
42
+ identityConsumableTransactions: createNamedReducer('identityConsumableTransactions'),
42
43
  identityContactMethod: createNamedReducer('identityContactMethod'),
43
44
  contactMethod: createNamedReducer('contactMethod'),
44
45
  identityContactMethodAddress: createNamedReducer('identityContactMethodAddress'),
@@ -2283,6 +2283,37 @@ import { VineaNovaActions } from '../actions'
2283
2283
  }
2284
2284
 
2285
2285
 
2286
+ export function* getIdentityConsumableTransactionsSagas(action) {
2287
+ const {
2288
+ payload = {},
2289
+ meta: { reducerName },
2290
+ } = action;
2291
+ try {
2292
+ yield put({
2293
+ type: "FETCHING",
2294
+ name: reducerName,
2295
+ });
2296
+
2297
+ const response = yield call(APIServices.getIdentityConsumableTransactions, payload);
2298
+ yield put({
2299
+ type: "SUCCESS",
2300
+ payload: response,
2301
+ name: reducerName,
2302
+ });
2303
+
2304
+
2305
+ } catch (err) {
2306
+ console.error(err);
2307
+ /* istanbul ignore next */
2308
+ yield put({
2309
+ type: "ERROR",
2310
+ payload: err,
2311
+ name: reducerName,
2312
+ });
2313
+ }
2314
+ }
2315
+
2316
+
2286
2317
  export function* getIdentityContactMethodSagas(action) {
2287
2318
  const {
2288
2319
  payload = {},
@@ -13876,6 +13907,7 @@ export default function* root() {
13876
13907
  takeLatest(VineaNovaActions.api.v1.identityConsumable.put.request().type, putIdentityConsumableSagas),
13877
13908
  takeLatest(VineaNovaActions.api.v1.identityConsumable.get.request().type, getIdentityConsumableSagas),
13878
13909
  takeLatest(VineaNovaActions.api.v1.identityConsumable.delete.request().type, deleteIdentityConsumableSagas),
13910
+ takeLatest(VineaNovaActions.api.v1.identityConsumableTransactions.get.request().type, getIdentityConsumableTransactionsSagas),
13879
13911
  takeLatest(VineaNovaActions.api.v1.identityContactMethod.get.request().type, getIdentityContactMethodSagas),
13880
13912
  takeLatest(VineaNovaActions.api.v1.contactMethod.post.request().type, postContactMethodSagas),
13881
13913
  takeLatest(VineaNovaActions.api.v1.contactMethod.put.request().type, putContactMethodSagas),
@@ -0,0 +1,62 @@
1
+ import { createSelector } from 'reselect';
2
+ import isEmpty from 'lodash/isEmpty';
3
+ import {isValid, format} from 'date-fns';
4
+ import isNil from 'lodash/isNil';
5
+ import has from 'lodash/has';
6
+
7
+ const viewDateFormat = 'dd/MM/yyyy';
8
+
9
+ export const getIdentityConsumableTransactionsEntity = state => state.entities.identityConsumableTransactions;
10
+
11
+ export const getIdentityConsumableTransactionsEntityMeta = createSelector(
12
+ [getIdentityConsumableTransactionsEntity],
13
+ reference => {
14
+ const { isLoading, isLoaded, hasError, error } = reference;
15
+ return {
16
+ isLoading,
17
+ isLoaded,
18
+ hasError,
19
+ error,
20
+ };
21
+ },
22
+ );
23
+
24
+ export const getIdentityConsumableTransactionsEntityData = createSelector(
25
+ [getIdentityConsumableTransactionsEntity],
26
+ reference => {
27
+ const { data = [] } = reference;
28
+ const refData = isEmpty(data) ? [] : data;
29
+ if (!Array.isArray(refData) || isNil(refData)) return [];
30
+
31
+ const formattedData = refData.map(d => {
32
+ let hasDates = false;
33
+ let fromDate = '';
34
+ let toDate = '';
35
+ let fromTo = '';
36
+ if(has(d, 'effectiveToDate') && has(d, 'effectiveFromDate')){
37
+ hasDates = true;
38
+ toDate =
39
+ !isEmpty(d.effectiveToDate) && isValid(new Date(d.effectiveToDate))
40
+ ? format(new Date(d.effectiveToDate), viewDateFormat)
41
+ : '';
42
+ fromDate =
43
+ !isEmpty(d.effectiveFromDate) &&
44
+ isValid(new Date(d.effectiveFromDate))
45
+ ? format(new Date(d.effectiveFromDate), viewDateFormat)
46
+ : '';
47
+ }
48
+
49
+ return {
50
+ ...d,
51
+ ...(hasDates && {
52
+ fromDate,
53
+ toDate,
54
+ fromTo,
55
+ })
56
+ };
57
+ });
58
+
59
+ return formattedData;
60
+ },
61
+ );
62
+
@@ -35,6 +35,7 @@ export * from "./identityAccommodationSelector";
35
35
  export * from "./identityActivitySelector";
36
36
  export * from "./identityClassificationSelector";
37
37
  export * from "./identityConsumableSelector";
38
+ export * from "./identityConsumableTransactionsSelector";
38
39
  export * from "./identityContactMethodSelector";
39
40
  export * from "./contactMethodSelector";
40
41
  export * from "./identityContactMethodAddressSelector";
@@ -1709,6 +1709,29 @@ import serviceConfig from "./config/serviceConfig";
1709
1709
  };
1710
1710
 
1711
1711
 
1712
+ export const getIdentityConsumableTransactions = async (payload) => {
1713
+ try {
1714
+ const { queryParams, postBody, options } = payload || {};
1715
+ let apiUrl = '/IdentityConsumableTransactions';
1716
+ const response = await serviceConfig.request({
1717
+ url: apiUrl,
1718
+ method: "get",
1719
+ params: {
1720
+ ...queryParams,
1721
+ },
1722
+ headers: {
1723
+ "Content-Type": "application/json",
1724
+ Accept: "application/json",
1725
+ },
1726
+ ...options,
1727
+ });
1728
+ return response;
1729
+ } catch (err) {
1730
+ throw err;
1731
+ }
1732
+ };
1733
+
1734
+
1712
1735
  export const getIdentityContactMethod = async (payload) => {
1713
1736
  try {
1714
1737
  const { queryParams, postBody, options } = payload || {};