@zeniai/client-epic-state 4.7.72 → 4.7.74

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.
Files changed (93) hide show
  1. package/lib/commonStateTypes/workingDayHelper.d.ts +5 -9
  2. package/lib/commonStateTypes/workingDayHelper.js +12 -36
  3. package/lib/entity/account/accountPayload.d.ts +1 -1
  4. package/lib/entity/billPay/billTransaction/billTransactionPayload.d.ts +0 -3
  5. package/lib/entity/billPay/billTransaction/billTransactionPayload.js +2 -2
  6. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +0 -3
  7. package/lib/entity/chargeCard/chargeCard.d.ts +2 -2
  8. package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.d.ts +0 -1
  9. package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.js +0 -1
  10. package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +0 -1
  11. package/lib/entity/paymentAccount/paymentAccountPayload.d.ts +0 -1
  12. package/lib/entity/paymentAccount/paymentAccountPayload.js +1 -2
  13. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +0 -2
  14. package/lib/entity/paymentAccount/paymentAccountSelector.js +1 -14
  15. package/lib/entity/paymentAccount/paymentAccountState.d.ts +0 -1
  16. package/lib/entity/tenant/clearAllEpic.d.ts +2 -4
  17. package/lib/entity/tenant/clearAllEpic.js +0 -4
  18. package/lib/entity/transaction/stateTypes/attachment.js +5 -5
  19. package/lib/epic.d.ts +1 -5
  20. package/lib/epic.js +1 -5
  21. package/lib/index.d.ts +6 -16
  22. package/lib/index.js +13 -32
  23. package/lib/reducer.d.ts +0 -6
  24. package/lib/reducer.js +0 -6
  25. package/lib/view/accountList/accountListReducer.js +1 -2
  26. package/lib/view/accountList/accountListState.d.ts +1 -1
  27. package/lib/view/accountList/fetchAccountListEpic.js +7 -16
  28. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +0 -1
  29. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +1 -1
  30. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewPayload.d.ts +0 -3
  31. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +0 -5
  32. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +2 -13
  33. package/lib/view/spendManagement/billPay/billDetailView/epics/cancelAndDeleteBillEpic.d.ts +1 -2
  34. package/lib/view/spendManagement/billPay/billDetailView/epics/cancelAndDeleteBillEpic.js +8 -19
  35. package/lib/view/spendManagement/billPay/billDetailView/epics/deleteBillEpic.d.ts +1 -2
  36. package/lib/view/spendManagement/billPay/billDetailView/epics/deleteBillEpic.js +4 -14
  37. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.d.ts +1 -2
  38. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +2 -5
  39. package/lib/view/spendManagement/billPay/billList/billListPayload.d.ts +0 -2
  40. package/lib/view/spendManagement/billPay/billList/billListSelector.d.ts +0 -3
  41. package/lib/view/spendManagement/billPay/billList/billListSelector.js +2 -10
  42. package/lib/view/spendManagement/billPay/billList/fetchBillListPerTabEpic.d.ts +1 -2
  43. package/lib/view/spendManagement/billPay/billList/fetchBillListPerTabEpic.js +1 -3
  44. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +0 -4
  45. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +9 -31
  46. package/lib/view/spendManagement/billPay/editBillView/editBillViewPayload.d.ts +0 -4
  47. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +0 -17
  48. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +2 -10
  49. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +14 -59
  50. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +0 -28
  51. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +0 -1
  52. package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +3 -3
  53. package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +2 -13
  54. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +2 -3
  55. package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +24 -11
  56. package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +14 -100
  57. package/lib/view/spendManagement/commonHistoryView/commonHistory.d.ts +0 -1
  58. package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.d.ts +0 -1
  59. package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.js +5 -9
  60. package/lib/view/spendManagement/helpers.d.ts +1 -11
  61. package/lib/view/spendManagement/helpers.js +1 -134
  62. package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.d.ts +0 -1
  63. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.d.ts +0 -1
  64. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.js +0 -1
  65. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigReducer.js +1 -3
  66. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.d.ts +0 -1
  67. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.js +1 -2
  68. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigState.d.ts +0 -1
  69. package/package.json +4 -5
  70. package/lib/entity/billPay/recurringBills/recurringBillsPayload.d.ts +0 -34
  71. package/lib/entity/billPay/recurringBills/recurringBillsPayload.js +0 -44
  72. package/lib/entity/billPay/recurringBills/recurringBillsReducer.d.ts +0 -6
  73. package/lib/entity/billPay/recurringBills/recurringBillsReducer.js +0 -40
  74. package/lib/entity/billPay/recurringBills/recurringBillsState.d.ts +0 -33
  75. package/lib/entity/billPay/recurringBills/recurringBillsState.js +0 -14
  76. package/lib/view/settingsView/epic/fetchBankAccountsListEpic.d.ts +0 -22
  77. package/lib/view/settingsView/epic/fetchBankAccountsListEpic.js +0 -30
  78. package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.d.ts +0 -6
  79. package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.js +0 -14
  80. package/lib/view/settingsView/epic/fetchMyProfileEpic.d.ts +0 -43
  81. package/lib/view/settingsView/epic/fetchMyProfileEpic.js +0 -50
  82. package/lib/view/settingsView/epic/fetchMyProfileViewEpic.d.ts +0 -7
  83. package/lib/view/settingsView/epic/fetchMyProfileViewEpic.js +0 -17
  84. package/lib/view/settingsView/settingsViewPayload.d.ts +0 -8
  85. package/lib/view/settingsView/settingsViewPayload.js +0 -2
  86. package/lib/view/settingsView/settingsViewReducer.d.ts +0 -13
  87. package/lib/view/settingsView/settingsViewReducer.js +0 -71
  88. package/lib/view/settingsView/settingsViewSelector.d.ts +0 -14
  89. package/lib/view/settingsView/settingsViewSelector.js +0 -119
  90. package/lib/view/settingsView/settingsViewState.d.ts +0 -12
  91. package/lib/view/settingsView/settingsViewState.js +0 -2
  92. package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +0 -29
  93. package/lib/view/settingsView/types/settingsViewSelectorTypes.js +0 -2
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEndDate = exports.getTotalPayments = exports.isRecurringConfigChanged = exports.updateRecurringBillDetails = exports.getPaymentDateFromVendorReceiveDate = exports.getSelectedCompanyOfficer = exports.getSpendManagementEffectiveListPeriod = exports.getLatestApprovalDate = void 0;
3
+ exports.getSelectedCompanyOfficer = exports.getSpendManagementEffectiveListPeriod = exports.getLatestApprovalDate = void 0;
4
4
  const timeframeTick_1 = require("../../commonStateTypes/timeframeTick");
