@zeniai/client-epic-state 4.11.32 → 4.11.33

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 (51) hide show
  1. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  2. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  3. package/lib/entity/account/accountState.d.ts +1 -1
  4. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  5. package/lib/entity/class/classReducer.d.ts +4 -4
  6. package/lib/entity/class/classState.d.ts +1 -1
  7. package/lib/entity/forecast/forecastState.d.ts +1 -1
  8. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  9. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  10. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  11. package/lib/entity/user/userSelector.js +7 -2
  12. package/lib/epic.d.ts +2 -1
  13. package/lib/epic.js +2 -1
  14. package/lib/index.d.ts +3 -3
  15. package/lib/index.js +19 -18
  16. package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
  17. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  18. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  19. package/lib/view/cardPayment/cardPaymentViewReducer.js +5 -4
  20. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  21. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  22. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  23. package/lib/view/companyView/selector/companyManagementViewSelector.js +47 -27
  24. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  25. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  26. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  27. package/lib/view/people/peopleSelector.js +2 -2
  28. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  29. package/lib/view/settingsView/epic/fetchBillingAccountsViewEpic.d.ts +7 -0
  30. package/lib/view/settingsView/epic/fetchBillingAccountsViewEpic.js +15 -0
  31. package/lib/view/settingsView/settingsViewReducer.d.ts +1 -1
  32. package/lib/view/settingsView/settingsViewReducer.js +5 -2
  33. package/lib/view/settingsView/settingsViewSelector.d.ts +2 -1
  34. package/lib/view/settingsView/settingsViewSelector.js +18 -3
  35. package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +5 -0
  36. package/lib/view/spendManagement/billPay/billList/billListSelector.d.ts +2 -1
  37. package/lib/view/spendManagement/billPay/billList/billListSelector.js +126 -67
  38. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +1 -1
  39. package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +4 -0
  40. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +4 -4
  41. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +2 -1
  42. package/lib/view/spendManagement/commonSetup/setupViewState.js +3 -2
  43. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/getPaymentAccountsEpic.js +10 -3
  44. package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +3 -2
  45. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +11 -11
  46. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +9 -2
  47. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
  48. package/lib/view/spendManagement/zeniAccounts/zeniAccountList/fetchZeniAccountListPageEpic.js +4 -2
  49. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  50. package/lib/view/topEx/topExSelector.d.ts +1 -1
  51. package/package.json +2 -2
@@ -100,21 +100,7 @@ const getBillList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
100
100
  }
101
101
  break;
102
102
  }
103
- const bulkSubmissionFetchState = billsBulkActionViewState.bulkSubmissionFetchState.fetchState;
104
- let isRecurringBillInBulkActionList = false;
105
- let billListBulkActionInfo = {
106
- isBulkActionAllowed: false,
107
- billsSelectedForBulkAction: [],
108
- allowedBulkActions: [],
109
- bulkSubmissionFetchState,
110
- isRecurringBillInBulkActionList,
111
- };
112
- let firstBillInBulkList = undefined;
113
- const isBulkActionAllowed = isBulkActionFeatureEnabled
114
- ? (0, exports.checkIfBulkActionAllowed)(billListState.currentTab, billListState.currentSubTab)
115
- : false;
116
103
  let transactionsView = transactions.map((transaction) => {
117
- var _a, _b;
118
104
  let approvers = {
119
105
  users: [],
120
106
  attributes: [],
@@ -128,51 +114,10 @@ const getBillList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
128
114
  recurringBillDetail = (0, get_1.default)(recurringBillState.recurringBillDetailByConfigId, transaction.recurringBillConfigId, undefined);
129
115
  }
130
116
  const recurringBillConfig = recurringBillDetail === null || recurringBillDetail === void 0 ? void 0 : recurringBillDetail.recurringBillConfig;
131
- let billBulkSelectInfo;
132
- if (isBulkActionAllowed) {
133
- const isProcessing = (0, helpers_1.isBillProcessing)((_a = transaction.bulkProcessingDetail) === null || _a === void 0 ? void 0 : _a.type);
134
- const isError = ((_b = transaction.bulkProcessingDetail) === null || _b === void 0 ? void 0 : _b.type) === 'error';
135
- const isBookClosedForBill = transaction.bookCloseDate != null &&
136
- transaction.date.isBefore(transaction.bookCloseDate);
137
- const { isSelectableForBulkAction, bulkSelectExceptionInfo } = isProcessing || isError
138
- ? {
139
- isSelectableForBulkAction: false,
140
- bulkSelectExceptionInfo: undefined,
141
- }
142
- : isBillSelectableForBulkAction(transaction, billListState.currentTab, isBookClosedForBill, firstBillInBulkList);
143
- if (isBulkActionAllowed &&
144
- billsBulkActionViewState.billsSelectedForBulkAction.includes(transaction.id)) {
145
- if (isRecurring) {
146
- isRecurringBillInBulkActionList = true;
147
- }
148
- }
149
- billBulkSelectInfo = {
150
- isSelectableForBulkAction,
151
- bulkSelectExceptionInfo,
152
- };
153
- }
154
117
  return Object.assign(Object.assign({}, transaction), { approvers,
155
118
  isRecurring,
156
- billBulkSelectInfo,
157
119
  recurringBillConfig });
158
120
  });
