@zeniai/client-epic-state 4.8.6 → 4.8.8

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.
@@ -6,12 +6,13 @@ import { AccountListState, AccountListKeyType } from './accountListState';
6
6
  export interface AccountListSelectorView extends SelectorView {
7
7
  accounts: AccountBase[];
8
8
  }
9
- export declare const getAccountList: (accountState: AccountState, accountListState: AccountListState, accountListKey: AccountListKeyType) => AccountListSelectorView;
10
- export declare const getAccountListFetchState: (accountListState: AccountListState, accountListKey: AccountListKeyType) => FetchState;
11
- export declare const getUncategorizedAccounts: (accountState: AccountState, accountListState: AccountListState, accountListKey: AccountListKeyType) => {
9
+ export interface UncategorizedAccounts {
12
10
  income: AccountBase | undefined;
13
11
  expense: AccountBase | undefined;
14
- };
12
+ }
13
+ export declare const getAccountList: (accountState: AccountState, accountListState: AccountListState, accountListKey: AccountListKeyType) => AccountListSelectorView;
14
+ export declare const getAccountListFetchState: (accountListState: AccountListState, accountListKey: AccountListKeyType) => FetchState;
15
+ export declare const getUncategorizedAccounts: (accountState: AccountState, accountListState: AccountListState, accountListKey: AccountListKeyType) => UncategorizedAccounts;
15
16
  export declare const getNestedAccountListHeirarchy: (accountListState: AccountListState, accountListKey: AccountListKeyType) => NestedAccountHeirarchyForReport[];
