@zeniai/client-epic-state 4.8.1 → 4.8.3
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/lib/entity/vendor/vendorPayload.js +2 -2
- package/lib/entity/vendor/vendorReducer.js +3 -4
- package/lib/entity/vendor/vendorState.d.ts +4 -1
- package/lib/entity/vendorExpense/vendorExpenseState.d.ts +5 -1
- package/lib/view/accountList/accountListReducer.d.ts +2 -1
- package/lib/view/accountList/accountListReducer.js +2 -1
- package/lib/view/accountList/fetchAccountListEpic.js +6 -3
- package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +6 -0
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.js +4 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchSchedulesAccountEpic.js +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListHelper.d.ts +6 -0
- package/lib/view/scheduleView/scheduleListView/scheduleListHelper.js +18 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListSelector.d.ts +1 -0
- package/lib/view/scheduleView/scheduleListView/scheduleListSelector.js +1 -1
- package/lib/view/transactionDetail/transactionDetailState.d.ts +1 -0
- package/lib/view/transactionDetail/transactionDetailState.js +12 -1
- package/package.json +1 -1
|
@@ -27,12 +27,12 @@ const toVendorBasePayload = (tranVendor, vendorUpdates) => {
|
|
|
27
27
|
};
|
|
28
28
|
exports.toVendorBasePayload = toVendorBasePayload;
|
|
29
29
|
const mapVendorPayloadToVendor = (payload) => {
|
|
30
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
31
31
|
return Object.assign(Object.assign({}, (0, exports.mapVendorBasePayloadToVendorBase)(payload)), { qboId: payload.qbo_id, title: (_a = payload.title) !== null && _a !== void 0 ? _a : '', suffix: (_b = payload.suffix) !== null && _b !== void 0 ? _b : '', firstName: (_c = payload.first_name) !== null && _c !== void 0 ? _c : '', middleName: (_d = payload.middle_name) !== null && _d !== void 0 ? _d : '', lastName: (_e = payload.last_name) !== null && _e !== void 0 ? _e : '', vendorType: (_f = payload.vendor_type) !== null && _f !== void 0 ? _f : '', isDeleted: (_g = payload.is_deleted) !== null && _g !== void 0 ? _g : false, createTime: payload.create_time != null ? (0, zeniDayJS_1.date)(payload.create_time) : (0, zeniDayJS_1.dateNow)(), updateTime: payload.update_time != null ? (0, zeniDayJS_1.date)(payload.update_time) : (0, zeniDayJS_1.dateNow)(), syncToken: (_h = payload.sync_token) !== null && _h !== void 0 ? _h : '', email: (_j = payload.email) !== null && _j !== void 0 ? _j : '', phone: (_k = payload.phone) !== null && _k !== void 0 ? _k : '', websiteUrl: (_l = payload.website_url) !== null && _l !== void 0 ? _l : '', currencyCode: payload.currency_code, currencySymbol: payload.currency_symbol, vendorCurrencyCode: (_m = payload.vendor_currency_code) !== null && _m !== void 0 ? _m : payload.currency_code, vendorCurrencySymbol: (_o = payload.vendor_currency_symbol) !== null && _o !== void 0 ? _o : payload.currency_symbol, countryCode: (_p = payload.country_code) !== null && _p !== void 0 ? _p : undefined, accountId: (_r = (_q = payload.account) === null || _q === void 0 ? void 0 : _q.account_id) !== null && _r !== void 0 ? _r : undefined, classId: (_t = (_s = payload.accounting_class) === null || _s === void 0 ? void 0 : _s.accounting_class_id) !== null && _t !== void 0 ? _t : undefined, contactIds: (_v = (_u = payload.contacts) === null || _u === void 0 ? void 0 : _u.map((contact) => contact.contact_id)) !== null && _v !== void 0 ? _v : [], billingAddressId: payload.billing_address != null
|
|
32
32
|
? payload.billing_address.address_id
|
|
33
33
|
: undefined, addressId: payload.address != null ? payload.address.address_id : undefined, shippingAddressId: payload.shipping_address != null
|
|
34
34
|
? payload.shipping_address.address_id
|
|
35
|
-
: undefined, bankAccountIds: (_x = (_w = payload.bank_accounts) === null || _w === void 0 ? void 0 : _w.map((bankAcc) => bankAcc.bank_account_id)) !== null && _x !== void 0 ? _x : [], paymentInstrumentIds: (_z = (_y = payload.payment_instruments) === null || _y === void 0 ? void 0 : _y.map((piAcc) => piAcc.zeni_payment_instrument_id)) !== null && _z !== void 0 ? _z : [], ownerId: (_1 = (_0 = payload.owner) === null || _0 === void 0 ? void 0 : _0.user_id) !== null && _1 !== void 0 ? _1 : undefined, balance: (_2 = payload.balance) !== null && _2 !== void 0 ? _2 : 0, matchScore: ((_3 = payload.match_score) === null || _3 === void 0 ? void 0 : _3.value) != null ? payload.match_score.value : 0, isVendor1099: (_4 = payload.is_vendor_1099) !== null && _4 !== void 0 ? _4 : false, documentIds: (_5 = payload.document_ids) !== null && _5 !== void 0 ? _5 : [], last30DaysSpend:
|
|
35
|
+
: undefined, bankAccountIds: (_x = (_w = payload.bank_accounts) === null || _w === void 0 ? void 0 : _w.map((bankAcc) => bankAcc.bank_account_id)) !== null && _x !== void 0 ? _x : [], paymentInstrumentIds: (_z = (_y = payload.payment_instruments) === null || _y === void 0 ? void 0 : _y.map((piAcc) => piAcc.zeni_payment_instrument_id)) !== null && _z !== void 0 ? _z : [], ownerId: (_1 = (_0 = payload.owner) === null || _0 === void 0 ? void 0 : _0.user_id) !== null && _1 !== void 0 ? _1 : undefined, balance: (_2 = payload.balance) !== null && _2 !== void 0 ? _2 : 0, matchScore: ((_3 = payload.match_score) === null || _3 === void 0 ? void 0 : _3.value) != null ? payload.match_score.value : 0, isVendor1099: (_4 = payload.is_vendor_1099) !== null && _4 !== void 0 ? _4 : false, documentIds: (_5 = payload.document_ids) !== null && _5 !== void 0 ? _5 : [], last30DaysSpend: payload.last_30_days_spend, last90DaysSpend: payload.last_90_days_spend, yearToDateSpend: payload.year_to_date_spend, recommendations: payload.recommendation != null && payload.recommendation.length > 0
|
|
36
36
|
? (0, transactionPayload_1.transformRecommendation)(payload.recommendation[0]) // In this case, there will be only one recommendation item since this is entity recommendation payload.
|
|
37
37
|
: [], preferredInternationalTransferFeeBearerPaymentMethod: payload.preferred_international_transfer_fee_bearer_payment_method != null
|
|
38
38
|
? (0, billTransactionState_1.toInternationalTransferFeeBearerPaymentMethod)(payload.preferred_international_transfer_fee_bearer_payment_method)
|
|
@@ -25,15 +25,14 @@ const vendor = (0, toolkit_1.createSlice)({
|
|
|
25
25
|
},
|
|
26
26
|
updateVendorSpendTrend: {
|
|
27
27
|
reducer(draft, action) {
|
|
28
|
-
var _a, _b, _c;
|
|
29
28
|
const { vendorId, spend } = action.payload;
|
|
30
29
|
if (draft.vendorByID[vendorId] != null) {
|
|
31
30
|
draft.vendorByID[vendorId].last30DaysSpend =
|
|
32
|
-
|
|
31
|
+
spend === null || spend === void 0 ? void 0 : spend.last_30_days_spend;
|
|
33
32
|
draft.vendorByID[vendorId].last90DaysSpend =
|
|
34
|
-
|
|
33
|
+
spend === null || spend === void 0 ? void 0 : spend.last_90_days_spend;
|
|
35
34
|
draft.vendorByID[vendorId].yearToDateSpend =
|
|
36
|
-
|
|
35
|
+
spend === null || spend === void 0 ? void 0 : spend.year_to_date_spend;
|
|
37
36
|
}
|
|
38
37
|
},
|
|
39
38
|
prepare(vendorId, spend) {
|
|
@@ -14,7 +14,7 @@ export interface SpendBase {
|
|
|
14
14
|
last90DaysSpend: number;
|
|
15
15
|
yearToDateSpend: number;
|
|
16
16
|
}
|
|
17
|
-
export interface Vendor extends VendorBase
|
|
17
|
+
export interface Vendor extends VendorBase {
|
|
18
18
|
title: string;
|
|
19
19
|
suffix: string;
|
|
20
20
|
firstName: string;
|
|
@@ -49,6 +49,9 @@ export interface Vendor extends VendorBase, SpendBase {
|
|
|
49
49
|
documentIds: ID[];
|
|
50
50
|
recommendations: Recommendation[];
|
|
51
51
|
preferredInternationalTransferFeeBearerPaymentMethod?: InternationalTransferFeeBearerPaymentMethod;
|
|
52
|
+
last30DaysSpend?: number;
|
|
53
|
+
last90DaysSpend?: number;
|
|
54
|
+
yearToDateSpend?: number;
|
|
52
55
|
}
|
|
53
56
|
export interface VendorState {
|
|
54
57
|
vendorByID: Record<ID, Vendor>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { ID } from '../../commonStateTypes/common';
|
|
2
2
|
import { TimePeriod } from '../../commonStateTypes/timePeriod';
|
|
3
3
|
import { TrendChangeType } from '../insights/insightPayload';
|
|
4
|
-
import { SpendBase } from '../vendor/vendorState';
|
|
5
4
|
import { VendorExpenseTrendData } from './vendorExpenseTrend';
|
|
6
5
|
export declare const getVendorExpenseTrendKey: (vendorID: ID, timePeriod: TimePeriod) => string;
|
|
7
6
|
export declare type VendorExpenseTrendKey = ReturnType<typeof getVendorExpenseTrendKey>;
|
|
7
|
+
export interface SpendBase {
|
|
8
|
+
last30DaysSpend: number;
|
|
9
|
+
last90DaysSpend: number;
|
|
10
|
+
yearToDateSpend: number;
|
|
11
|
+
}
|
|
8
12
|
export interface VendorSpend extends SpendBase {
|
|
9
13
|
currencyCode: string;
|
|
10
14
|
currencySymbol: string;
|
|
@@ -3,12 +3,13 @@ import { AccountListResponse } from './accountListPayload';
|
|
|
3
3
|
import { AccountList, AccountListKeyType, AccountListState } from './accountListState';
|
|
4
4
|
export declare const initialAccountList: AccountList;
|
|
5
5
|
export declare const initialState: AccountListState;
|
|
6
|
-
export declare const fetchAccountList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountListKey: AccountListKeyType, fetchFullResponse?: any, excludeAccountPayableAccounts?: any, excludeAccountReceivableAccounts?: any, isLimitedCategoryEnabled?: any], {
|
|
6
|
+
export declare const fetchAccountList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountListKey: AccountListKeyType, fetchFullResponse?: any, excludeAccountPayableAccounts?: any, excludeAccountReceivableAccounts?: any, isLimitedCategoryEnabled?: any, filterAccountTypes?: ("cash_position" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "fixed_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets")[] | undefined], {
|
|
7
7
|
accountListKey: AccountListKeyType;
|
|
8
8
|
fetchFullResponse: any;
|
|
9
9
|
excludeAccountPayableAccounts: any;
|
|
10
10
|
excludeAccountReceivableAccounts: any;
|
|
11
11
|
isLimitedCategoryEnabled: any;
|
|
12
|
+
filterAccountTypes: ("cash_position" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "fixed_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets")[];
|
|
12
13
|
}, string, never, never>, updateAccountList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
13
14
|
accountListKey: AccountListKeyType;
|
|
14
15
|
accountListResponse: AccountListResponse;
|
|
@@ -43,7 +43,7 @@ const accountList = (0, toolkit_1.createSlice)({
|
|
|
43
43
|
const existingData = draft.byReportId[action.payload.accountListKey];
|
|
44
44
|
draft.byReportId[action.payload.accountListKey] = Object.assign(Object.assign({}, existingData), { fetchState: 'In-Progress', error: undefined });
|
|
45
45
|
},
|
|
46
|
-
prepare(accountListKey, fetchFullResponse = false, excludeAccountPayableAccounts = false, excludeAccountReceivableAccounts = false, isLimitedCategoryEnabled = false) {
|
|
46
|
+
prepare(accountListKey, fetchFullResponse = false, excludeAccountPayableAccounts = false, excludeAccountReceivableAccounts = false, isLimitedCategoryEnabled = false, filterAccountTypes) {
|
|
47
47
|
return {
|
|
48
48
|
payload: {
|
|
49
49
|
accountListKey,
|
|
@@ -51,6 +51,7 @@ const accountList = (0, toolkit_1.createSlice)({
|
|
|
51
51
|
excludeAccountPayableAccounts,
|
|
52
52
|
excludeAccountReceivableAccounts,
|
|
53
53
|
isLimitedCategoryEnabled,
|
|
54
|
+
filterAccountTypes: filterAccountTypes !== null && filterAccountTypes !== void 0 ? filterAccountTypes : [],
|
|
54
55
|
},
|
|
55
56
|
};
|
|
56
57
|
},
|
|
@@ -6,15 +6,18 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const responsePayload_1 = require("../../responsePayload");
|
|
7
7
|
const accountReducer_1 = require("../../entity/account/accountReducer");
|
|
8
8
|
const accountListReducer_1 = require("./accountListReducer");
|
|
9
|
-
const getAccountTypes = (isLimitedCategoryEnabled) => {
|
|
9
|
+
const getAccountTypes = (isLimitedCategoryEnabled, filterAccountTypes) => {
|
|
10
|
+
if (filterAccountTypes.length > 0) {
|
|
11
|
+
return filterAccountTypes;
|
|
12
|
+
}
|
|
10
13
|
if (isLimitedCategoryEnabled === true) {
|
|
11
14
|
return ['cogs', 'expenses', 'other_expense'];
|
|
12
15
|
}
|
|
13
16
|
return [];
|
|
14
17
|
};
|
|
15
18
|
const fetchAccountListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(accountListReducer_1.fetchAccountList.match), (0, operators_1.switchMap)((action) => {
|
|
16
|
-
const { accountListKey, fetchFullResponse, excludeAccountPayableAccounts, excludeAccountReceivableAccounts, isLimitedCategoryEnabled, } = action.payload;
|
|
17
|
-
const accountTypes = getAccountTypes(isLimitedCategoryEnabled);
|
|
19
|
+
const { accountListKey, fetchFullResponse, excludeAccountPayableAccounts, excludeAccountReceivableAccounts, isLimitedCategoryEnabled, filterAccountTypes, } = action.payload;
|
|
20
|
+
const accountTypes = getAccountTypes(isLimitedCategoryEnabled, filterAccountTypes);
|
|
18
21
|
const queryValue = {
|
|
19
22
|
is_full: fetchFullResponse,
|
|
20
23
|
is_exclude_account_payable_accounts: excludeAccountPayableAccounts,
|
|
@@ -13,6 +13,12 @@ const fetchScheduleDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0
|
|
|
13
13
|
const { tab, selectedJeScheduleDetailId } = action.payload;
|
|
14
14
|
const { scheduleDetailState } = state$.value;
|
|
15
15
|
if (selectedJeScheduleDetailId != null) {
|
|
16
|
+
if (scheduleDetailState.editScheduleStateById[selectedJeScheduleDetailId] != null &&
|
|
17
|
+
scheduleDetailState.selectedJEScheduleKey != null) {
|
|
18
|
+
updateActions.push((0, scheduleDetailReducer_1.initializeScheduleDetailLocalData)(scheduleDetailState.selectedJEScheduleKey, selectedJeScheduleDetailId));
|
|
19
|
+
updateActions.push((0, scheduleDetailReducer_1.updateScheduleDetailsSuccess)());
|
|
20
|
+
return (0, rxjs_1.from)(updateActions);
|
|
21
|
+
}
|
|
16
22
|
const queryParam = {
|
|
17
23
|
je_schedule_type: tab,
|
|
18
24
|
};
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.clearScheduleDetailView = exports.resetJELinkInLocalData = exports.updatedJELinkWithRecommendedLocalData = exports.updatedSelectedJELinkRowIndex = exports.updateSelectedJEScheduleKey = exports.updateScheduleDetailNewStateLocalData = exports.updateAmountsInScheduleDetail = exports.updatedJELinkInLocalData = exports.updateScheduleDetailsLocalData = exports.initializeScheduleDetailLocalData = exports.saveScheduleDetailsSuccessOrFailure = exports.saveScheduleDetails = exports.updateScheduleDetailsFailure = exports.updateScheduleDetailsSuccess = exports.fetchScheduleDetails = exports.fetchScheduleDetailsPage = exports.createNewSchedules = exports.initialState = exports.initialScheduleDetailsLocalData = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const scheduleDetailLocalDataHelper_1 = require("./scheduleDetailLocalDataHelper");
|
|
7
|
+
const transactionDetailState_1 = require("../../transactionDetail/transactionDetailState");
|
|
7
8
|
exports.initialScheduleDetailsLocalData = {
|
|
8
9
|
jeScheduleDetails: [],
|
|
9
10
|
};
|
|
@@ -206,7 +207,9 @@ const updateJELinkInScheduleDetails = (jeScheduleDetailsLocalData, rowId, jeLink
|
|
|
206
207
|
const updateJELinkInWithRecommendedScheduleDetails = (jeScheduleDetailsLocalData, rowId) => {
|
|
207
208
|
return jeScheduleDetailsLocalData.map((jeScheduleDetail, index) => {
|
|
208
209
|
if (index === rowId) {
|
|
209
|
-
return Object.assign(Object.assign({}, jeScheduleDetail), { jeLink: Object.assign(Object.assign({}, jeScheduleDetail.jeLink), { transactionDetailID: jeScheduleDetail.jeLink.recommendedTransactionID
|
|
210
|
+
return Object.assign(Object.assign({}, jeScheduleDetail), { jeLink: Object.assign(Object.assign({}, jeScheduleDetail.jeLink), { transactionDetailID: jeScheduleDetail.jeLink.recommendedTransactionID, thirdPartyTransactionId: jeScheduleDetail.jeLink.recommendedTransactionID != null
|
|
211
|
+
? (0, transactionDetailState_1.getThirdPartyIdFromTransactionId)(jeScheduleDetail.jeLink.recommendedTransactionID)
|
|
212
|
+
: undefined }),
|
|
210
213
|
// mark this as posted
|
|
211
214
|
postingStatus: 'posted' });
|
|
212
215
|
}
|
|
@@ -12,7 +12,7 @@ _state$) => actions$.pipe((0, operators_1.filter)(scheduleListReducer_1.fetchSch
|
|
|
12
12
|
const scheduleTabIds = ['prepaid_expenses'];
|
|
13
13
|
scheduleTabIds.forEach((scheduleTab) => {
|
|
14
14
|
const accountType = (0, exports.getAccountsTypesForSchedulePayload)(scheduleTab);
|
|
15
|
-
fetchScheduleListActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, false, false, false, accountType.allowedAccountList));
|
|
15
|
+
fetchScheduleListActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, false, false, false, false, accountType.allowedAccountList));
|
|
16
16
|
});
|
|
17
17
|
return (0, rxjs_1.from)(fetchScheduleListActions);
|
|
18
18
|
}));
|
|
@@ -68,3 +68,9 @@ export declare const mapScheduleJournalToCOABalance: (scheduleJournal: Scheduled
|
|
|
68
68
|
* @returns
|
|
69
69
|
*/
|
|
70
70
|
export declare const calculateCOABalanceGroupedByPeriod: (jeSchedule: JEScheduledTransaction) => COABalanceGroupedByPeriod;
|
|
71
|
+
/**
|
|
72
|
+
* Function to get Duration of months out total months Eg 5/12 or 9/12
|
|
73
|
+
* @param jeSchedule
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
76
|
+
export declare const getDurationOfMonthOutTotalMonth: (jeSchedule: JEScheduledTransaction) => number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateCOABalanceGroupedByPeriod = exports.mapScheduleJournalToCOABalance = exports.calculateTotalBalanceTimeframeTick = exports.setDefaultTotalBalanceTimeframeTicks = exports.mapTotalBalanceTimeframeTickToCOAGroupedBalance = exports.getAllTimeframeTicks = exports.getAllAccountNested = exports.getAllAccountBase = exports.getAccountListKeyForSchedulesTab = exports.getCalculatedScheduleTotals = void 0;
|
|
3
|
+
exports.getDurationOfMonthOutTotalMonth = exports.calculateCOABalanceGroupedByPeriod = exports.mapScheduleJournalToCOABalance = exports.calculateTotalBalanceTimeframeTick = exports.setDefaultTotalBalanceTimeframeTicks = exports.mapTotalBalanceTimeframeTickToCOAGroupedBalance = exports.getAllTimeframeTicks = exports.getAllAccountNested = exports.getAllAccountBase = exports.getAccountListKeyForSchedulesTab = exports.getCalculatedScheduleTotals = void 0;
|
|
4
4
|
const amount_1 = require("../../../commonStateTypes/amount");
|
|
5
5
|
const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
6
6
|
const getFYMonths_1 = require("../../../commonStateTypes/fiscalYearHelpers/getFYMonths");
|
|
@@ -185,3 +185,20 @@ const calculateCOABalanceGroupedByPeriod = (jeSchedule) => {
|
|
|
185
185
|
};
|
|
186
186
|
};
|
|
187
187
|
exports.calculateCOABalanceGroupedByPeriod = calculateCOABalanceGroupedByPeriod;
|
|
188
|
+
const countStatusForDuration = (statusCode) => {
|
|
189
|
+
return ['unknown', 'posted'].includes(statusCode);
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Function to get Duration of months out total months Eg 5/12 or 9/12
|
|
193
|
+
* @param jeSchedule
|
|
194
|
+
* @returns
|
|
195
|
+
*/
|
|
196
|
+
const getDurationOfMonthOutTotalMonth = (jeSchedule) => {
|
|
197
|
+
let totalDurationCompleted = 0;
|
|
198
|
+
const scheduledEntries = jeSchedule.scheduledJournalEntry;
|
|
199
|
+
if (jeSchedule.status.code === 'ongoing' && scheduledEntries.length > 0) {
|
|
200
|
+
totalDurationCompleted = scheduledEntries.filter((scheduledEntry) => countStatusForDuration(scheduledEntry.status.code)).length;
|
|
201
|
+
}
|
|
202
|
+
return totalDurationCompleted;
|
|
203
|
+
};
|
|
204
|
+
exports.getDurationOfMonthOutTotalMonth = getDurationOfMonthOutTotalMonth;
|
|
@@ -13,6 +13,7 @@ import { Amount } from '../../../commonStateTypes/amount';
|
|
|
13
13
|
import { COABalanceGroupedByPeriod } from '../../../commonStateTypes/coaBalance/coaBalance';
|
|
14
14
|
export interface JEScheduledTransactionWithBalance extends JEScheduledTransaction {
|
|
15
15
|
coaBalanceByPeriod: COABalanceGroupedByPeriod;
|
|
16
|
+
durationOfMonths: number;
|
|
16
17
|
}
|
|
17
18
|
export interface ScheduleListReport extends SelectorView {
|
|
18
19
|
allSubTabs: ScheduleSubTabType[];
|
|
@@ -153,7 +153,7 @@ const getScheduleListReport = (state) => {
|
|
|
153
153
|
const allTimeframeTicks = (0, scheduleListHelper_1.getAllTimeframeTicks)(sortedJETransactionView, 2);
|
|
154
154
|
const jeScheduledTransactionWithBalance = [];
|
|
155
155
|
sortedJETransactionView.forEach((jeSchedule) => {
|
|
156
|
-
jeScheduledTransactionWithBalance.push(Object.assign(Object.assign({}, jeSchedule), { coaBalanceByPeriod: (0, scheduleListHelper_1.calculateCOABalanceGroupedByPeriod)(jeSchedule) }));
|
|
156
|
+
jeScheduledTransactionWithBalance.push(Object.assign(Object.assign({}, jeSchedule), { coaBalanceByPeriod: (0, scheduleListHelper_1.calculateCOABalanceGroupedByPeriod)(jeSchedule), durationOfMonths: (0, scheduleListHelper_1.getDurationOfMonthOutTotalMonth)(jeSchedule) }));
|
|
157
157
|
});
|
|
158
158
|
const totalBalanceTimeframeTicks = (0, scheduleListHelper_1.calculateTotalBalanceTimeframeTick)(jeScheduledTransactionWithBalance, allTimeframeTicks, 'months');
|
|
159
159
|
return {
|
|
@@ -10,6 +10,7 @@ import { EntityRecommendationKey } from '../recommendation/recommendationState';
|
|
|
10
10
|
import { TransactionDetailLocalData } from './transactionDetailTypes';
|
|
11
11
|
export declare const getTransactionDetailKey: (transactionId: TransactionID) => `${string}_expense` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
|
|
12
12
|
export declare type TransactionDetailKey = ReturnType<typeof getTransactionDetailKey>;
|
|
13
|
+
export declare const getThirdPartyIdFromTransactionId: (transactionId: TransactionID) => string;
|
|
13
14
|
export declare function getAllLinkedTransactions(transaction: Transaction): TransactionID[];
|
|
14
15
|
export interface SupportedTransactionDetail extends FetchedState {
|
|
15
16
|
transactionId?: TransactionID;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initialSupportedTransactionDetail = exports.getAllLinkedTransactions = exports.getTransactionDetailKey = void 0;
|
|
3
|
+
exports.initialSupportedTransactionDetail = exports.getAllLinkedTransactions = exports.getThirdPartyIdFromTransactionId = exports.getTransactionDetailKey = void 0;
|
|
4
4
|
// This transaction key only extracts the third party ID and uses that
|
|
5
5
|
// for the ID
|
|
6
6
|
const getTransactionDetailKey = (transactionId) => `${transactionId.id}_${transactionId.type}`;
|
|
7
7
|
exports.getTransactionDetailKey = getTransactionDetailKey;
|
|
8
|
+
const getThirdPartyIdFromTransactionId = (transactionId) => {
|
|
9
|
+
const zeniGeneratedId = transactionId.id;
|
|
10
|
+
const splittedIds = zeniGeneratedId.trim().split(':');
|
|
11
|
+
if (splittedIds.length === 1) {
|
|
12
|
+
return splittedIds[0];
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return splittedIds[1];
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.getThirdPartyIdFromTransactionId = getThirdPartyIdFromTransactionId;
|
|
8
19
|
function getAllLinkedTransactions(transaction) {
|
|
9
20
|
var _a, _b;
|
|
10
21
|
const result = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.3",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|