159
- if (isBulkActionAllowed) {
160
- const billsSelectedForBulkAction = billsBulkActionViewState.billsSelectedForBulkAction;
161
- firstBillInBulkList = (0, get_1.default)(billTransactionState.transactionById, billsSelectedForBulkAction[0], undefined);
162
- const allBulkBillsAwaitingMyApproval = (0, difference_1.default)(billsSelectedForBulkAction, pendingApprovalTransactionIDs)
163
- .length === 0;
164
- const allowedBulkActions = isBulkActionAllowed
165
- ? (0, exports.getAllowedBulkActions)(billListState.currentTab, billListState.currentSubTab, allBulkBillsAwaitingMyApproval, (firstBillInBulkList === null || firstBillInBulkList === void 0 ? void 0 : firstBillInBulkList.billPayInfo.billPaymentStatus.code) ===
166
- 'processing')
167
- : [];
168
- billListBulkActionInfo = {
169
- isBulkActionAllowed,
170
- billsSelectedForBulkAction,
171
- allowedBulkActions,
172
- bulkSubmissionFetchState,
173
- isRecurringBillInBulkActionList,
174
- };
175
- }
176
121
  transactionsView = (0, spendManagementFilterHelpers_1.applyAdvancedFiltersOnList)('bill_pay', transactionsView, billListState.filters);
177
122
  const TransactionsPendingForMyApprovalLength = pendingApprovalTransactionIDs.length;
178
123
  const fetchState = (_f = (_e = billListState.byBillListKey[key]) === null || _e === void 0 ? void 0 : _e.fetchState) !== null && _f !== void 0 ? _f : 'Not-Started';
@@ -195,6 +140,73 @@ const getBillList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
195
140
  ((_c = transaction.documentId) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes(loweredSearchText)) ===
196
141
  true);
197
142
  }));