5
5
  const workingDayHelper_1 = require("../../commonStateTypes/workingDayHelper");
6
6
  const zeniDayJS_1 = require("../../zeniDayJS");
@@ -45,136 +45,3 @@ const getSelectedCompanyOfficer = (verificationDetails) => {
45
45
  return officer;
46
46
  };
47
47
  exports.getSelectedCompanyOfficer = getSelectedCompanyOfficer;
48
- const getPaymentDateFromVendorReceiveDate = (vendorReceiveDate, maxPaymentProcessingDays) => {
49
- let paymentDate = vendorReceiveDate.subtract(maxPaymentProcessingDays, 'day');
50
- while ((0, workingDayHelper_1.isHoliday)(paymentDate.toDate()) === true) {
51
- paymentDate = paymentDate.subtract(1, 'day');
52
- }
53
- return paymentDate;
54
- };
55
- exports.getPaymentDateFromVendorReceiveDate = getPaymentDateFromVendorReceiveDate;
56
- const updateRecurringBillDetails = (currentRecurringConfig, prevRecurringConfig, currentInstances, currentBillAmount) => {
57
- var _a;
58
- let updatedRecurringInstances = [];
59
- const { startDate, endDate, frequency, totalPaymentCycles, endDateSelectorOptionType, } = currentRecurringConfig;
60
- if (frequency == null ||
61
- startDate == null ||
62
- (totalPaymentCycles === 0 && endDate == null) ||
63
- (prevRecurringConfig != null &&
64
- prevRecurringConfig.isActive &&
65
- !(0, exports.isRecurringConfigChanged)(currentRecurringConfig, prevRecurringConfig, false))) {
66
- return {
67
- recurringConfig: currentRecurringConfig,
68
- recurringInstances: currentInstances,
69
- };
70
- }
71
- let currentEndDate = endDate;
72
- let currentTotalPayments = totalPaymentCycles;
73
- const currentInstance = currentInstances === null || currentInstances === void 0 ? void 0 : currentInstances.find((instance) => Boolean(instance.readonly) === false);
74
- //TBR check if endDate or totalPayments to be preserved for change in frequency/startDate
75
- if (prevRecurringConfig != null &&
76
- endDateSelectorOptionType == null &&
77
- (0, exports.isRecurringConfigChanged)(currentRecurringConfig, prevRecurringConfig, false) &&
78
- endDate != null &&
79
- totalPaymentCycles !== 0) {
80
- currentTotalPayments = (0, exports.getTotalPayments)(startDate, endDate, frequency, currentInstance);
81
- }
82
- else if (endDate == null || endDateSelectorOptionType === 'payments') {
83
- currentEndDate = (0, exports.getEndDate)(startDate, frequency, totalPaymentCycles, currentInstance);
84
- }
85
- else if (totalPaymentCycles === 0 || endDateSelectorOptionType === 'date') {
86
- currentTotalPayments = (0, exports.getTotalPayments)(startDate, endDate, frequency, currentInstance);
87
- }
88
- //editRecurringBill
89
- if (currentRecurringConfig.isActive &&
90
- currentInstances != null &&
91
- currentInstances.length !== 0 &&
92
- currentInstance != null) {
93
- const pastInstances = currentInstances.filter((bill) => bill.readonly === true);
94
- const futureTotalPayments = currentTotalPayments - pastInstances.length;
95
- const billAmountForFutureInstances = (_a = currentInstances[pastInstances.length + 1]) === null || _a === void 0 ? void 0 : _a.amount;
96
- updatedRecurringInstances = [
97
- ...pastInstances,
98
- currentInstance,
99
- ...getRecurringBillInstances(currentInstances[pastInstances.length].vendorReceiveDate, frequency, futureTotalPayments, pastInstances.length + 1, billAmountForFutureInstances !== null && billAmountForFutureInstances !== void 0 ? billAmountForFutureInstances : currentBillAmount).slice(1),
100
- ];
101
- }
102
- else {
103
- //createRecurringBill
104
- updatedRecurringInstances = getRecurringBillInstances(startDate, frequency, currentTotalPayments, 1, currentBillAmount);
105
- }
106
- return {
107
- recurringConfig: Object.assign(Object.assign({}, currentRecurringConfig), { endDate: currentEndDate, totalPaymentCycles: currentTotalPayments }),
108
- recurringInstances: updatedRecurringInstances,
109
- };
110
- };
111
- exports.updateRecurringBillDetails = updateRecurringBillDetails;
112
- const isRecurringConfigChanged = (recurringBillNewConfig, originalRecurringBillConfig, checkApprovalChange) => {
113
- const { isApprovalRequired: isApprovalRequiredNew, endDate: endDateNew, frequency: frequencyNew, totalPaymentCycles: totalPaymentCyclesNew, } = recurringBillNewConfig;
114
- const { isApprovalRequired, endDate, frequency, totalPaymentCycles } = originalRecurringBillConfig;
115
- return ((endDateNew === null || endDateNew === void 0 ? void 0 : endDateNew.toString()) !== (endDate === null || endDate === void 0 ? void 0 : endDate.toString()) ||
116
- frequencyNew !== frequency ||
117
- totalPaymentCyclesNew !== totalPaymentCycles ||
118
- (checkApprovalChange ? isApprovalRequiredNew !== isApprovalRequired : false));
119
- };
120
- exports.isRecurringConfigChanged = isRecurringConfigChanged;
121
- const getTotalPayments = (startDate, endDate, frequency, currentInstance) => {
122
- let currentStartDate = startDate;
123
- let pastPayments = 0;
124
- if ((currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.instance) != null && (currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.instance) > 1) {
125
- currentStartDate = currentInstance.vendorReceiveDate;
126
- pastPayments = currentInstance.instance - 1;
127
- }
128
- let totalPayments = 0;
129
- const offSetValue = getRecurringFrequencyInDays(frequency);
130
- totalPayments = endDate.diff(currentStartDate, 'day') / offSetValue;
131
- return Math.floor(totalPayments + pastPayments) + 1; //+1 to include startDate
132
- };
133
- exports.getTotalPayments = getTotalPayments;
134
- const getEndDate = (startDate, frequency, totalPayments, currentInstance) => {
135
- let currentStartDate = startDate;
136
- let endDate = currentStartDate;
137
- let currentTotalPayments = totalPayments;
138
- if ((currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.instance) != null && (currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.instance) > 1) {
139
- currentStartDate = currentInstance.vendorReceiveDate;
140
- currentTotalPayments = totalPayments - currentInstance.instance + 1;
141
- }
142
- const offSetValue = getRecurringFrequencyInDays(frequency);
143
- endDate = currentStartDate.add(offSetValue * (currentTotalPayments - 1), 'day');
144
- return endDate;
145
- };
146
- exports.getEndDate = getEndDate;
147
- function getRecurringBillInstances(startDate, frequency, totalPayments, currentInstance, billAmount) {
148
- const updatedInstances = [];
149
- const offSetValue = getRecurringFrequencyInDays(frequency);
150
- for (let i = 0; i < totalPayments; i++) {
151
- updatedInstances.push(Object.assign({ instance: currentInstance + i, amount: billAmount }, checkIfHolidayAndGetNextDate(startDate.add(i * offSetValue, 'day'))));
152
- }
153
- return updatedInstances;
154
- }
155
- function getRecurringFrequencyInDays(frequency) {
156
- switch (frequency) {
157
- case 'weekly':
158
- return 7;
159
- case 'biweekly':
160
- return 14;
161
- case 'monthly':
162
- return 30;
163
- case 'quarterly':
164
- return 90;
165
- }
166
- }
167
- function checkIfHolidayAndGetNextDate(date) {
168
- const isHolidayMessage = 'is a holiday';
169
- let newDate = date;
170
- while ((0, workingDayHelper_1.isHoliday)(newDate.toDate()) === true) {
171
- newDate = newDate.subtract(1, 'day');
172
- }
173
- if (newDate !== date) {
174
- return {
175
- vendorReceiveDate: newDate,
176
- vendorReceiveDateNotes: `${date.format('MMM DD, YYYY')} ${isHolidayMessage}`,
177
- };
178
- }
179
- return { vendorReceiveDate: date, vendorReceiveDateNotes: '' };
180
- }
@@ -47,7 +47,6 @@ export interface ActorActivityWithUser extends Actor {
47
47
  userId: ID;
48
48
  type: string;
49
49
  subType?: string;
50
- isRecurringAutoApprove: boolean;
51
50
  }