16
17
  /**
17
18
  * This function gets the list for given label and will filter out the accounts and
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNestedClassListHeirarchy = exports.getClassList = void 0;
4
4
  const classSelector_1 = require("../../entity/class/classSelector");
5
+ // TODO - Fix return type, currently it's returning Class[] but ClassListSelectorView --> classes is ClassBase[]
5
6
  const getClassList = (classState, classListState) => {
6
7
  return {
7
8
  classes: (0, classSelector_1.getClassesByIds)(classState, {
@@ -6,10 +6,11 @@ const operators_1 = require("rxjs/operators");
6
6
  const accountListReducer_1 = require("../../../accountList/accountListReducer");
7
7
  const classListReducer_1 = require("../../../classList/classListReducer");
8
8
  const scheduleDetailReducer_1 = require("../scheduleDetailReducer");
9
- const scheduleDetailLocalDataHelper_1 = require("../scheduleDetailLocalDataHelper");
9
+ const scheduleListHelper_1 = require("../../scheduleListView/scheduleListHelper");
10
10
  const fetchScheduleDetailsPageEpic = (actions$) => actions$.pipe((0, operators_1.filter)(scheduleDetailReducer_1.fetchScheduleDetailsPage.match), (0, operators_1.mergeMap)((action) => {
11
11
  const scheduleDetailsActions = [];
12
- scheduleDetailsActions.push((0, accountListReducer_1.fetchAccountList)('prepaidExpenseAccountList', true, false, false, false, (0, scheduleDetailLocalDataHelper_1.getAccountsTypesForScheduleDetails)('prepaid_expenses')));
12
+ const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)('prepaid_expenses');
13
+ scheduleDetailsActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
13
14
  scheduleDetailsActions.push((0, classListReducer_1.fetchClassList)());
14
15
  scheduleDetailsActions.push((0, scheduleDetailReducer_1.fetchScheduleDetails)(action.payload.tab, action.payload.selectedJeScheduleDetailId));
15
16
  return (0, rxjs_1.concat)((0, rxjs_1.from)(scheduleDetailsActions));
@@ -4,11 +4,13 @@ import { NestedClassHeirarchyForReport } from '../../../commonStateTypes/classes
4
4
  import { AccountBase } from '../../../entity/account/accountState';
5
5
  import { ClassBase } from '../../../entity/class/classState';
6
6
  import { JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
7
+ import { UncategorizedAccounts } from '../../accountList/accountListSelector';
7
8
  import { ScheduleDetailUIState, ScheduleDetailsLocalData } from './scheduleDetailState';
8
9
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
9
10
  import { FetchStateAndError } from '../../../commonStateTypes/common';
10
11
  export interface ScheduleDetailsView extends SelectorView {
11
12
  allAccountList: AccountBase[];
13
+ uncategorizedAccounts: UncategorizedAccounts;
12
14
  accountListNestedAccountHierarchy: NestedAccountHeirarchyForReport[];
13
15
  allClassList: ClassBase[];
14
16
  classListNestedAccountHierarchy: NestedClassHeirarchyForReport[];
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getScheduleDetailsView = void 0;
7
+ const omit_1 = __importDefault(require("lodash/omit"));
4
8
  const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
5
9
  const accountListSelector_1 = require("../../accountList/accountListSelector");
6
10
  const classListSelector_1 = require("../../classList/classListSelector");
@@ -11,12 +15,14 @@ const scheduleDetailLocalDataHelper_1 = require("./scheduleDetailLocalDataHelper
11
15
  const getScheduleDetailsView = (state) => {
12
16
  const { accountState, accountListState, classState, classListState, scheduleDetailState, } = state;
13
17
  const jeScheduleKey = scheduleDetailState.selectedJEScheduleKey;
18
+ const uncategorizedAccounts = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'prepaidExpenseAccountList');
14
19
  if (jeScheduleKey == null) {
15
20
  return {
16
21
  uiState: scheduleDetailState.uiState,
17
22
  selectedJEScheduleTransaction: undefined,
18
23
  allAccountList: [],
19
24
  allClassList: [],
25
+ uncategorizedAccounts,
20
26
  accountListNestedAccountHierarchy: [],
21
27
  classListNestedAccountHierarchy: [],
22
28
  scheduleDetailsLocalData: {
@@ -36,6 +42,9 @@ const getScheduleDetailsView = (state) => {
36
42
  const allAccountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'prepaidExpenseAccountList');
37
43
  const filteredAccounts = allAccountList.accounts.filter((account) => scheduleDetailAccountIds.includes(account.accountId));
38
44
  const allClassList = (0, classListSelector_1.getClassList)(classState, classListState);
45
+ const allClasses = allClassList.classes.map((classData) => {
46
+ return (0, omit_1.default)(classData, ['accountIds', 'key']);
47
+ });
39
48
  const accountListNestedAccountHierarchy = (0, accountListSelector_1.getNestedAccountListHeirarchy)(accountListState, 'prepaidExpenseAccountList').filter((account) => account.accountId[0] != null &&
40
49
  scheduleDetailAccountIds.includes(account.accountId[0]));
41
50
  const classListNestedAccountHierarchy = (0, classListSelector_1.getNestedClassListHeirarchy)(classListState);
@@ -60,7 +69,8 @@ const getScheduleDetailsView = (state) => {
60
69
  uiState: scheduleDetailState.uiState,
61
70
  selectedJEScheduleTransaction: jeScheduleTransactionState,
62
71
  allAccountList: filteredAccounts,
63
- allClassList: allClassList.classes,
72
+ allClassList: allClasses,
73
+ uncategorizedAccounts,
64
74
  accountListNestedAccountHierarchy,
65
75
  classListNestedAccountHierarchy,
66
76
  scheduleDetailsLocalData,
@@ -24,10 +24,12 @@ const fetchScheduleListEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, o
24
24
  const timePeriod = (0, timeframeTick_1.toTimePeriod)(timeframe);
25
25
  const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.tab, categoryId, timeframe);
26
26
  const draft = scheduleListState.byScheduleListKey[key];
27
- if (draft != null && draft.fetchState === 'Completed') {
27
+ if (draft != null &&
28
+ draft.fetchState === 'Completed' &&
29
+ action.payload.cacheOverride === false) {
28
30
  return (0, rxjs_1.from)([]);
29
31
  }
30
- const scheduleListCurrentTabAccountTypes = (0, scheduleListHelper_1.getAccountsTypesForSchedulePayload)(scheduleListState.currentTab).allowedAccountList;
32
+ const scheduleListCurrentTabAccountTypes = (0, scheduleListHelper_1.getAccountsTypesForScheduleList)(scheduleListState.currentTab).allowedAccountList;
31
33
  const scheduleListCurrentTabAccountIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, scheduleListCurrentTabAccountTypes);
32
34
  let categoryIds = [categoryId];
33
35
  if (categoryId === 'all') {
@@ -65,7 +67,7 @@ exports.fetchScheduleListEpic = fetchScheduleListEpic;
65
67
  * @returns
66
68
  */