143
+ //BulkActions
144
+ const bulkSubmissionFetchState = billsBulkActionViewState.bulkSubmissionFetchState.fetchState;
145
+ let isRecurringBillInBulkActionList = false;
146
+ let isBookClosedForAnySelectedBill = false;
147
+ let billListBulkActionInfo = {
148
+ isBulkActionAllowed: false,
149
+ billsSelectedForBulkAction: [],
150
+ allowedBulkActions: [],
151
+ bulkSubmissionFetchState,
152
+ isRecurringBillInBulkActionList,
153
+ };
154
+ const billsSelectedForBulkAction = billsBulkActionViewState.billsSelectedForBulkAction;
155
+ const firstBillInBulkList = (0, get_1.default)(billTransactionState.transactionById, billsSelectedForBulkAction[0], undefined);
156
+ const isBulkActionAllowed = isBulkActionFeatureEnabled
157
+ ? (0, exports.checkIfBulkActionAllowed)(billListState.currentTab, billListState.currentSubTab)
158
+ : false;
159
+ let firstSelectableBill = undefined;
160
+ if (isBulkActionAllowed) {
161
+ transactionsView = transactionsView.map((transaction) => {
162
+ var _a, _b;
163
+ let billBulkSelectInfo;
164
+ if (isBulkActionAllowed) {
165
+ const isProcessing = (0, helpers_1.isBillProcessing)((_a = transaction.bulkProcessingDetail) === null || _a === void 0 ? void 0 : _a.type);
166
+ const isError = ((_b = transaction.bulkProcessingDetail) === null || _b === void 0 ? void 0 : _b.type) === 'error';
167
+ const isBookClosedForBill = transaction.bookCloseDate != null &&
168
+ transaction.date.isBefore(transaction.bookCloseDate);
169
+ const { isSelectableForBulkAction, isSelectableForBulkActionSelectAll, bulkSelectExceptionInfo, } = isProcessing || isError
170
+ ? {
171
+ isSelectableForBulkAction: false,
172
+ isSelectableForBulkActionSelectAll: false,
173
+ bulkSelectExceptionInfo: undefined,
174
+ }
175
+ : isBillSelectableForBulkAction(transaction, billListState.currentTab, isBookClosedForBill, pendingApprovalTransactionIDs.includes(transaction.id), firstSelectableBill, firstBillInBulkList);
176
+ if (isBulkActionAllowed &&
177
+ billsBulkActionViewState.billsSelectedForBulkAction.includes(transaction.id)) {
178
+ if (transaction.isRecurring) {
179
+ isRecurringBillInBulkActionList = true;
180
+ }
181
+ if (isBookClosedForBill) {
182
+ isBookClosedForAnySelectedBill = true;
183
+ }
184
+ }
185
+ if (firstSelectableBill == null && isSelectableForBulkAction) {
186
+ firstSelectableBill = transaction;
187
+ }
188
+ billBulkSelectInfo = {
189
+ isSelectableForBulkAction,
190
+ isSelectableForBulkActionSelectAll,
191
+ bulkSelectExceptionInfo,
192
+ };
193
+ }
194
+ return Object.assign(Object.assign({}, transaction), { billBulkSelectInfo });
195
+ });
196
+ const allBulkBillsAwaitingMyApproval = (0, difference_1.default)(billsSelectedForBulkAction, pendingApprovalTransactionIDs)
197
+ .length === 0;
198
+ const allowedBulkActions = isBulkActionAllowed
199
+ ? (0, exports.getAllowedBulkActions)(billListState.currentTab, billListState.currentSubTab, allBulkBillsAwaitingMyApproval, (firstBillInBulkList === null || firstBillInBulkList === void 0 ? void 0 : firstBillInBulkList.billPayInfo.billPaymentStatus.code) ===
200
+ 'processing', isBookClosedForAnySelectedBill, isRecurringBillInBulkActionList)
201
+ : [];
202
+ billListBulkActionInfo = {
203
+ isBulkActionAllowed,
204
+ billsSelectedForBulkAction,
205
+ allowedBulkActions,
206
+ bulkSubmissionFetchState,
207
+ isRecurringBillInBulkActionList,
208
+ };
209
+ }
198
210
  const isDownloadEnabled = (0, spendManagementFilterHelpers_1.isBillListDownloadable)(state, currentTimePeriod);
199
211
  const billBulkSubmissionLimit = billPayConfigState.billBulkSubmissionLimit;