52
51
  export interface RemiActivity {
53
52
  approvalRuleId?: ID;
@@ -2,7 +2,6 @@ import { AddressPayload } from '../../../../entity/address/addressPayload';
2
2
  import { ZeniAPIResponse } from '../../../../responsePayload';
3
3
  import { ZeniAccountsConfig, DepositProductConfig } from './zeniAccountsConfigState';
4
4
  export interface ZeniAccountsConfigPayload {
5
- apy: string | null;
6
5
  bank_name: string;
7
6
  deposit_product_config: DepositProductConfigPayload;
8
7
  mailing_address: AddressPayload;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mapDepositProductConfigPayloadToDepositProductConfig = exports.mapZeniAccountsConfigPayloadToZeniAccountsConfigState = void 0;
4
4
  const mapZeniAccountsConfigPayloadToZeniAccountsConfigState = (payload) => ({
5
- annualPercentageYield: payload.apy != null ? payload.apy : '',
6
5
  bankName: payload.bank_name,
7
6
  mailingAddressId: payload.mailing_address.address_id,
8
7
  bankAddressId: payload.bank_address.address_id,
@@ -6,7 +6,6 @@ const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const zeniAccountsConfigPayload_1 = require("./zeniAccountsConfigPayload");
7
7
  exports.initialState = {
8
8
  zeniAccountsConfig: {
9
- annualPercentageYield: '',
10
9
  bankName: '',
11
10
  mailingAddressId: '',
12
11
  bankAddressId: '',
@@ -29,9 +28,8 @@ const zeniAccountsConfig = (0, toolkit_1.createSlice)({
29
28
  draft.error = undefined;
30
29
  },
31
30
  updateZeniAccountsConfigSuccess(draft, action) {
32
- const { bankName, mailingAddressId, bankAddressId, depositProductConfig, annualPercentageYield, } = (0, zeniAccountsConfigPayload_1.mapZeniAccountsConfigPayloadToZeniAccountsConfigState)(action.payload);
31
+ const { bankName, mailingAddressId, bankAddressId, depositProductConfig } = (0, zeniAccountsConfigPayload_1.mapZeniAccountsConfigPayloadToZeniAccountsConfigState)(action.payload);
33
32
  draft.zeniAccountsConfig = {
34
- annualPercentageYield,
35
33
  bankName,
36
34
  mailingAddressId,
37
35
  bankAddressId,
@@ -4,7 +4,6 @@ import { RootState } from '../../../../reducer';
4
4
  import { DepositProductConfig } from './zeniAccountsConfigState';
5
5
  export interface ZeniAccountsConfigSelectorView extends SelectorView {
6
6
  zeniAccountsConfigDetail: {
7
- annualPercentageYield: string;
8
7
  bankName: string;
9
8
  depositProductConfig: DepositProductConfig;
10
9
  mailingAddress?: Address;
@@ -4,12 +4,11 @@ exports.getZeniAccountsConfigDetail = void 0;
4
4
  const addressSelector_1 = require("../../../../entity/address/addressSelector");
5
5
  const getZeniAccountsConfigDetail = (state) => {
6
6
  const { zeniAccountsConfigState, addressState } = state;
7
- const { bankName, depositProductConfig, bankAddressId, mailingAddressId, annualPercentageYield, } = zeniAccountsConfigState.zeniAccountsConfig;
7
+ const { bankName, depositProductConfig, bankAddressId, mailingAddressId } = zeniAccountsConfigState.zeniAccountsConfig;
8
8
  const mailingAddress = (0, addressSelector_1.getAddressByAddressId)(addressState, mailingAddressId);
9
9
  const bankAddress = (0, addressSelector_1.getAddressByAddressId)(addressState, bankAddressId);
10
10
  return {
11
11
  zeniAccountsConfigDetail: {
12
- annualPercentageYield,
13
12
  bankName: bankName,
14
13
  depositProductConfig: depositProductConfig,
15
14
  mailingAddress,
@@ -3,7 +3,6 @@ export interface ZeniAccountsConfigState extends FetchedState {
3
3
  zeniAccountsConfig: ZeniAccountsConfig;
4
4
  }
5
5
  export interface ZeniAccountsConfig {
6
- annualPercentageYield: string;
7
6
  bankName: string;
8
7
  mailingAddressId: ID;
9
8
  bankAddressId: ID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.7.72",
3
+ "version": "4.7.74",
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",
@@ -26,7 +26,7 @@
26
26
  "homepage": "https://github.com/zeni-ai/client-epic-state#readme",
27
27
  "devDependencies": {
28
28
  "@types/chai": "^4.2.11",
29
- "@types/jest": "^29.4.0",
29
+ "@types/jest": "^27.0.1",
30
30
  "@types/lodash": "^4.14.178",
31
31
  "@types/node": "^17.0.34",
32
32
  "@types/url-parse": "^1.4.8",
@@ -37,10 +37,10 @@
37
37
  "concurrently": "^6.3.0",
38
38
  "eslint": "^7.9.0",
39
39
  "eslint-config-prettier": "^8.3.0",
40
- "jest": "^29.4.3",
40
+ "jest": "^27.2.0",
41
41
  "prettier": "^2.3.2",
42
42
  "rimraf": "^3.0.2",
43
- "ts-jest": "^29.0.5",
43
+ "ts-jest": "^27.1.3",
44
44
  "ts-prune": "^0.10.3",
45
45
  "ts-unused-exports": "^10.0.1",
46
46
  "typescript": "^4.6.2"
@@ -48,7 +48,6 @@
48
48
  "dependencies": {
49
49
  "@reduxjs/toolkit": "^1.6.2",
50
50
  "cross-fetch": "^3.1.2",
51
- "date-holidays": "^3.23.8",
52
51
  "dayjs": "^1.10.7",
53
52
  "dayjs-business-time": "^1.0.4",
54
53
  "js-base64": "^3.6.0",
@@ -1,34 +0,0 @@
1
- import { BillStage } from '../billTransaction/billTransactionState';
2
- import { RecurringBillConfig, RecurringBillData, RecurringBillFrequency } from './recurringBillsState';
3
- export interface RecurringBillConfigBasePayload {
4
- is_approval_required: boolean;
5
- start_date: string;
6
- end_date: string;
7
- frequency: RecurringBillFrequency;
8
- total_payment_cycles: number;
9
- sync_token: string;
10
- }
11
- export interface RecurringBillConfigResponsePayload extends RecurringBillConfigBasePayload {
12
- recurring_bill_config_id: string;
13
- is_active: boolean;
14
- sync_token: string;
15
- }
16
- export interface RecurringBillConfigBodyPayload extends Omit<RecurringBillConfigBasePayload, 'total_payment_cycles' | 'sync_token'> {
17
- recurring_bill_config_id?: string;
18
- total_payment_cycles?: number;
19
- future_total_payment_cycles?: number;
20
- sync_token: string | null;
21
- }
22
- export declare const toRecurringBillConfig: (payload: RecurringBillConfigResponsePayload) => RecurringBillConfig;
23
- export interface RecurringBillDataPayload {
24
- recurring_bill_config_id: string;
25
- stage: BillStage;
26
- amount: number;
27
- instance: number;
28
- payment_date: string;
29
- vendor_receive_date: string;
30
- vendor_receive_date_notes: string;
31
- transaction_id?: string | null;
32
- }
33
- export declare const toRecurringBillData: (payload: RecurringBillDataPayload) => RecurringBillData;
34
- export declare const toRecurringConfigPayload: (recurringConfig: Partial<RecurringBillConfig>) => Partial<RecurringBillConfigBodyPayload>;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toRecurringConfigPayload = exports.toRecurringBillData = exports.toRecurringBillConfig = void 0;
4
- const zeniDayJS_1 = require("../../../zeniDayJS");
5
- const toRecurringBillConfig = (payload) => ({
6
- id: payload.recurring_bill_config_id,
7
- isApprovalRequired: payload.is_approval_required,
8
- startDate: (0, zeniDayJS_1.date)(payload.start_date),
9
- endDate: (0, zeniDayJS_1.date)(payload.end_date),
10
- frequency: payload.frequency,
11
- totalPaymentCycles: payload.total_payment_cycles,
12
- isActive: payload.is_active,
13
- syncToken: payload.sync_token,
14
- });
15
- exports.toRecurringBillConfig = toRecurringBillConfig;
16
- const toRecurringBillData = (payload) => {
17
- var _a;
18
- return ({
19
- recurringBillConfigId: payload.recurring_bill_config_id,
20
- stage: payload.stage,
21
- amount: payload.amount,
22
- instance: payload.instance,
23
- paymentDate: (0, zeniDayJS_1.date)(payload.payment_date),
24
- vendorReceiveDate: (0, zeniDayJS_1.date)(payload.vendor_receive_date),
25
- vendorReceiveDateNotes: payload.vendor_receive_date_notes,
26
- transactionId: (_a = payload.transaction_id) !== null && _a !== void 0 ? _a : undefined,
27
- });
28
- };
29
- exports.toRecurringBillData = toRecurringBillData;
30
- const toRecurringConfigPayload = (recurringConfig) => {
31
- var _a, _b;
32
- const recurringConfigPayload = {
33
- is_approval_required: recurringConfig.isApprovalRequired,
34
- start_date: (_a = recurringConfig.startDate) === null || _a === void 0 ? void 0 : _a.format('YYYY-MM-DD'),
35
- end_date: (_b = recurringConfig.endDate) === null || _b === void 0 ? void 0 : _b.format('YYYY-MM-DD'),
36
- frequency: recurringConfig.frequency,
37
- total_payment_cycles: recurringConfig.totalPaymentCycles,
38
- };
39
- if (recurringConfig.id != null) {
40
- recurringConfigPayload.recurring_bill_config_id = recurringConfig.id;
41
- }
42
- return recurringConfigPayload;
43
- };
44
- exports.toRecurringConfigPayload = toRecurringConfigPayload;
@@ -1,6 +0,0 @@
1
- import { RecurringBillState } from './recurringBillsState';
2
- import { RecurringBillConfigResponsePayload, RecurringBillDataPayload } from './recurringBillsPayload';
3
- export declare const initialState: RecurringBillState;
4
- export declare const updateRecurringBillConfigs: import("@reduxjs/toolkit").ActionCreatorWithPayload<RecurringBillConfigResponsePayload[], string>, updateRecurringBills: import("@reduxjs/toolkit").ActionCreatorWithPayload<RecurringBillDataPayload[], string>, removeRecurringBill: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, clearAllRecurringBills: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
5
- declare const _default: import("@reduxjs/toolkit").Reducer<RecurringBillState, import("@reduxjs/toolkit").AnyAction>;
6
- export default _default;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearAllRecurringBills = exports.removeRecurringBill = exports.updateRecurringBills = exports.updateRecurringBillConfigs = exports.initialState = void 0;
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- const recurringBillsPayload_1 = require("./recurringBillsPayload");
7
- exports.initialState = {
8
- recurringBillDetailByConfigId: {},
9
- };
10
- const recurringBill = (0, toolkit_1.createSlice)({
11
- name: 'recurringBill',
12
- initialState: exports.initialState,
13
- reducers: {
14
- updateRecurringBillConfigs(draft, action) {
15
- action.payload.forEach((recurringBillConfigPayload) => {
16
- const currentConfig = (0, recurringBillsPayload_1.toRecurringBillConfig)(recurringBillConfigPayload);
17
- draft.recurringBillDetailByConfigId[currentConfig.id] = {
18
- recurringBillConfig: Object.assign({}, currentConfig),
19
- recurringBillInstances: [],
20
- };
21
- });
22
- },
23
- updateRecurringBills(draft, action) {
24
- action.payload.forEach((recurringBillDataPayload) => {
25
- var _a, _b;
26
- const currentBillData = (0, recurringBillsPayload_1.toRecurringBillData)(recurringBillDataPayload);
27
- const currentRecurringInstances = (_b = (_a = draft.recurringBillDetailByConfigId[currentBillData.recurringBillConfigId]) === null || _a === void 0 ? void 0 : _a.recurringBillInstances) !== null && _b !== void 0 ? _b : [];
28
- currentRecurringInstances.push(currentBillData);
29
- });
30
- },
31
- removeRecurringBill(draft, action) {
32
- delete draft.recurringBillDetailByConfigId[action.payload];
33
- },
34
- clearAllRecurringBills(draft) {
35
- draft.recurringBillDetailByConfigId = {};
36
- },
37
- },
38
- });
39
- _a = recurringBill.actions, exports.updateRecurringBillConfigs = _a.updateRecurringBillConfigs, exports.updateRecurringBills = _a.updateRecurringBills, exports.removeRecurringBill = _a.removeRecurringBill, exports.clearAllRecurringBills = _a.clearAllRecurringBills;
40
- exports.default = recurringBill.reducer;
@@ -1,33 +0,0 @@
1
- import { ID } from '../../../commonStateTypes/common';
2
- import { ZeniDate } from '../../../zeniDayJS';
3
- import { BillStage } from '../billTransaction/billTransactionState';
4
- export declare const toRecurringBillFrequency: (v: string) => "weekly" | "biweekly" | "monthly" | "quarterly";
5
- export declare const toRecurringBillFrequencyStrict: (v?: string | undefined) => "weekly" | "biweekly" | "monthly" | "quarterly" | undefined;
6
- export declare type RecurringBillFrequency = NonNullable<ReturnType<typeof toRecurringBillFrequency>>;
7
- export interface RecurringBillConfig {
8
- id: ID;
9
- isApprovalRequired: boolean;
10
- startDate: ZeniDate;
11
- endDate: ZeniDate;
12
- frequency: RecurringBillFrequency;
13
- totalPaymentCycles: number;
14
- isActive: boolean;
15
- syncToken: string;
16
- }
17
- export interface RecurringBillData {
18
- recurringBillConfigId: ID;
19
- stage: BillStage;
20
- amount: number;
21
- instance: number;
22
- paymentDate: ZeniDate;
23
- vendorReceiveDate: ZeniDate;
24
- vendorReceiveDateNotes: string;
25
- transactionId?: ID;
26
- }
27
- export interface RecurringBillDetail {
28
- recurringBillConfig: RecurringBillConfig;
29
- recurringBillInstances: RecurringBillData[];
30
- }
31
- export interface RecurringBillState {
32
- recurringBillDetailByConfigId: Record<ID, RecurringBillDetail>;
33
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toRecurringBillFrequencyStrict = exports.toRecurringBillFrequency = void 0;
4
- const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
- const ALL_RECURRING_FREQUENCY = [
6
- 'weekly',
7
- 'biweekly',
8
- 'monthly',
9
- 'quarterly',
10
- ];
11
- const toRecurringBillFrequency = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_RECURRING_FREQUENCY);
12
- exports.toRecurringBillFrequency = toRecurringBillFrequency;
13
- const toRecurringBillFrequencyStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v !== null && v !== void 0 ? v : '', ALL_RECURRING_FREQUENCY);
14
- exports.toRecurringBillFrequencyStrict = toRecurringBillFrequencyStrict;
@@ -1,22 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { fetchBankAccountsList, updateBankConnectionOnSuccess, updateBankConnectionOnFailure } from '../settingsViewReducer';
3
- import { ZeniAPI } from '../../../zeniAPI';
4
- import { RootState } from '../../../reducer';
5
- import { updateAccounts } from '../../../entity/account/accountReducer';
6
- export declare type ActionType = ReturnType<typeof fetchBankAccountsList> | ReturnType<typeof updateBankConnectionOnSuccess> | ReturnType<typeof updateBankConnectionOnFailure> | ReturnType<typeof updateAccounts>;
7
- export declare const fetchBankAccountsListEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
8
- payload: undefined;
9
- type: string;
10
- } | {
11
- payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
12
- type: string;
13
- } | {
14
- payload: {
15
- bankAccountIds: string[];
16
- };
17
- type: string;
18
- } | import("@reduxjs/toolkit").PayloadAction<import("../../../entity/account/accountPayload").AccountPayload[], string, {
19
- reportId: import("../../..").ReportIDPlusForecastID;
20
- classesViewParentId: import("../../../commonStateTypes/classesView/nestedClassID").ClassesViewParentID | undefined;
21
- updateType: import("../../..").UpdateType;
22
- }, never>>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchBankAccountsListEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const settingsViewReducer_1 = require("../settingsViewReducer");
7
- const responsePayload_1 = require("../../../responsePayload");
8
- const accountReducer_1 = require("../../../entity/account/accountReducer");
9
- const fetchBankAccountsListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchBankAccountsList.match), (0, operators_1.switchMap)(() => {
10
- const queryValue = {
11
- is_full: true,
12
- is_exclude_account_payable_accounts: true,
13
- is_exclude_account_receivable_accounts: true,
14
- account_types: ['bank'],
15
- };
16
- const URL = `${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounts?query=${encodeURIComponent(JSON.stringify(queryValue))}`;
17
- return zeniAPI.getJSON(URL).pipe((0, operators_1.mergeMap)((response) => {
18
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
19
- const bankAccountIds = response.data.accounts.map((account) => account.account_id);
20
- const updateActions = [];
21
- updateActions.push((0, settingsViewReducer_1.updateBankConnectionOnSuccess)({ bankAccountIds }), (0, accountReducer_1.updateAccounts)(response.data.accounts, 'bill_pay'));
22
- return (0, rxjs_1.of)(...updateActions);
23
- }
24
- else {
25
- return (0, rxjs_1.of)((0, settingsViewReducer_1.updateBankConnectionOnFailure)(response.status));
26
- }
27
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.updateBankConnectionOnFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Fetch Bank Accounts REST API call errored out' +
28
- JSON.stringify(error))))));
29
- }));
30
- exports.fetchBankAccountsListEpic = fetchBankAccountsListEpic;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { fetchBankConnectionsView, fetchBankAccountsList } from '../settingsViewReducer';
4
- import { getPaymentAccounts } from '../../spendManagement/commonSetup/setupViewReducer';
5
- export declare type ActionType = ReturnType<typeof fetchBankConnectionsView> | ReturnType<typeof fetchBankAccountsList> | ReturnType<typeof getPaymentAccounts>;
6
- export declare const fetchBankConnectionsViewEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchBankConnectionsViewEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const settingsViewReducer_1 = require("../settingsViewReducer");
7
- const setupViewReducer_1 = require("../../spendManagement/commonSetup/setupViewReducer");
8
- const fetchBankConnectionsViewEpic = (actions$) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchBankConnectionsView.match), (0, operators_1.switchMap)(() => {
9
- return (0, rxjs_1.from)([
10
- (0, settingsViewReducer_1.fetchBankAccountsList)(),
11
- (0, setupViewReducer_1.getPaymentAccounts)('bill_pay', false),
12
- ]);
13
- }));
14
- exports.fetchBankConnectionsViewEpic = fetchBankConnectionsViewEpic;
@@ -1,43 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { fetchMyProfile, updateMyProfileOnSuccess, updateMyProfileOnFailure } from '../settingsViewReducer';
3
- import { ZeniAPI } from '../../../zeniAPI';
4
- import { UserPayload } from '../../../entity/user/userPayload';
5
- import { RootState } from '../../../reducer';
6
- import { updateUserRoles } from '../../../entity/userRole/userRoleReducer';
7
- import { updateAllUsers } from '../../../entity/user/userReducer';
8
- import { updateUserIds } from '../../userListView/userListViewReducer';
9
- import { UserRolePayload } from '../../../entity/userRole/userRolePayload';
10
- import { ID } from '../../../commonStateTypes/common';
11
- export declare type ActionType = ReturnType<typeof fetchMyProfile> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateMyProfileOnSuccess> | ReturnType<typeof updateUserIds> | ReturnType<typeof updateMyProfileOnFailure>;
12
- export declare const fetchMyProfileEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
13
- payload: undefined;
14
- type: string;
15
- } | {
16
- payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
17
- type: string;
18
- } | {
19
- payload: {
20
- users: UserPayload[];
21
- updateType?: import("../../../commonStateTypes/common").UpdateType | undefined;
22
- };
23
- type: string;
24
- } | {
25
- payload: UserRolePayload[];
26
- type: string;
27
- } | {
28
- payload: {
29
- userType: import("../../userListView/userListViewState").UserListType;
30
- usersPayload: UserPayload[];
31
- };
32
- type: string;
33
- } | {
34
- payload: {
35
- userId: string;
36
- };
37
- type: string;
38
- }>;
39
- /**
40
- * Helpers
41
- */
42
- export declare function getUserPayloadByUserId(userId: ID | undefined, usersPayload: UserPayload[]): UserPayload[] | undefined;
43
- export declare function getManagerUserIdFromUserRolesPayloadByUserId(userId: ID | undefined, userRolesPayload: UserRolePayload[]): ID | undefined;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getManagerUserIdFromUserRolesPayloadByUserId = exports.getUserPayloadByUserId = exports.fetchMyProfileEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const settingsViewReducer_1 = require("../settingsViewReducer");
7
- const responsePayload_1 = require("../../../responsePayload");
8
- const userRoleReducer_1 = require("../../../entity/userRole/userRoleReducer");
9
- const userReducer_1 = require("../../../entity/user/userReducer");
10
- const userListViewReducer_1 = require("../../userListView/userListViewReducer");
11
- const fetchMyProfileEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchMyProfile.match), (0, operators_1.switchMap)(() => {
12
- const URL = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/settings/user-profile`;
13
- const loggedInUser = state$.value.tenantState.loggedInUser;
14
- return zeniAPI.getJSON(URL).pipe((0, operators_1.mergeMap)((response) => {
15
- if ((0, responsePayload_1.isSuccessResponse)(response) &&
16
- response.data != null &&
17
- (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.userId) != null) {
18
- const loggedInUserPayload = getUserPayloadByUserId(loggedInUser.userId, response.data.users);
19
- const managerUserPayload = getUserPayloadByUserId(getManagerUserIdFromUserRolesPayloadByUserId(loggedInUser.userId, response.data.user_roles), response.data.users);
20
- const updateActions = [];
21
- updateActions.push((0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, settingsViewReducer_1.updateMyProfileOnSuccess)(loggedInUser.userId));
22
- if (managerUserPayload && loggedInUserPayload != null) {
23
- updateActions.push((0, userListViewReducer_1.updateUserIds)({
24
- userType: 'manager',
25
- usersPayload: managerUserPayload,
26
- }));
27
- }
28
- return (0, rxjs_1.of)(...updateActions);
29
- }
30
- else {
31
- return (0, rxjs_1.of)((0, settingsViewReducer_1.updateMyProfileOnFailure)(response.status));
32
- }
33
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.updateMyProfileOnFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Fetch My Profile REST API call errored out' +
34
- JSON.stringify(error))))));
35
- }));
36
- exports.fetchMyProfileEpic = fetchMyProfileEpic;
37
- /**
38
- * Helpers
39
- */
40
- function getUserPayloadByUserId(userId, usersPayload) {
41
- const user = usersPayload.find((user) => user.user_id === userId);
42
- return user ? [user] : undefined;
43
- }
44
- exports.getUserPayloadByUserId = getUserPayloadByUserId;
45
- function getManagerUserIdFromUserRolesPayloadByUserId(userId, userRolesPayload) {
46
- const userRoles = userRolesPayload.find((user) => user.user_id === userId);
47
- const manager_user_id = userRoles === null || userRoles === void 0 ? void 0 : userRoles.manager_user_id;
48
- return manager_user_id !== null && manager_user_id !== void 0 ? manager_user_id : undefined;
49
- }
50
- exports.getManagerUserIdFromUserRolesPayloadByUserId = getManagerUserIdFromUserRolesPayloadByUserId;
@@ -1,7 +0,0 @@
1
- import { ActionsObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { fetchMyProfile } from '../settingsViewReducer';
4
- import { fetchCompanyPassportView } from '../../companyView/companyViewReducer';
5
- import { fetchClassList } from '../../classList/classListReducer';
6
- export declare type ActionType = ReturnType<typeof fetchCompanyPassportView> | ReturnType<typeof fetchMyProfile> | ReturnType<typeof fetchClassList>;
7
- export declare const fetchMyProfileViewEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;