67
69
  const getAllAccountIdsForTab = (tab, accountListState, filterAccountIds) => {
68
- const accountStateForReport = accountListState.byReportId[(0, scheduleListHelper_1.getAccountsTypesForSchedulePayload)(tab).accountListKey];
70
+ const accountStateForReport = accountListState.byReportId[(0, scheduleListHelper_1.getAccountsTypesForScheduleList)(tab).accountListKey];
69
71
  let accountIds = accountStateForReport.accountIds.filter((accountId) => filterAccountIds.includes(accountId));
70
72
  if (tab === 'prepaid_expenses') {
71
73
  const filteredList = accountStateForReport.accountIdsByLabel['prepaid_expenses'];
@@ -12,7 +12,7 @@ _state$) => actions$.pipe((0, operators_1.filter)(scheduleListReducer_1.fetchSch
12
12
  const fetchScheduleListActions = [];
13
13
  const scheduleTabIds = ['prepaid_expenses'];
14
14
  scheduleTabIds.forEach((scheduleTab) => {
15
- const accountType = (0, scheduleListHelper_1.getAccountsTypesForSchedulePayload)(scheduleTab);
15
+ const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)(scheduleTab);
16
16
  fetchScheduleListActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, false, false, false, false, accountType.allowedAccountList));
17
17
  });
18
18
  return (0, rxjs_1.from)(fetchScheduleListActions);