200
212
  return {
@@ -506,28 +518,66 @@ const checkIfBulkActionAllowed = (selectedTab, selectedSubTab) => {
506
518
  return true;
507
519
  };
508
520
  exports.checkIfBulkActionAllowed = checkIfBulkActionAllowed;
509
- const isBillSelectableForBulkAction = (bill, selectedTab, isBookClosedForBill, firstBillSelected) => {
521
+ const isBillSelectableForBulkAction = (bill, selectedTab, isBookClosedForBill, isAwaitingMyApproval, firstSelectableBill, firstBillSelected) => {
510
522
  const result = {
511
523
  isSelectableForBulkAction: true,
524
+ isSelectableForBulkActionSelectAll: true,
512
525
  bulkSelectExceptionInfo: undefined,
513
526
  };
514
- if (isBookClosedForBill && selectedTab !== 'draft') {
515
- return {
516
- isSelectableForBulkAction: false,
517
- bulkSelectExceptionInfo: 'bookCloseDateProcessing',
518
- };
527
+ if (isBookClosedForBill) {
528
+ if (selectedTab === 'scheduled' ||
529
+ (selectedTab === 'pending_approval' && !isAwaitingMyApproval)) {
530
+ return {
531
+ isSelectableForBulkAction: false,
532
+ isSelectableForBulkActionSelectAll: false,
533
+ bulkSelectExceptionInfo: 'bookCloseDateProcessing',
534
+ };
535
+ }
519
536
  }
520
537
  if (selectedTab === 'scheduled') {
538
+ //for cases where user attempts select all on scheduled tab
539
+ if (firstBillSelected == null && firstSelectableBill != null) {
540
+ if (firstSelectableBill.billPayInfo.billPaymentStatus.code === 'processing') {
541
+ if (bill.isRecurring &&
542
+ Boolean(firstSelectableBill.isRecurring) === false) {
543
+ return {
544
+ isSelectableForBulkAction: true,
545
+ isSelectableForBulkActionSelectAll: false,
546
+ bulkSelectExceptionInfo: undefined,
547
+ };
548
+ }
549
+ if (bill.billPayInfo.billPaymentStatus.code !== 'processing') {
550
+ return {
551
+ isSelectableForBulkAction: true,
552
+ isSelectableForBulkActionSelectAll: false,
553
+ bulkSelectExceptionInfo: undefined,
554
+ };
555
+ }
556
+ }
557
+ if (bill.billPayInfo.billPaymentStatus.code === 'processing') {
558
+ if (firstSelectableBill.billPayInfo.billPaymentStatus.code !==
559
+ 'processing') {
560
+ return {
561
+ isSelectableForBulkAction: true,
562
+ isSelectableForBulkActionSelectAll: false,
563
+ bulkSelectExceptionInfo: undefined,
564
+ };
565
+ }
566
+ }
567
+ }
521
568
  if ((firstBillSelected === null || firstBillSelected === void 0 ? void 0 : firstBillSelected.billPayInfo.billPaymentStatus.code) === 'processing') {
522
- if (bill.isRecurring) {
569
+ if (bill.isRecurring &&
570
+ Boolean(firstBillSelected === null || firstBillSelected === void 0 ? void 0 : firstBillSelected.isRecurring) === false) {
523
571
  return {
524
572
  isSelectableForBulkAction: false,
573
+ isSelectableForBulkActionSelectAll: true,
525
574
  bulkSelectExceptionInfo: 'cancelRecurring',
526
575
  };
527
576
  }
528
577
  if (bill.billPayInfo.billPaymentStatus.code !== 'processing') {
529
578
  return {
530
579
  isSelectableForBulkAction: false,
580
+ isSelectableForBulkActionSelectAll: true,
531
581
  bulkSelectExceptionInfo: 'processingSelectTogether',
532
582
  };
533
583
  }
@@ -537,6 +587,7 @@ const isBillSelectableForBulkAction = (bill, selectedTab, isBookClosedForBill, f
537
587
  if (firstBillSelected.billPayInfo.billPaymentStatus.code !== 'processing') {
538
588
  return {
539
589
  isSelectableForBulkAction: false,
590
+ isSelectableForBulkActionSelectAll: true,
540
591
  bulkSelectExceptionInfo: 'processingWithOthers',
541
592
  };
542
593
  }
@@ -544,7 +595,7 @@ const isBillSelectableForBulkAction = (bill, selectedTab, isBookClosedForBill, f
544
595
  }
545
596
  return result;
546
597
  };
547
- const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing) => {
598
+ const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing, isBookClosedForAnySelectedBill, isRecurringBillInBulkActionList) => {
548
599
  switch (selectedTab) {
549
600
  case 'draft':
550
601
  return ['send_for_approval', 'delete'];
@@ -553,11 +604,16 @@ const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyAppro
553
604
  case 'all':
554
605
  case 'awaiting_approval':
555
606
  case 'overdue':
556
- return isAllAwaitingMyApproval
557
- ? ['approve', 'reject', 'delete']
558
- : ['delete'];
607
+ if (isAllAwaitingMyApproval) {
608
+ return isBookClosedForAnySelectedBill
609
+ ? ['approve', 'reject']
610
+ : ['approve', 'reject', 'delete'];
611
+ }
612
+ return isBookClosedForAnySelectedBill ? [] : ['delete'];
559
613
  case 'awaiting_my_approval':
560
- return ['approve', 'reject', 'delete'];
614
+ return isBookClosedForAnySelectedBill
615
+ ? ['approve', 'reject']
616
+ : ['approve', 'reject', 'delete'];
561
617
  case 'rejected':
562
618
  return ['delete'];
563
619
  default:
@@ -567,6 +623,9 @@ const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyAppro
567
623
  case 'scheduled': {
568
624
  switch (selectedSubTab) {
569
625
  case 'all':
626
+ if (isRecurringBillInBulkActionList) {
627
+ return ['delete'];
628
+ }
570
629
  return isFirstBillProcessing ? ['cancel'] : ['delete'];
571
630
  case 'failed':
572
631
  case 'cancelled':
@@ -43,7 +43,7 @@ const getChargeCardListView = (state, includeCreditAccountAndCashbackInfo) => {
43
43
  var _a, _b, _c, _d, _e;
44
44
  switch (sortKey) {
45
45
  case 'owner':
46
- return ((_c = `${(_a = card.cardHolderUser) === null || _a === void 0 ? void 0 : _a.firstName.toLowerCase()} ${(_b = card.cardHolderUser) === null || _b === void 0 ? void 0 : _b.lastName.toLowerCase()}`) !== null && _c !== void 0 ? _c : '');
46
+ return ((_c = `${(_a = card.cardHolderUser) === null || _a === void 0 ? void 0 : _a.firstName.toLowerCase().trim()} ${(_b = card.cardHolderUser) === null || _b === void 0 ? void 0 : _b.lastName.toLowerCase().trim()}`) !== null && _c !== void 0 ? _c : '');
47
47
  case 'cardName':
48
48
  return card.cardName.toLowerCase();
49
49
  case 'department':
@@ -244,5 +244,9 @@ const getBussinessVerificationForFeature = (setupViewType) => {
244
244
  return 'deposit_accounts';
245
245
  case 'bill_pay':
246
246
  return 'bill_pay';
247
+ //whenever a new setup view type is added, add the corresponding feature here
248
+ case 'billing':
249
+ console.warn(`Invalid type for setup view`);
250
+ return '';
247
251
  }
248
252
  };
@@ -4,13 +4,13 @@ import { ZeniAPIStatus } from '../../../responsePayload';
4
4
  import { CompanyOfficerType } from '../../companyView/types/companyPassport/companyUsersLocalData';
5
5
  import { SetupViewLocalData, SetupViewState } from './setupViewState';
6
6
  export declare const initialState: SetupViewState;
7
- export declare const enableSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards"], {
7
+ export declare const enableSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing"], {
8
8
  companyId: string;
9
- setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards";
10
- }, string, never, never>, enableSetupSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, enableSetupFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, string, never, never>, updateBusinessVerificationDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, officerType: "Officer_2" | "Officer_1" | "Officer_3" | "Officer_4" | "Officer_5" | "Officer_6" | "Officer_7" | "Officer_8" | "Officer_9" | "Officer_10", setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards", sendForVerification?: any, fromBillListScreen?: any, isSubmittingAdditionalDocuments?: any], {
9
+ setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
10
+ }, string, never, never>, enableSetupSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, enableSetupFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, string, never, never>, updateBusinessVerificationDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, officerType: "Officer_2" | "Officer_1" | "Officer_3" | "Officer_4" | "Officer_5" | "Officer_6" | "Officer_7" | "Officer_8" | "Officer_9" | "Officer_10", setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing", sendForVerification?: any, fromBillListScreen?: any, isSubmittingAdditionalDocuments?: any], {
11
11
  companyId: string;
12
12
  officerType: "Officer_2" | "Officer_1" | "Officer_3" | "Officer_4" | "Officer_5" | "Officer_6" | "Officer_7" | "Officer_8" | "Officer_9" | "Officer_10";
13
- setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards";
13
+ setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
14
14
  sendForVerification: any;
15
15
  fromBillListScreen: any;
16
16
  isSubmittingAdditionalDocuments: any;
@@ -4,7 +4,8 @@ import { AllowedValueWithCode } from '../../../commonStateTypes/allowedValue';
4
4
  import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
5
5
  import { AllowedDocumentType } from '../../../entity/file/fileState';
6
6
  import { CompanyOfficerType } from '../../companyView/types/companyPassport/companyUsersLocalData';
7
- export declare const toSetupViewType: (v: string) => "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards";
7
+ export declare const SETUP_VIEW_TYPES: readonly ["billing"];
8
+ export declare const toSetupViewType: (v: string) => "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
8
9
  export declare type SetupViewType = ReturnType<typeof toSetupViewType>;
9
10
  export declare const toSetupViewTypeStrict: (v: string | null) => SetupViewType | undefined;
10
11
  /**
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toSetupViewTypeStrict = exports.toSetupViewType = void 0;
3
+ exports.toSetupViewTypeStrict = exports.toSetupViewType = exports.SETUP_VIEW_TYPES = void 0;
4
4
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
5
  const entityApprovalStatusState_1 = require("../../../entity/entityApprovalStatus/entityApprovalStatusState");
6
- const toSetupViewType = (v) => (0, stringToUnion_1.stringToUnion)(v, entityApprovalStatusState_1.ALL_ENTITY_TYPES);
6
+ exports.SETUP_VIEW_TYPES = ['billing'];
7
+ const toSetupViewType = (v) => (0, stringToUnion_1.stringToUnion)(v, [...entityApprovalStatusState_1.ALL_ENTITY_TYPES, ...exports.SETUP_VIEW_TYPES]);
7
8
  exports.toSetupViewType = toSetupViewType;
8
9
  const toSetupViewTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v !== null && v !== void 0 ? v : '', entityApprovalStatusState_1.ALL_ENTITY_TYPES);
9
10
  exports.toSetupViewTypeStrict = toSetupViewTypeStrict;
@@ -9,12 +9,19 @@ const accountReducer_1 = require("../../../../../entity/account/accountReducer")
9
9
  const paymentAccountReducer_1 = require("../../../../../entity/paymentAccount/paymentAccountReducer");
10
10
  const getPaymentAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(plaidAccountViewReducer_1.getPaymentAccounts.match), (0, operators_1.switchMap)((action) => {
11
11
  const { setupViewType, includeBalances, plaidAccountKeyType } = action.payload;
12
- return zeniAPI
13
- .getJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/payment-accounts?query=${encodeURIComponent(JSON.stringify({
12
+ let queryParams = {
14
13
  is_include_balances: includeBalances,
15
14
  is_primary_for_onboarding: false,
16
15
  is_primary_for_bill_pay: true,
17
- }))}`)
16
+ };
17
+ if (setupViewType === 'billing' &&
18
+ plaidAccountKeyType === 'billing_setup') {
19
+ queryParams = {
20
+ is_primary_for_onboarding: true,
21
+ };
22
+ }
23
+ return zeniAPI
24
+ .getJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/payment-accounts?query=${encodeURIComponent(JSON.stringify(queryParams))}`)
18
25
  .pipe((0, operators_1.mergeMap)((response) => {
19
26
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
20
27
  const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
@@ -26,10 +26,11 @@ const establishPlaidConnectionEpic = (actions$, state, zeniAPI) => actions$.pipe
26
26
  else if (plaidAccountKeyType === 'reimbursement_setup') {
27
27
  requestPayload.is_primary_for_reimbursements = true;
28
28
  }
29
+ else if (plaidAccountKeyType === 'billing_setup') {
30
+ requestPayload.is_primary_for_onboarding = true;
31
+ }
29
32
  else {
30
33
  requestPayload.is_primary_for_bill_pay = true;
31
- requestPayload.is_primary_for_onboarding = true;
32
- requestPayload.is_primary_for_reimbursements = true;
33
34
  }
34
35
  }
35
36
  return zeniAPI
@@ -2,9 +2,9 @@ import { ID } from '../../../commonStateTypes/common';
2
2
  import { ZeniAPIStatus } from '../../../responsePayload';
3
3
  import { PlaidAccountKeyType, PlaidAccountViewState, PlaidLinkTokenType } from './plaidAccountViewState';
4
4
  export declare const initialState: PlaidAccountViewState;
5
- export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards", plaidAccountKeyType: PlaidAccountKeyType, includeBalances?: any], {
6
- setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards";
7
- includeBalances: any;
5
+ export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing", plaidAccountKeyType: PlaidAccountKeyType, includeBalances?: boolean | undefined], {
6
+ setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
7
+ includeBalances: boolean;
8
8
  plaidAccountKeyType: PlaidAccountKeyType;
9
9
  }, string, never, never>, getPaymentAccountsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentAccountIds: string[], plaidAccountKeyType: PlaidAccountKeyType], {
10
10
  paymentAccountIds: string[];
@@ -12,10 +12,10 @@ export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreato
12
12
  }, string, never, never>, getPaymentAccountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>, plaidAccountKeyType: PlaidAccountKeyType], {
13
13
  error: ZeniAPIStatus<Record<string, unknown>>;
14
14
  plaidAccountKeyType: PlaidAccountKeyType;
15
- }, string, never, never>, updatePaymentAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, paymentAccountId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards", plaidAccountKeyType: PlaidAccountKeyType], {
15
+ }, string, never, never>, updatePaymentAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, paymentAccountId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing", plaidAccountKeyType: PlaidAccountKeyType], {
16
16
  accountId: string;
17
17
  paymentAccountId: string;
18
- setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards";
18
+ setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
19
19
  plaidAccountKeyType: PlaidAccountKeyType;
20
20
  }, string, never, never>, updatePaymentAccountSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentAccountIds: string[], plaidAccountKeyType: PlaidAccountKeyType], {
21
21
  paymentAccountIds: string[];
@@ -23,10 +23,10 @@ export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreato
23
23
  }, string, never, never>, updatePaymentAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>, plaidAccountKeyType: PlaidAccountKeyType], {
24
24
  error: ZeniAPIStatus<Record<string, unknown>>;
25
25
  plaidAccountKeyType: PlaidAccountKeyType;
26
- }, string, never, never>, updatePaymentAccountStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[verificationStatusCode: string, paymentAccountId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards", plaidAccountKeyType: PlaidAccountKeyType, linkTokenType?: PlaidLinkTokenType | undefined], {
26
+ }, string, never, never>, updatePaymentAccountStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[verificationStatusCode: string, paymentAccountId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing", plaidAccountKeyType: PlaidAccountKeyType, linkTokenType?: PlaidLinkTokenType | undefined], {
27
27
  verificationStatusCode: string;
28
28
  paymentAccountId: string;
29
- setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards";
29
+ setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
30
30
  plaidAccountKeyType: PlaidAccountKeyType;
31
31
  linkTokenType: PlaidLinkTokenType;
32
32
  }, string, never, never>, updatePaymentAccountStatusSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentAccountIds: string[], linkTokenType: PlaidLinkTokenType, plaidAccountKeyType: PlaidAccountKeyType], {
@@ -37,10 +37,10 @@ export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreato
37
37
  error: ZeniAPIStatus<Record<string, unknown>>;
38
38
  linkTokenType: PlaidLinkTokenType;
39
39
  plaidAccountKeyType: PlaidAccountKeyType;
40
- }, string, never, never>, updatePaymentAccountLoginStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[isLoginRequired: boolean, paymentAccountId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards", plaidAccountKeyType: PlaidAccountKeyType, linkTokenType?: PlaidLinkTokenType | undefined], {
40
+ }, string, never, never>, updatePaymentAccountLoginStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[isLoginRequired: boolean, paymentAccountId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing", plaidAccountKeyType: PlaidAccountKeyType, linkTokenType?: PlaidLinkTokenType | undefined], {
41
41
  isLoginRequired: boolean;
42
42
  paymentAccountId: string;
43
- setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards";
43
+ setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
44
44
  plaidAccountKeyType: PlaidAccountKeyType;
45
45
  linkTokenType: PlaidLinkTokenType;
46
46
  }, string, never, never>, updatePaymentAccountLoginStatusSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentAccountIds: string[], linkTokenType: PlaidLinkTokenType, plaidAccountKeyType: PlaidAccountKeyType], {
@@ -64,9 +64,9 @@ export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreato
64
64
  error: ZeniAPIStatus<Record<string, unknown>>;
65
65
  linkTokenType: PlaidLinkTokenType;
66
66
  plaidAccountKeyType: PlaidAccountKeyType;
67
- }, string, never, never>, establishPlaidConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[publicToken: string, plaidAccountKeyType: PlaidAccountKeyType, setupViewType?: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | undefined, linkTokenType?: PlaidLinkTokenType | undefined], {
67
+ }, string, never, never>, establishPlaidConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[publicToken: string, plaidAccountKeyType: PlaidAccountKeyType, setupViewType?: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing" | undefined, linkTokenType?: PlaidLinkTokenType | undefined], {
68
68
  publicToken: string;
69
- setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | undefined;
69
+ setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing" | undefined;
70
70
  linkTokenType: PlaidLinkTokenType;
71
71
  plaidAccountKeyType: PlaidAccountKeyType;
72
72
  }, string, never, never>, establishPlaidConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[primaryFundingAccountId: string, paymentAccountIds: string[], linkTokenType: PlaidLinkTokenType, plaidAccountKeyType: PlaidAccountKeyType], {
@@ -10,6 +10,7 @@ exports.initialState = {
10
10
  user_reimbursement_account: plaidAccountViewState_1.initialPlaidAccountState,
11
11
  external_account: plaidAccountViewState_1.initialPlaidAccountState,
12
12
  reimbursement_setup: plaidAccountViewState_1.initialPlaidAccountState,
13
+ billing_setup: plaidAccountViewState_1.initialPlaidAccountState,
13
14
  };
14
15
  const plaidAccountView = (0, toolkit_1.createSlice)({
15
16
  name: 'plaidAccountView',
@@ -23,8 +24,14 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
23
24
  error: undefined,
24
25
  };
25
26
  },
26
- prepare(setupViewType, plaidAccountKeyType, includeBalances = true) {
27
- return { payload: { setupViewType, includeBalances, plaidAccountKeyType } };
27
+ prepare(setupViewType, plaidAccountKeyType, includeBalances) {
28
+ return {
29
+ payload: {
30
+ setupViewType,
31
+ includeBalances: includeBalances == null ? true : includeBalances,
32
+ plaidAccountKeyType,
33
+ },
34
+ };
28
35
  },
29
36
  },
30
37
  getPaymentAccountsSuccess: {
@@ -1,7 +1,7 @@
1
1
  import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
2
  import { ZeniDate } from '../../../zeniDayJS';
3
3
  export declare type PlaidLinkTokenType = 'link_account' | 'update_account' | 'link_account_no_microdeposit' | 'link_external_account';
4
- export declare type PlaidAccountKeyType = 'spend_management_setup' | 'reimbursement_setup' | 'user_reimbursement_account' | 'external_account';
4
+ export declare type PlaidAccountKeyType = 'spend_management_setup' | 'reimbursement_setup' | 'user_reimbursement_account' | 'external_account' | 'billing_setup';
5
5
  export declare type PlaidConnectionDetails = Record<PlaidLinkTokenType, {
6
6
  linkToken?: string;
7
7
  expiration?: ZeniDate;
@@ -18,8 +18,10 @@ const fetchZeniAccountListEpic = (actions$, state$) => actions$.pipe((0, operato
18
18
  }
19
19
  else {
20
20
  const depositAccountList = state.depositAccountListState;
21
- if (depositAccountList.hasValidState() === false &&
22
- depositAccountList.fetchState !== 'In-Progress') {
21
+ const zeniAccountList = state.zeniAccountListState;
22
+ if ((depositAccountList.hasValidState() === false &&
23
+ depositAccountList.fetchState !== 'In-Progress') ||
24
+ zeniAccountList.summary.zeniAccounts == null) {
23
25
  zeniAccountActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
24
26
  }
25
27
  const paymentAccountList = state.paymentAccountListState;
@@ -1,6 +1,6 @@
1
1
  import { RootState } from '../../reducer';
2
2
  export declare const getTasksCardReport: (state: RootState) => {
3
- reportId: "cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card";
3
+ reportId: "cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing";
4
4
  reportTitle: string;
5
5
  version: string | number | undefined;
6
6
  status: import("../..").Status | undefined;
@@ -5,7 +5,7 @@ import { AccountState } from '../../entity/account/accountState';
5
5
  import { EntityOrder } from '../../commonStateTypes/selectorTypes/selectorTypes';
6
6
  import { TopExReport, TopExTimePeriodWithMetaData } from './topExSelectorTypes';
7
7
  export declare const getTopExpenses: (accountState: AccountState, topExState: TopExState, numberOfExpenses?: number | undefined) => {
8
- reportId: "cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card";
8
+ reportId: "cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing";
9
9
  reportTitle: string;
10
10
  version: string | number | undefined;
11
11
  status: import("../..").Status | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.11.32",
3
+ "version": "4.11.33",
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",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@reduxjs/toolkit": "^1.6.2",
51
- "@stripe/stripe-js": "4.2.0",
51
+ "@stripe/stripe-js": "^4.1.0",
52
52
  "cross-fetch": "^3.1.2",
53
53
  "date-holidays": "^3.23.8",
54
54
  "dayjs": "^1.10.7",