@@ -84,5 +84,11 @@ declare type AccountListTypesPayload = {
84
84
  * @param scheduleType
85
85
  * @returns
86
86
  */
87
- export declare const getAccountsTypesForSchedulePayload: (scheduleType: SchedulesTypes) => AccountListTypesPayload;
87
+ export declare const getAccountsTypesForScheduleList: (scheduleType: SchedulesTypes) => AccountListTypesPayload;
88
+ /**
89
+ * Function to get accountListKey and allowedAccountList for a given tab
90
+ * @param scheduleType
91
+ * @returns
92
+ */
93
+ export declare const getAccountsTypesForScheduleEpics: (scheduleType: SchedulesTypes) => AccountListTypesPayload;
88
94
  export {};
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAccountsTypesForSchedulePayload = exports.getDurationOfMonthOutTotalMonth = exports.calculateCOABalanceGroupedByPeriod = exports.mapScheduleJournalToCOABalance = exports.calculateTotalBalanceTimeframeTick = exports.setDefaultTotalBalanceTimeframeTicks = exports.mapTotalBalanceTimeframeTickToCOAGroupedBalance = exports.getAllTimeframeTicks = exports.getAllAccountNested = exports.getAllAccountBase = exports.getAccountListKeyForSchedulesTab = exports.getCalculatedScheduleTotals = void 0;
3
+ exports.getAccountsTypesForScheduleEpics = exports.getAccountsTypesForScheduleList = 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");
7
7
  const zeniDayJS_1 = require("../../../zeniDayJS");
8
+ const scheduleDetailLocalDataHelper_1 = require("../scheduleDetailView/scheduleDetailLocalDataHelper");
8
9
  /**
9
10
  * This helper function calculates Total Amount and Total Running balances
10
11
  * for all the JE transactions which can be used to display the totals on the Schedule List page.
@@ -207,7 +208,7 @@ exports.getDurationOfMonthOutTotalMonth = getDurationOfMonthOutTotalMonth;
207
208
  * @param scheduleType
208
209
  * @returns
209
210
  */
210
- const getAccountsTypesForSchedulePayload = (scheduleType) => {
211
+ const getAccountsTypesForScheduleList = (scheduleType) => {
211
212
  switch (scheduleType) {
212
213
  case 'prepaid_expenses':
213
214
  return {
@@ -221,4 +222,28 @@ const getAccountsTypesForSchedulePayload = (scheduleType) => {
221
222
  };
222
223
  }
223
224
  };
224
- exports.getAccountsTypesForSchedulePayload = getAccountsTypesForSchedulePayload;
225
+ exports.getAccountsTypesForScheduleList = getAccountsTypesForScheduleList;
226
+ /**
227
+ * Function to get accountListKey and allowedAccountList for a given tab
228
+ * @param scheduleType
229
+ * @returns
230
+ */
231
+ const getAccountsTypesForScheduleEpics = (scheduleType) => {
232
+ const allowedAccountTypes = [
233
+ ...(0, exports.getAccountsTypesForScheduleList)(scheduleType).allowedAccountList,
234
+ ...(0, scheduleDetailLocalDataHelper_1.getAccountsTypesForScheduleDetails)(scheduleType),
235
+ ];
236
+ switch (scheduleType) {
237
+ case 'prepaid_expenses':
238
+ return {
239
+ accountListKey: 'prepaidExpenseAccountList',
240
+ allowedAccountList: [...new Set(allowedAccountTypes)],
241
+ };
242
+ default:
243
+ return {
244
+ accountListKey: 'accountList',
245
+ allowedAccountList: [],
246
+ };
247
+ }
248
+ };
249
+ exports.getAccountsTypesForScheduleEpics = getAccountsTypesForScheduleEpics;
@@ -71,7 +71,7 @@ const getScheduleListReport = (state) => {
71
71
  const allScheduleAccounts = (0, accountListSelector_1.getAccountList)(accountState, accountListState, (0, scheduleListHelper_1.getAccountListKeyForSchedulesTab)(scheduleListState.currentTab));
72
72
  let allNestedAccounts = (0, accountListSelector_1.getNestedAccountListHeirarchy)(accountListState, (0, scheduleListHelper_1.getAccountListKeyForSchedulesTab)(scheduleListState.currentTab));
73
73
  let allAccounts = allScheduleAccounts.accounts;
74
- const scheduleListCurrentTabAccountTypes = (0, scheduleListHelper_2.getAccountsTypesForSchedulePayload)(scheduleListState.currentTab).allowedAccountList;
74
+ const scheduleListCurrentTabAccountTypes = (0, scheduleListHelper_2.getAccountsTypesForScheduleList)(scheduleListState.currentTab).allowedAccountList;
75
75
  const scheduleListCurrentTabAccountIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, scheduleListCurrentTabAccountTypes);
76
76
  if (scheduleListState.currentTab === 'prepaid_expenses') {
77
77
  const filteredList = (0, accountListSelector_1.getFilteredNestedAndAccountListsForLabel)(accountState, accountListState, (0, scheduleListHelper_1.getAccountListKeyForSchedulesTab)(scheduleListState.currentTab), 'prepaid_expenses');
@@ -14,6 +14,9 @@ const editBillViewState_1 = require("../editBillViewState");
14
14
  const editBillViewSelector_1 = require("../editBillViewSelector");
15
15
  const accountListSelector_1 = require("../../../../accountList/accountListSelector");
16
16
  const classListSelector_1 = require("../../../../classList/classListSelector");
17
+ const workingDayHelper_1 = require("../../../../../commonStateTypes/workingDayHelper");
18
+ const zeniDayJS_1 = require("../../../../../zeniDayJS");
19
+ const companySelector_1 = require("../../../../../entity/company/companySelector");
17
20
  const isClassRecommendation = (recommendations, classObj) => {
18
21
  if (classObj == null) {
19
22
  return false;
@@ -87,7 +90,7 @@ const getLineRecommendationsLocalData = (lineId, line, recommendations, accountL
87
90
  };
88
91
  exports.getLineRecommendationsLocalData = getLineRecommendationsLocalData;
89
92
  const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.initializeBillToLocalStore.match), (0, operators_1.mergeMap)((action) => {
90
- var _a, _b, _c, _d, _e, _f;
93
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
91
94
  const { billId } = action.payload;
92
95
  const state = state$.value;
93
96
  const detailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId);
@@ -136,9 +139,19 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
136
139
  (_e = transaction.lines) === null || _e === void 0 ? void 0 : _e.forEach((line) => {
137
140
  updatesByLineId[line.id] = Object.assign(Object.assign({}, line), (0, exports.getLineRecommendationsLocalData)(line.id, line, recommendations, accountList, classList, vendor));
138
141
  });
142
+ const { tenantState, companyState } = state;
143
+ const { currentTenantId } = tenantState;
144
+ const companyId = currentTenantId != null
145
+ ? (_g = (_f = tenantState.tenantsById) === null || _f === void 0 ? void 0 : _f[currentTenantId]) === null || _g === void 0 ? void 0 : _g.companyId
146
+ : undefined;
147
+ const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
148
+ const payNowCutOffTime = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyBillPayInfo.payNowCutOffTimeByMethod.ach;
149
+ const isPayNowEnabled = payNowCutOffTime != null
150
+ ? (0, zeniDayJS_1.dateNow)().isSameOrBefore(payNowCutOffTime)
151
+ : false;
139
152
  const paymentDetailsSection = {
140
153
  paymentType: (0, editBillViewSelector_1.getPaymentMethodType)(state.billPayConfigState, transaction.billPayInfo.billPaymentMethodType, transaction.billPayInfo.internationalTransferFeeBearerPaymentMethod),
141
- paymentDate: transaction.billPayInfo.paymentDate,
154
+ paymentDate: (_h = transaction.billPayInfo.paymentDate) !== null && _h !== void 0 ? _h : (0, zeniDayJS_1.date)((0, workingDayHelper_1.getNextNthWorkingDay)((0, zeniDayJS_1.dateNow)().toDate(), [0, 6], isPayNowEnabled ? 0 : 1).toISOString()),
142
155
  withdrawFrom: transaction.billPayInfo.fromAccount.billAccountId != null &&
143
156
  transaction.billPayInfo.fromAccount.billAccountId.length > 0
144
157
  ? transaction.billPayInfo.fromAccount.billAccountId
@@ -151,7 +164,7 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
151
164
  };
152
165
  const totalAmount = transaction.amount;
153
166
  const isCancelled = transaction.billPayInfo.isCancelled;
154
- const file = (_f = transaction.attachments) === null || _f === void 0 ? void 0 : _f[0];
167
+ const file = (_j = transaction.attachments) === null || _j === void 0 ? void 0 : _j[0];
155
168
  const candidateVendorname = transaction.candidateVendorName;
156
169
  const toAccountVendorEmail = transaction.billPayInfo.toAccountVendorEmail;
157
170
  const isCollectToAccountInfoFromVendorContact = transaction.billPayInfo.isCollectToAccountInfoFromVendorContact;
@@ -25,6 +25,8 @@ const initializeBillToLocalStoreEpic_1 = require("./initializeBillToLocalStoreEp
25
25
  const transactionPayload_1 = require("../../../../../entity/transaction/payloadTypes/transactionPayload");
26
26
  const billPayConfigPayload_1 = require("../../billPayConfig/billPayConfigPayload");
27
27
  const billTransactionState_1 = require("../../../../../entity/billPay/billTransaction/billTransactionState");
28
+ const workingDayHelper_1 = require("../../../../../commonStateTypes/workingDayHelper");
29
+ const companySelector_1 = require("../../../../../entity/company/companySelector");
28
30
  const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.parseInvoiceToBill.match), (0, operators_1.mergeMap)((action) => {
29
31
  var _a, _b, _c, _d, _e, _f;
30
32
  const { invoiceProcessingPayload, isVendorRecommendationFeatureEnabled } = action.payload;
@@ -118,7 +120,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
118
120
  }));
119
121
  exports.parseInvoiceToBillEpic = parseInvoiceToBillEpic;
120
122
  const toBillDetailLocalData = (state, billPayload, vendor, recommendedVendorId) => {
121
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
123
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
122
124
  const currency = {
123
125
  currencyCode: (_a = billPayload.currency_code) !== null && _a !== void 0 ? _a : '',
124
126
  currencySymbol: (_b = billPayload.currency_symbol) !== null && _b !== void 0 ? _b : '', //api not returning symbol
@@ -170,6 +172,16 @@ const toBillDetailLocalData = (state, billPayload, vendor, recommendedVendorId)
170
172
  : undefined, internationalTransferFeeBearerPaymentMethod != null
171
173
  ? (0, billTransactionState_1.toInternationalTransferFeeBearerPaymentMethod)(internationalTransferFeeBearerPaymentMethod)
172
174
  : undefined);
175
+ const { tenantState, companyState } = state;
176
+ const { currentTenantId } = tenantState;
177
+ const companyId = currentTenantId != null
178
+ ? (_k = (_j = tenantState.tenantsById) === null || _j === void 0 ? void 0 : _j[currentTenantId]) === null || _k === void 0 ? void 0 : _k.companyId
179
+ : undefined;
180
+ const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
181
+ const payNowCutOffTime = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyBillPayInfo.payNowCutOffTimeByMethod.ach;
182
+ const isPayNowEnabled = payNowCutOffTime != null
183
+ ? (0, zeniDayJS_1.dateNow)().isSameOrBefore(payNowCutOffTime)
184
+ : false;
173
185
  return {
174
186
  recommendedVendorId,
175
187
  lastRecommendedVendorName: recommendedVendorId != null ? vendor === null || vendor === void 0 ? void 0 : vendor.name : undefined,
@@ -196,24 +208,24 @@ const toBillDetailLocalData = (state, billPayload, vendor, recommendedVendorId)
196
208
  ? (0, billPayConfigPayload_1.getInternationalSubConfigCodeKey)(internationalSubCode)
197
209
  : undefined))
198
210
  : undefined,
199
- paymentDate: ((_j = billPayload.bill_pay_info) === null || _j === void 0 ? void 0 : _j.payment_date) != null
200
- ? (0, zeniDayJS_1.date)((_k = billPayload.bill_pay_info) === null || _k === void 0 ? void 0 : _k.payment_date)
201
- : undefined,
202
- withdrawFrom: (_m = (_l = billPayload.bill_pay_info) === null || _l === void 0 ? void 0 : _l.from_account.account_id) !== null && _m !== void 0 ? _m : undefined,
203
- internationalTransferFeeBearerPaymentMethod: ((_o = billPayload.bill_pay_info) === null || _o === void 0 ? void 0 : _o.international_transfer_fee_bearer_payment_method) != null
204
- ? (0, billTransactionState_1.toInternationalTransferFeeBearerPaymentMethod)((_p = billPayload.bill_pay_info) === null || _p === void 0 ? void 0 : _p.international_transfer_fee_bearer_payment_method)
211
+ paymentDate: ((_l = billPayload.bill_pay_info) === null || _l === void 0 ? void 0 : _l.payment_date) != null
212
+ ? (0, zeniDayJS_1.date)((_m = billPayload.bill_pay_info) === null || _m === void 0 ? void 0 : _m.payment_date)
213
+ : (0, zeniDayJS_1.date)((0, workingDayHelper_1.getNextNthWorkingDay)((0, zeniDayJS_1.dateNow)().toDate(), [0, 6], isPayNowEnabled ? 0 : 1).toISOString()),
214
+ withdrawFrom: (_p = (_o = billPayload.bill_pay_info) === null || _o === void 0 ? void 0 : _o.from_account.account_id) !== null && _p !== void 0 ? _p : undefined,
215
+ internationalTransferFeeBearerPaymentMethod: ((_q = billPayload.bill_pay_info) === null || _q === void 0 ? void 0 : _q.international_transfer_fee_bearer_payment_method) != null
216
+ ? (0, billTransactionState_1.toInternationalTransferFeeBearerPaymentMethod)((_r = billPayload.bill_pay_info) === null || _r === void 0 ? void 0 : _r.international_transfer_fee_bearer_payment_method)
205
217
  : undefined,
206
218
  },
207
219
  totalAmount: billPayload.amount != null
208
220
  ? (0, amount_1.toAmountWC)(billPayload.amount, {
209
- currencyCode: (_q = billPayload.currency_code) !== null && _q !== void 0 ? _q : 'USD',
210
- currencySymbol: (_r = billPayload.currency_symbol) !== null && _r !== void 0 ? _r : '$',
221
+ currencyCode: (_s = billPayload.currency_code) !== null && _s !== void 0 ? _s : 'USD',
222
+ currencySymbol: (_t = billPayload.currency_symbol) !== null && _t !== void 0 ? _t : '$',
211
223
  })
212
224
  : undefined,
213
225
  isCancelled: false,
214
- toAccountVendorEmail: (_t = (_s = billPayload.bill_pay_info) === null || _s === void 0 ? void 0 : _s.to_account_vendor_email) !== null && _t !== void 0 ? _t : undefined,
215
- isCollectToAccountInfoFromVendorContact: (_v = (_u = billPayload.bill_pay_info) === null || _u === void 0 ? void 0 : _u.is_collect_to_account_info_from_vendor_contact) !== null && _v !== void 0 ? _v : false,
216
- isRecurring: (_w = billPayload.is_recurring) !== null && _w !== void 0 ? _w : false,
226
+ toAccountVendorEmail: (_v = (_u = billPayload.bill_pay_info) === null || _u === void 0 ? void 0 : _u.to_account_vendor_email) !== null && _v !== void 0 ? _v : undefined,
227
+ isCollectToAccountInfoFromVendorContact: (_x = (_w = billPayload.bill_pay_info) === null || _w === void 0 ? void 0 : _w.is_collect_to_account_info_from_vendor_contact) !== null && _x !== void 0 ? _x : false,
228
+ isRecurring: (_y = billPayload.is_recurring) !== null && _y !== void 0 ? _y : false,
217
229
  };
218
230
  };
219
231
  exports.toBillDetailLocalData = toBillDetailLocalData;
@@ -1,5 +1,5 @@
1
- import { AccountBase } from '../../../entity/account/accountState';
2
1
  import { SupportedTransaction } from '../../../entity/transaction/transactionState';
2
+ import { UncategorizedAccounts } from '../../accountList/accountListSelector';
3
3
  import { TransactionSaveUpdates } from '../transactionDetailState';
4
4
  import { TransactionDetailLocalData } from '../transactionDetailTypes';
5
5
  /**
@@ -18,7 +18,4 @@ import { TransactionDetailLocalData } from '../transactionDetailTypes';
18
18
  * 4. Only difference between this and Miscategorized will be that we will
19
19
  * additionally fire “Mark as not miscat” for every point above.
20
20
  */
21
- export declare const toTransactionUpdatesFromTransactionDetailLocalData: (transactionDetailLocalData: TransactionDetailLocalData, transaction: SupportedTransaction, uncategorizedIncomeExpense: {
22
- income: AccountBase | undefined;
23
- expense: AccountBase | undefined;
24
- }) => TransactionSaveUpdates;
21
+ export declare const toTransactionUpdatesFromTransactionDetailLocalData: (transactionDetailLocalData: TransactionDetailLocalData, transaction: SupportedTransaction, uncategorizedIncomeExpense: UncategorizedAccounts) => TransactionSaveUpdates;
@@ -4,11 +4,9 @@ import { AccountBase } from '../../entity/account/accountState';
4
4
  import { ClassBase } from '../../entity/class/classState';
5
5
  import { Entity } from '../../entity/genericEntity/entity';
6
6
  import { SupportedTransaction } from '../../entity/transaction/transactionState';
7
+ import { UncategorizedAccounts } from '../accountList/accountListSelector';
7
8
  import { TransactionDetailLocalData } from './transactionDetailTypes';
8
- export declare const toTransactionDetailLocalData: (transaction: SupportedTransaction, vendorId: ID | undefined, uncategorizedIncomeExpense?: {
9
- income: AccountBase | undefined;
10
- expense: AccountBase | undefined;
11
- } | undefined) => TransactionDetailLocalData;
9
+ export declare const toTransactionDetailLocalData: (transaction: SupportedTransaction, vendorId: ID | undefined, uncategorizedIncomeExpense?: UncategorizedAccounts | undefined) => TransactionDetailLocalData;
12
10
  export declare const toUpdateLineItemsOriginalCategoryClass: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, lineIdsForReplace: ID[], lineIdsForUpdateAll: ID[], replace: 'account' | 'class' | 'both', updateAll?: boolean | undefined) => TransactionDetailLocalData;
13
11
  export declare const toSetAllLineItemsToCategoryClass: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, isUpdateAll: boolean, lineEntity?: Entity | undefined, chosenAccount?: {
14
12
  account: AccountBase;
@@ -18,9 +16,6 @@ export declare const toSetAllLineItemsToCategoryClass: (transaction: SupportedTr
18
16
  updateOrRetain: 'update' | 'retain';
19
17
  } | undefined, recommendations?: Recommendation[] | undefined) => TransactionDetailLocalData;
20
18
  export declare const toSetAllLineItemsLocalDataIsUpdateAllChecked: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, isUpdateAll: boolean, entity?: Entity | undefined) => TransactionDetailLocalData;
21
- export declare const setEntityRecommendationForLineIdInLocalData: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, entity: Entity, recommendationLineIds: ID[], recommendations?: Recommendation[] | undefined, uncategorizedIncomeExpense?: {
22
- income: AccountBase | undefined;
23
- expense: AccountBase | undefined;
24
- } | undefined) => TransactionDetailLocalData;
19
+ export declare const setEntityRecommendationForLineIdInLocalData: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, entity: Entity, recommendationLineIds: ID[], recommendations?: Recommendation[] | undefined, uncategorizedIncomeExpense?: UncategorizedAccounts | undefined) => TransactionDetailLocalData;
25
20
  export declare const removeEntityRecommendationForLineIdInLocalData: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, recommendationLineIds: ID[]) => TransactionDetailLocalData;
26
21
  export declare const getChangedLineItemCountFromLocalData: (transaction: SupportedTransaction, transactionLocalData: TransactionDetailLocalData) => number;
@@ -8,6 +8,7 @@ import { AccountBase } from '../../entity/account/accountState';
8
8
  import { ClassBase } from '../../entity/class/classState';
9
9
  import { Entity } from '../../entity/genericEntity/entity';
10
10
  import { Recommendation } from '../../commonStateTypes/recommendationBase';
11
+ import { UncategorizedAccounts } from '../accountList/accountListSelector';
11
12
  export declare const initialState: TransactionDetailState;
12
13
  export declare const fetchTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, cacheOverride?: any], {
13
14
  transactionId: TransactionID;
@@ -83,20 +84,14 @@ export declare const fetchTransactionDetail: import("@reduxjs/toolkit").ActionCr
83
84
  transaction: SupportedTransaction;
84
85
  isUpdateAll: boolean;
85
86
  entity: Entity | undefined;
86
- }, string, never, never>, setEntityRecommendationForLineIdsForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineIds: string[], entity: Entity, amount: number, recommendations?: Recommendation[] | undefined, uncategorizedIncomeExpense?: {
87
- income: AccountBase | undefined;
88
- expense: AccountBase | undefined;
89
- } | undefined], {
87
+ }, string, never, never>, setEntityRecommendationForLineIdsForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineIds: string[], entity: Entity, amount: number, recommendations?: Recommendation[] | undefined, uncategorizedIncomeExpense?: UncategorizedAccounts | undefined], {
90
88
  transactionId: TransactionID;
91
89
  transaction: SupportedTransaction;
92
90
  lineIds: string[];
93
91
  entity: Entity;
94
92
  amount: number;
95
93
  recommendations: Recommendation[] | undefined;
96
- uncategorizedIncomeExpense: {
97
- income: AccountBase | undefined;
98
- expense: AccountBase | undefined;
99
- } | undefined;
94
+ uncategorizedIncomeExpense: UncategorizedAccounts | undefined;
100
95
  }, string, never, never>, removeEntityRecommendationForLineIdForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineId: string], {
101
96
  transactionId: TransactionID;
102
97
  transaction: SupportedTransaction;
@@ -68,9 +68,14 @@ const toVendorReviewViewRecommendationPayload = (recommendations, nonExistingRec
68
68
  global_merchants: recommendationEntities,
69
69
  };
70
70
  });
71
- const allRecommendations = recommendationsPayload.length > 0
72
- ? recommendationsPayload
73
- : nonExistingRecommendationsPayload;
71
+ const allRecommendations = [
72
+ {
73
+ global_merchants: [
74
+ ...recommendationsPayload[0].global_merchants,
75
+ ...nonExistingRecommendationsPayload[0].global_merchants,
76
+ ],
77
+ },
78
+ ];
74
79
  return allRecommendations;
75
80
  };
76
81
  exports.toVendorReviewViewRecommendationPayload = toVendorReviewViewRecommendationPayload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.8.6",
3
+ "version": "4.8.8",
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",