@zeniai/client-epic-state 4.10.67 → 4.10.69

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 (89) hide show
  1. package/lib/entity/company/companyPayload.d.ts +4 -0
  2. package/lib/entity/company/companyPayload.js +10 -1
  3. package/lib/entity/company/companyStateTypes.d.ts +5 -0
  4. package/lib/entity/depositAccount/depositAccount.d.ts +1 -0
  5. package/lib/entity/depositAccount/depositAccountPayload.d.ts +1 -0
  6. package/lib/entity/depositAccount/depositAccountPayload.js +1 -0
  7. package/lib/entity/paymentAccount/paymentAccountPayload.d.ts +1 -0
  8. package/lib/entity/paymentAccount/paymentAccountPayload.js +1 -0
  9. package/lib/entity/paymentAccount/paymentAccountState.d.ts +1 -0
  10. package/lib/entity/reimbursement/reimbursementPayload.d.ts +4 -3
  11. package/lib/entity/reimbursement/reimbursementPayload.js +36 -2
  12. package/lib/entity/reimbursement/reimbursementState.d.ts +4 -4
  13. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  14. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  15. package/lib/epic.d.ts +4 -1
  16. package/lib/epic.js +4 -1
  17. package/lib/index.d.ts +16 -15
  18. package/lib/index.js +15 -10
  19. package/lib/reducer.d.ts +3 -0
  20. package/lib/reducer.js +3 -0
  21. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewPayload.d.ts +1 -0
  22. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +2 -1
  23. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +14 -1
  24. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewSelector.d.ts +8 -2
  25. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewSelector.js +41 -3
  26. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +7 -0
  27. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +2 -1
  28. package/lib/view/onboardingView/customerView/epic/plaidConnection/establishOnboardingPlaidConnectionEpic.js +1 -0
  29. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  30. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  31. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  32. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  33. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  34. package/lib/view/reviewCompanyView/fetchReviewCompanyViewEpic.d.ts +2 -1
  35. package/lib/view/reviewCompanyView/fetchReviewCompanyViewEpic.js +9 -1
  36. package/lib/view/reviewCompanyView/reviewCompanyViewReducer.d.ts +2 -1
  37. package/lib/view/reviewCompanyView/reviewCompanyViewReducer.js +2 -2
  38. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
  39. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +2 -2
  40. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +2 -2
  41. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +2 -2
  42. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +5 -5
  43. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -4
  44. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +2 -2
  45. package/lib/view/spendManagement/commonSetup/setupViewPayload.d.ts +2 -0
  46. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +28 -3
  47. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +79 -5
  48. package/lib/view/spendManagement/helpers.d.ts +1 -0
  49. package/lib/view/spendManagement/helpers.js +5 -1
  50. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updateMappedCashAccountEpic.d.ts +9 -0
  51. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updateMappedCashAccountEpic.js +31 -0
  52. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePrimaryFundingAccountEpic.d.ts +8 -0
  53. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePrimaryFundingAccountEpic.js +39 -0
  54. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +23 -2
  55. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +96 -8
  56. package/lib/view/spendManagement/plaidAccount/plaidAccountViewSelector.d.ts +1 -1
  57. package/lib/view/spendManagement/plaidAccount/plaidAccountViewSelector.js +3 -3
  58. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +7 -1
  59. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.js +1 -0
  60. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewPayload.d.ts +5 -1
  61. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewPayload.js +50 -0
  62. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewReducer.js +19 -16
  63. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.d.ts +5 -2
  64. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +2 -2
  65. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewState.d.ts +30 -7
  66. package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchCurrencyConversionValueEpic.js +1 -1
  67. package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRecommendationsAndUpdateMerchantRecommendationsEpic.js +2 -2
  68. package/lib/view/spendManagement/reimbursement/editRemiView/epics/initializeRemiToLocalStoreEpic.d.ts +1 -1
  69. package/lib/view/spendManagement/reimbursement/editRemiView/epics/initializeRemiToLocalStoreEpic.js +51 -7
  70. package/lib/view/spendManagement/reimbursement/editRemiView/epics/parseReceiptsToRemiEpic.js +31 -20
  71. package/lib/view/spendManagement/reimbursement/editRemiView/epics/saveRemiDetailEpic.d.ts +3 -3
  72. package/lib/view/spendManagement/reimbursement/editRemiView/epics/saveRemiDetailEpic.js +4 -4
  73. package/lib/view/spendManagement/reimbursement/remiDetailView/epics/fetchDuplicateReimbursementEpic.js +11 -4
  74. package/lib/view/spendManagement/reimbursement/remiSetupView/epic/remiSetup/fetchRemiSetupViewEpic.d.ts +2 -1
  75. package/lib/view/spendManagement/reimbursement/remiSetupView/epic/remiSetup/fetchRemiSetupViewEpic.js +18 -3
  76. package/lib/view/spendManagement/reimbursement/remiSetupView/remiSetupViewSelector.js +1 -1
  77. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailReducer.js +1 -0
  78. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.d.ts +3 -6
  79. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +3 -44
  80. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailState.d.ts +4 -14
  81. package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
  82. package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
  83. package/lib/view/vendorTabView/fetchVendorTabViewEpic.d.ts +9 -0
  84. package/lib/view/vendorTabView/fetchVendorTabViewEpic.js +53 -0
  85. package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +15 -0
  86. package/lib/view/vendorTabView/vendorTabViewReducer.js +37 -0
  87. package/lib/view/vendorTabView/vendorTabViewState.d.ts +2 -0
  88. package/lib/view/vendorTabView/vendorTabViewState.js +2 -0
  89. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearPlaidAccountView = exports.updatePlaidAccountViewAccountDetails = exports.establishPlaidConnectionFailure = exports.establishPlaidConnectionSuccess = exports.establishPlaidConnection = exports.getPlaidLinkTokenFailure = exports.getPlaidLinkTokenSuccess = exports.getPlaidLinkToken = exports.updatePaymentAccountLoginStatusFailure = exports.updatePaymentAccountLoginStatusSuccess = exports.updatePaymentAccountLoginStatus = exports.updatePaymentAccountStatusFailure = exports.updatePaymentAccountStatusSuccess = exports.updatePaymentAccountStatus = exports.updatePaymentAccountFailure = exports.updatePaymentAccountSuccess = exports.updatePaymentAccount = exports.getPaymentAccountsFailure = exports.getPaymentAccountsSuccess = exports.getPaymentAccounts = exports.initialState = void 0;
4
+ exports.clearPlaidAccountView = exports.updateMappedCashAccountFailure = exports.updateMappedCashAccountSuccess = exports.updateMappedCashAccount = exports.updatePrimaryFundingAccountFailure = exports.updatePrimaryFundingAccountSuccess = exports.updatePrimaryFundingAccount = exports.updatePlaidAccountViewAccountDetails = exports.establishPlaidConnectionFailure = exports.establishPlaidConnectionSuccess = exports.establishPlaidConnection = exports.getPlaidLinkTokenFailure = exports.getPlaidLinkTokenSuccess = exports.getPlaidLinkToken = exports.updatePaymentAccountLoginStatusFailure = exports.updatePaymentAccountLoginStatusSuccess = exports.updatePaymentAccountLoginStatus = exports.updatePaymentAccountStatusFailure = exports.updatePaymentAccountStatusSuccess = exports.updatePaymentAccountStatus = exports.updatePaymentAccountFailure = exports.updatePaymentAccountSuccess = exports.updatePaymentAccount = exports.getPaymentAccountsFailure = exports.getPaymentAccountsSuccess = exports.getPaymentAccounts = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const zeniDayJS_1 = require("../../../zeniDayJS");
7
7
  const plaidAccountViewState_1 = require("./plaidAccountViewState");
@@ -9,6 +9,7 @@ exports.initialState = {
9
9
  spend_management_setup: plaidAccountViewState_1.initialPlaidAccountState,
10
10
  user_reimbursement_account: plaidAccountViewState_1.initialPlaidAccountState,
11
11
  external_account: plaidAccountViewState_1.initialPlaidAccountState,
12
+ reimbursement_setup: plaidAccountViewState_1.initialPlaidAccountState,
12
13
  };
13
14
  const plaidAccountView = (0, toolkit_1.createSlice)({
14
15
  name: 'plaidAccountView',
@@ -77,13 +78,11 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
77
78
  },
78
79
  updatePaymentAccountSuccess: {
79
80
  reducer(draft, action) {
80
- const { paymentAccountIds, plaidAccountKeyType } = action.payload;
81
+ const { plaidAccountKeyType } = action.payload;
81
82
  draft[plaidAccountKeyType].accountDetails.updateStatus = {
82
83
  fetchState: 'Completed',
83
84
  error: undefined,
84
85
  };
85
- draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
86
- paymentAccountIds;
87
86
  },
88
87
  prepare(paymentAccountIds, plaidAccountKeyType) {
89
88
  return {
@@ -306,27 +305,116 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
306
305
  },
307
306
  },
308
307
  updatePlaidAccountViewAccountDetails: {
309
- prepare(allBankAccountIds, paymentAccountIds, plaidAccountKeyType) {
308
+ prepare(allBankAccountIds, paymentAccountIds, plaidAccountKeyType, depositAccountIds, primaryFundingAccount) {
310
309
  return {
311
- payload: { allBankAccountIds, paymentAccountIds, plaidAccountKeyType },
310
+ payload: {
311
+ allBankAccountIds,
312
+ paymentAccountIds,
313
+ plaidAccountKeyType,
314
+ depositAccountIds,
315
+ primaryFundingAccount,
316
+ },
312
317
  };
313
318
  },
314
319
  reducer(draft, action) {
315
- const { allBankAccountIds, paymentAccountIds, plaidAccountKeyType } = action.payload;
320
+ const { allBankAccountIds, paymentAccountIds, depositAccountIds, primaryFundingAccount, plaidAccountKeyType, } = action.payload;
316
321
  draft[plaidAccountKeyType].accountDetails.allBankAccountIds =
317
322
  allBankAccountIds;
318
323
  draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
319
324
  paymentAccountIds;
325
+ draft[plaidAccountKeyType].accountDetails.depositAccountIds =
326
+ depositAccountIds !== null && depositAccountIds !== void 0 ? depositAccountIds : [];
327
+ draft[plaidAccountKeyType].accountDetails.primaryFundingAccount =
328
+ primaryFundingAccount;
320
329
  draft[plaidAccountKeyType].accountDetails.fetchStatus = {
321
330
  fetchState: 'Completed',
322
331
  error: undefined,
323
332
  };
324
333
  },
325
334
  },
335
+ updatePrimaryFundingAccount: {
336
+ reducer(draft) {
337
+ draft['reimbursement_setup'].accountDetails.primaryFundingAccountUpdateStatus = {
338
+ fetchState: 'In-Progress',
339
+ error: undefined,
340
+ };
341
+ },
342
+ prepare(companyId, accountId, accountType) {
343
+ return { payload: { companyId, accountId, accountType } };
344
+ },
345
+ },
346
+ updatePrimaryFundingAccountSuccess: {
347
+ reducer(draft, action) {
348
+ const { accountId, accountType } = action.payload;
349
+ draft['reimbursement_setup'].accountDetails.primaryFundingAccountUpdateStatus = {
350
+ fetchState: 'Completed',
351
+ error: undefined,
352
+ };
353
+ draft['reimbursement_setup'].accountDetails.primaryFundingAccount = {
354
+ accountId: accountId,
355
+ accountType: accountType,
356
+ };
357
+ },
358
+ prepare(accountId, accountType) {
359
+ return {
360
+ payload: { accountId, accountType },
361
+ };
362
+ },
363
+ },
364
+ updatePrimaryFundingAccountFailure: {
365
+ reducer(draft, action) {
366
+ draft['reimbursement_setup'].accountDetails.primaryFundingAccountUpdateStatus = {
367
+ fetchState: 'Error',
368
+ error: action.payload,
369
+ };
370
+ },
371
+ prepare(error) {
372
+ return {
373
+ payload: error,
374
+ };
375
+ },
376
+ },
377
+ updateMappedCashAccount: {
378
+ reducer(draft) {
379
+ draft['reimbursement_setup'].accountDetails.updateStatus = {
380
+ fetchState: 'In-Progress',
381
+ error: undefined,
382
+ };
383
+ },
384
+ prepare(accountId, depositAccountId) {
385
+ return { payload: { accountId, depositAccountId } };
386
+ },
387
+ },
388
+ updateMappedCashAccountSuccess: {
389
+ reducer(draft) {
390
+ draft['reimbursement_setup'].accountDetails.updateStatus = {
391
+ fetchState: 'Completed',
392
+ error: undefined,
393
+ };
394
+ },
395
+ prepare(depositAccountIds) {
396
+ return {
397
+ payload: { depositAccountIds },
398
+ };
399
+ },
400
+ },
401
+ updateMappedCashAccountFailure: {
402
+ reducer(draft, action) {
403
+ draft['reimbursement_setup'].accountDetails.updateStatus = {
404
+ fetchState: 'Error',
405
+ error: action.payload,
406
+ };
407
+ },
408
+ prepare(error) {
409
+ return {
410
+ payload: error,
411
+ };
412
+ },
413
+ },
326
414
  clearPlaidAccountView(draft) {
327
415
  Object.assign(draft, exports.initialState);
328
416
  },
329
417
  },
330
418
  });
331
- _a = plaidAccountView.actions, exports.getPaymentAccounts = _a.getPaymentAccounts, exports.getPaymentAccountsSuccess = _a.getPaymentAccountsSuccess, exports.getPaymentAccountsFailure = _a.getPaymentAccountsFailure, exports.updatePaymentAccount = _a.updatePaymentAccount, exports.updatePaymentAccountSuccess = _a.updatePaymentAccountSuccess, exports.updatePaymentAccountFailure = _a.updatePaymentAccountFailure, exports.updatePaymentAccountStatus = _a.updatePaymentAccountStatus, exports.updatePaymentAccountStatusSuccess = _a.updatePaymentAccountStatusSuccess, exports.updatePaymentAccountStatusFailure = _a.updatePaymentAccountStatusFailure, exports.updatePaymentAccountLoginStatus = _a.updatePaymentAccountLoginStatus, exports.updatePaymentAccountLoginStatusSuccess = _a.updatePaymentAccountLoginStatusSuccess, exports.updatePaymentAccountLoginStatusFailure = _a.updatePaymentAccountLoginStatusFailure, exports.getPlaidLinkToken = _a.getPlaidLinkToken, exports.getPlaidLinkTokenSuccess = _a.getPlaidLinkTokenSuccess, exports.getPlaidLinkTokenFailure = _a.getPlaidLinkTokenFailure, exports.establishPlaidConnection = _a.establishPlaidConnection, exports.establishPlaidConnectionSuccess = _a.establishPlaidConnectionSuccess, exports.establishPlaidConnectionFailure = _a.establishPlaidConnectionFailure, exports.updatePlaidAccountViewAccountDetails = _a.updatePlaidAccountViewAccountDetails, exports.clearPlaidAccountView = _a.clearPlaidAccountView;
419
+ _a = plaidAccountView.actions, exports.getPaymentAccounts = _a.getPaymentAccounts, exports.getPaymentAccountsSuccess = _a.getPaymentAccountsSuccess, exports.getPaymentAccountsFailure = _a.getPaymentAccountsFailure, exports.updatePaymentAccount = _a.updatePaymentAccount, exports.updatePaymentAccountSuccess = _a.updatePaymentAccountSuccess, exports.updatePaymentAccountFailure = _a.updatePaymentAccountFailure, exports.updatePaymentAccountStatus = _a.updatePaymentAccountStatus, exports.updatePaymentAccountStatusSuccess = _a.updatePaymentAccountStatusSuccess, exports.updatePaymentAccountStatusFailure = _a.updatePaymentAccountStatusFailure, exports.updatePaymentAccountLoginStatus = _a.updatePaymentAccountLoginStatus, exports.updatePaymentAccountLoginStatusSuccess = _a.updatePaymentAccountLoginStatusSuccess, exports.updatePaymentAccountLoginStatusFailure = _a.updatePaymentAccountLoginStatusFailure, exports.getPlaidLinkToken = _a.getPlaidLinkToken, exports.getPlaidLinkTokenSuccess = _a.getPlaidLinkTokenSuccess, exports.getPlaidLinkTokenFailure = _a.getPlaidLinkTokenFailure, exports.establishPlaidConnection = _a.establishPlaidConnection, exports.establishPlaidConnectionSuccess = _a.establishPlaidConnectionSuccess, exports.establishPlaidConnectionFailure = _a.establishPlaidConnectionFailure, exports.updatePlaidAccountViewAccountDetails = _a.updatePlaidAccountViewAccountDetails, exports.updatePrimaryFundingAccount = _a.updatePrimaryFundingAccount, exports.updatePrimaryFundingAccountSuccess = _a.updatePrimaryFundingAccountSuccess, exports.updatePrimaryFundingAccountFailure = _a.updatePrimaryFundingAccountFailure, exports.updateMappedCashAccount = _a.updateMappedCashAccount, exports.updateMappedCashAccountSuccess = _a.updateMappedCashAccountSuccess, exports.updateMappedCashAccountFailure = _a.updateMappedCashAccountFailure, exports.clearPlaidAccountView = _a.clearPlaidAccountView;
332
420
  exports.default = plaidAccountView.reducer;
@@ -1,2 +1,2 @@
1
1
  import { PlaidAccountKeyType, PlaidAccountState, PlaidAccountViewState } from './plaidAccountViewState';
2
- export declare function getPlaidAccountwDetails(plaidAccountViewState: PlaidAccountViewState, plaidAccountKeyType: PlaidAccountKeyType): PlaidAccountState;
2
+ export declare function getPlaidAccountDetails(plaidAccountViewState: PlaidAccountViewState, plaidAccountKeyType: PlaidAccountKeyType): PlaidAccountState;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPlaidAccountwDetails = void 0;
4
- function getPlaidAccountwDetails(plaidAccountViewState, plaidAccountKeyType) {
3
+ exports.getPlaidAccountDetails = void 0;
4
+ function getPlaidAccountDetails(plaidAccountViewState, plaidAccountKeyType) {
5
5
  return plaidAccountViewState[plaidAccountKeyType];
6
6
  }
7
- exports.getPlaidAccountwDetails = getPlaidAccountwDetails;
7
+ exports.getPlaidAccountDetails = getPlaidAccountDetails;
@@ -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' | 'user_reimbursement_account' | 'external_account';
4
+ export declare type PlaidAccountKeyType = 'spend_management_setup' | 'reimbursement_setup' | 'user_reimbursement_account' | 'external_account';
5
5
  export declare type PlaidConnectionDetails = Record<PlaidLinkTokenType, {
6
6
  linkToken?: string;
7
7
  expiration?: ZeniDate;
@@ -13,7 +13,13 @@ export interface PlaidAccountState {
13
13
  accountDetails: {
14
14
  fetchStatus: FetchStateAndError;
15
15
  updateStatus: FetchStateAndError;
16
+ primaryFundingAccountUpdateStatus?: FetchStateAndError;
17
+ primaryFundingAccount?: {
18
+ accountId: ID;
19
+ accountType: string;
20
+ };
16
21
  paymentAccountIds: ID[];
22
+ depositAccountIds: ID[];
17
23
  allBankAccountIds: ID[];
18
24
  };
19
25
  plaidConnectionDetails: PlaidConnectionDetails;
@@ -6,6 +6,7 @@ exports.initialPlaidAccountState = {
6
6
  fetchStatus: { fetchState: 'Not-Started', error: undefined },
7
7
  updateStatus: { fetchState: 'Not-Started', error: undefined },
8
8
  paymentAccountIds: [],
9
+ depositAccountIds: [],
9
10
  allBankAccountIds: [],
10
11
  },
11
12
  plaidConnectionDetails: {
@@ -1,12 +1,14 @@
1
1
  import { FilePayload } from '../../../../entity/file/filePayload';
2
2
  import { ZeniAPIResponse } from '../../../../responsePayload';
3
3
  import { MerchantPayload } from '../../../../entity/merchant/merchantPayload';
4
- import { AmountPayload, ReimbursementPayload } from '../../../../entity/reimbursement/reimbursementPayload';
5
4
  import { EntityApprovalStatusPayload } from '../../../../entity/entityApprovalStatus/entityApprovalStatusPayload';
6
5
  import { ApprovalRulePayload } from '../../../../entity/approvalRule/approvalRulePayload';
7
6
  import { UserPayload } from '../../../../entity/user/userPayload';
8
7
  import { BankAccountPayload } from '../../../../entity/bankAccount/bankAccountPayload';
8
+ import { AmountPayload, ReimbursementPayload } from '../../../../entity/reimbursement/reimbursementPayload';
9
9
  import { ReimbursementConfigPayload } from '../../reimbursement/reimbursementConfig/reimbursementConfigPayload';
10
+ import { MilageReimbursementLine, OutofPocketReimbursementLine } from '../../../../entity/reimbursement/reimbursementState';
11
+ import { SegregatedReimbursementLineWithRecommendation } from './editRemiViewState';
10
12
  export interface CurrencyConversionPayload {
11
13
  home_currency_conversions: AmountPayload;
12
14
  }
@@ -40,3 +42,5 @@ export interface RemiSavePayload {
40
42
  export declare type RemiSaveResponse = ZeniAPIResponse<RemiSavePayload>;
41
43
  export declare type CurrencyConversionResponse = ZeniAPIResponse<CurrencyConversionPayload>;
42
44
  export declare type ReimbursementConfigResponse = ZeniAPIResponse<ReimbursementConfigPayload>;
45
+ export declare const toReimbursementLineWithRecommendationFromMileage: (line: MilageReimbursementLine) => SegregatedReimbursementLineWithRecommendation;
46
+ export declare const toReimbursementLineWithRecommendationFromOutOfPocket: (line: OutofPocketReimbursementLine) => SegregatedReimbursementLineWithRecommendation;
@@ -1,2 +1,52 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toReimbursementLineWithRecommendationFromOutOfPocket = exports.toReimbursementLineWithRecommendationFromMileage = void 0;
4
+ const toReimbursementLineWithRecommendationFromMileage = (line) => {
5
+ const convertedLine = {
6
+ type: line.type,
7
+ fileId: line.fileId,
8
+ lineId: line.lineId,
9
+ homeCurrencyConversions: line.homeCurrencyConversions,
10
+ mileage: {
11
+ description: line.description,
12
+ lineDetail: line.lineDetail,
13
+ transactionDate: line.transactionDate,
14
+ amount: line.amount,
15
+ currencyCode: line.currencyCode,
16
+ currencySymbol: line.currencySymbol,
17
+ distanceMileage: line === null || line === void 0 ? void 0 : line.distanceMileage,
18
+ },
19
+ outOfPocket: {
20
+ recommendations: [],
21
+ isCategoryFirstTimeAutofilled: false,
22
+ isCategoryUpdateSelected: false,
23
+ isRetainedCategorySelected: false,
24
+ },
25
+ };
26
+ return convertedLine;
27
+ };
28
+ exports.toReimbursementLineWithRecommendationFromMileage = toReimbursementLineWithRecommendationFromMileage;
29
+ const toReimbursementLineWithRecommendationFromOutOfPocket = (line) => {
30
+ const convertedLine = {
31
+ type: line.type,
32
+ fileId: line.fileId,
33
+ lineId: line.lineId,
34
+ homeCurrencyConversions: line.homeCurrencyConversions,
35
+ mileage: {},
36
+ outOfPocket: {
37
+ merchant: line === null || line === void 0 ? void 0 : line.merchant,
38
+ description: line.description,
39
+ lineDetail: line.lineDetail,
40
+ transactionDate: line.transactionDate,
41
+ amount: line.amount,
42
+ currencyCode: line.currencyCode,
43
+ currencySymbol: line.currencySymbol,
44
+ recommendations: [],
45
+ isCategoryFirstTimeAutofilled: false,
46
+ isCategoryUpdateSelected: false,
47
+ isRetainedCategorySelected: false,
48
+ },
49
+ };
50
+ return convertedLine;
51
+ };
52
+ exports.toReimbursementLineWithRecommendationFromOutOfPocket = toReimbursementLineWithRecommendationFromOutOfPocket;
@@ -350,24 +350,24 @@ exports.default = editRemiView.reducer;
350
350
  const doUpdateRecommendationForEntity = (draft, lineId, recommendations, shouldAutofill, reimbursementId, reimbursementStageCode) => {
351
351
  var _a, _b, _c, _d, _e, _f;
352
352
  if (reimbursementId != null) {
353
- const lineAccount = (_a = draft.editRemiStateById[reimbursementId].remiDetailLocalData
354
- .updatesByLineId[lineId].lineDetail) === null || _a === void 0 ? void 0 : _a.account;
355
- const lineClass = (_b = draft.editRemiStateById[reimbursementId].remiDetailLocalData
356
- .updatesByLineId[lineId].lineDetail) === null || _b === void 0 ? void 0 : _b.class;
357
353
  if (draft.editRemiStateById[reimbursementId].remiDetailLocalData
358
354
  .updatesByLineId[lineId].type === 'out_of_pocket') {
355
+ const lineAccount = (_a = draft.editRemiStateById[reimbursementId].remiDetailLocalData
356
+ .updatesByLineId[lineId].outOfPocket.lineDetail) === null || _a === void 0 ? void 0 : _a.account;
357
+ const lineClass = (_b = draft.editRemiStateById[reimbursementId].remiDetailLocalData
358
+ .updatesByLineId[lineId].outOfPocket.lineDetail) === null || _b === void 0 ? void 0 : _b.class;
359
359
  const merchantForCurrentLineId = draft.editRemiStateById[reimbursementId].remiDetailLocalData
360
- .updatesByLineId[lineId].merchant;
360
+ .updatesByLineId[lineId].outOfPocket.merchant;
361
361
  if (merchantForCurrentLineId != null) {
362
362
  const { recommendedAccount } = (0, initializeRemiToLocalStoreEpic_1.getRecommendedCategoryClass)(recommendations, lineAccount, lineClass);
363
363
  // autofill the account with recommendedAccount and set isCategoryFirstTimeAutofilled as true
364
364
  if (shouldAutofill) {
365
- draft.editRemiStateById[reimbursementId].remiDetailLocalData.updatesByLineId[lineId] = Object.assign(Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData
366
- .updatesByLineId[lineId]), { recommendations,
365
+ draft.editRemiStateById[reimbursementId].remiDetailLocalData.updatesByLineId[lineId].outOfPocket = Object.assign(Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData
366
+ .updatesByLineId[lineId].outOfPocket), { recommendations,
367
367
  recommendedAccount, isCategoryUpdateSelected: false, isCategoryFirstTimeAutofilled: true });
368
368
  //autofilling account with recommendedAccount
369
- draft.editRemiStateById[reimbursementId].remiDetailLocalData.updatesByLineId[lineId].lineDetail = Object.assign(Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData
370
- .updatesByLineId[lineId].lineDetail), { account: recommendedAccount });
369
+ draft.editRemiStateById[reimbursementId].remiDetailLocalData.updatesByLineId[lineId].outOfPocket.lineDetail = Object.assign(Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData
370
+ .updatesByLineId[lineId].outOfPocket.lineDetail), { account: recommendedAccount });
371
371
  //add account to addRemiAutoFieldsByLineId, since account was autofilled
372
372
  if (!((_c = draft.editRemiStateById[reimbursementId].addRemiAutoFieldsByLineId[lineId]) === null || _c === void 0 ? void 0 : _c.includes('account')) &&
373
373
  (recommendedAccount === null || recommendedAccount === void 0 ? void 0 : recommendedAccount.accountId) != null) {
@@ -382,24 +382,27 @@ const doUpdateRecommendationForEntity = (draft, lineId, recommendations, shouldA
382
382
  }
383
383
  // show retain checkbox only in pending approval
384
384
  if (reimbursementStageCode === 'pending_approval') {
385
- draft.editRemiStateById[reimbursementId].remiDetailLocalData.updatesByLineId[lineId] = Object.assign(Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData
386
- .updatesByLineId[lineId]), { retainedAccount: recommendedAccount != null ? lineAccount : undefined, isRetainedCategorySelected: false });
385
+ draft.editRemiStateById[reimbursementId].remiDetailLocalData.updatesByLineId[lineId].outOfPocket = Object.assign(Object.assign({}, draft.editRemiStateById[reimbursementId].remiDetailLocalData
386
+ .updatesByLineId[lineId].outOfPocket), { retainedAccount: recommendedAccount != null ? lineAccount : undefined, isRetainedCategorySelected: false });
387
387
  }
388
388
  }
389
389
  }
390
390
  }
391
391
  else {
392
- const lineAccount = (_d = draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId].lineDetail) === null || _d === void 0 ? void 0 : _d.account;
393
- const lineClass = (_e = draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId].lineDetail) === null || _e === void 0 ? void 0 : _e.class;
394
392
  if (draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId].type ===
395
393
  'out_of_pocket') {
394
+ const lineAccount = (_d = draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId]
395
+ .outOfPocket.lineDetail) === null || _d === void 0 ? void 0 : _d.account;
396
+ const lineClass = (_e = draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId]
397
+ .outOfPocket.lineDetail) === null || _e === void 0 ? void 0 : _e.class;
396
398
  const { recommendedAccount } = (0, initializeRemiToLocalStoreEpic_1.getRecommendedCategoryClass)(recommendations, lineAccount, lineClass);
397
399
  // autofill the account with recommendedAccount and set isCategoryFirstTimeAutofilled as true
398
400
  if (shouldAutofill) {
399
- draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId] = Object.assign(Object.assign({}, draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId]), { recommendations,
401
+ draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId].outOfPocket = Object.assign(Object.assign({}, draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId]
402
+ .outOfPocket), { recommendations,
400
403
  recommendedAccount, isCategoryUpdateSelected: false, isCategoryFirstTimeAutofilled: true });
401
- draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId].lineDetail = Object.assign(Object.assign({}, draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId]
402
- .lineDetail), { account: recommendedAccount });
404
+ draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId].outOfPocket.lineDetail = Object.assign(Object.assign({}, draft.newRemiState.remiDetailLocalData.updatesByLineId[lineId]
405
+ .outOfPocket.lineDetail), { account: recommendedAccount });
403
406
  //add account to addRemiAutoFieldsByLineId, since account was autofilled
404
407
  if (!((_f = draft.newRemiState.addRemiAutoFieldsByLineId[lineId]) === null || _f === void 0 ? void 0 : _f.includes('account')) &&
405
408
  (recommendedAccount === null || recommendedAccount === void 0 ? void 0 : recommendedAccount.accountId) != null) {
@@ -4,7 +4,7 @@ import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAnd
4
4
  import { BillStageCodeType, BillStatusCodeType } from '../../../../entity/billPay/billTransaction/billTransactionState';
5
5
  import { AccountListSelectorView } from '../../../accountList/accountListSelector';
6
6
  import { ClassListSelectorView } from '../../../classList/classListSelector';
7
- import { AutoFields, ReimbursementLineWithRecommendation, WhatForSection } from './editRemiViewState';
7
+ import { AutoFields, SegregatedReimbursementLineWithRecommendation, WhatForSection, SegregatedReimbursementLine } from './editRemiViewState';
8
8
  import { ReimbursementInfo, ReimbursementLine } from '../../../../entity/reimbursement/reimbursementState';
9
9
  import { File } from '../../../../entity/file/fileState';
10
10
  import { Attachment } from '../../../../entity/transaction/stateTypes/attachment';
@@ -62,7 +62,10 @@ export interface EditRemiInitialDetails {
62
62
  export declare type ReimbursementLineWithAttachment = ReimbursementLine & {
63
63
  file?: Attachment;
64
64
  };
65
- export declare type ReimbursementLineWithAttachmentAndRecommendation = ReimbursementLineWithRecommendation & {
65
+ export declare type SegregatedReimbursementLineWithAttachment = SegregatedReimbursementLine & {
66
+ file?: Attachment;
67
+ };
68
+ export declare type ReimbursementLineWithAttachmentAndRecommendation = SegregatedReimbursementLineWithRecommendation & {
66
69
  file?: Attachment;
67
70
  recommendationFetchState: FetchState;
68
71
  };
@@ -121,8 +121,8 @@ const getEditRemiDetail = (state, reimbursementId) => {
121
121
  Object.keys(lineDetailSectionUpdatesByLineId).forEach((lineId) => {
122
122
  var _a, _b, _c, _d, _e, _f;
123
123
  if (lineDetailSectionUpdatesByLineId[lineId].type === 'out_of_pocket') {
124
- const merchantId = (_a = lineDetailSectionUpdatesByLineId[lineId].merchant) === null || _a === void 0 ? void 0 : _a.id;
125
- const merchantName = (_b = lineDetailSectionUpdatesByLineId[lineId].merchant) === null || _b === void 0 ? void 0 : _b.name;
124
+ const merchantId = (_a = lineDetailSectionUpdatesByLineId[lineId].outOfPocket.merchant) === null || _a === void 0 ? void 0 : _a.id;
125
+ const merchantName = (_b = lineDetailSectionUpdatesByLineId[lineId].outOfPocket.merchant) === null || _b === void 0 ? void 0 : _b.name;
126
126
  if (Boolean(merchantId) === true) {
127
127
  const { fetchState } = (0, recommendationSelector_1.getRecommendationsForEntity)(state, merchantId, 'merchant');
128
128
  lineDetailSection[lineId] = Object.assign(Object.assign({}, lineDetailSectionUpdatesByLineId[lineId]), { file: (_c = sourceRemiDetail.remiDetailLocalData.files) === null || _c === void 0 ? void 0 : _c.find((attachment) => attachment.fileId ===
@@ -1,8 +1,10 @@
1
1
  import { Amount } from '../../../../commonStateTypes/amount';
2
2
  import { FetchState, FetchStateAndError, ID } from '../../../../commonStateTypes/common';
3
3
  import { Recommendation } from '../../../../commonStateTypes/recommendationBase';
4
+ import { ZeniDate } from '../../../../zeniDayJS';
4
5
  import { AccountBase, RecommendedAccountBase } from '../../../../entity/account/accountState';
5
- import { MilageReimbursementLine, OutofPocketReimbursementLine } from '../../../../entity/reimbursement/reimbursementState';
6
+ import { MerchantBase } from '../../../../entity/merchant/merchant';
7
+ import { DistanceMilage, LineDetail, ReimbursementTypeCode } from '../../../../entity/reimbursement/reimbursementState';
6
8
  import { Attachment } from '../../../../entity/transaction/stateTypes/attachment';
7
9
  export interface EditRemiDetail {
8
10
  fetchStatus: FetchStateAndError;
@@ -14,7 +16,18 @@ export interface EditRemiDetail {
14
16
  remiDetailLocalData: RemiDetailLocalData;
15
17
  }
16
18
  export declare const initialRemiDetail: EditRemiDetail;
17
- export interface OutofPocketReimbursementLineWithRecommendation extends Partial<OutofPocketReimbursementLine> {
19
+ export interface SegregatedReimbursementLine {
20
+ lineId: ID;
21
+ type: ReimbursementTypeCode;
22
+ fileId?: ID;
23
+ homeCurrencyConversions: Amount;
24
+ mileage: Partial<MilageLine>;
25
+ outOfPocket: Partial<OutofPocketLine>;
26
+ }
27
+ export interface SegregatedReimbursementLineWithRecommendation extends SegregatedReimbursementLine {
28
+ outOfPocket: OutofPocketReimbursementLineWithRecommendation;
29
+ }
30
+ export interface OutofPocketReimbursementLineWithRecommendation extends Partial<OutofPocketLine> {
18
31
  recommendations: Recommendation[];
19
32
  recommendedAccount?: RecommendedAccountBase;
20
33
  isCategoryUpdateSelected: boolean;
@@ -22,20 +35,30 @@ export interface OutofPocketReimbursementLineWithRecommendation extends Partial<
22
35
  retainedAccount?: AccountBase;
23
36
  isRetainedCategorySelected: boolean;
24
37
  }
25
- export declare type ReimbursementLineWithRecommendation = Partial<MilageReimbursementLine> | OutofPocketReimbursementLineWithRecommendation;
38
+ export interface OutofPocketLine extends ReimbursementBaseLineWithoutType {
39
+ merchant: MerchantBase;
40
+ }
41
+ export interface MilageLine extends ReimbursementBaseLineWithoutType {
42
+ distanceMileage: DistanceMilage;
43
+ }
44
+ export interface ReimbursementBaseLineWithoutType extends Amount {
45
+ lineDetail: LineDetail;
46
+ transactionDate: ZeniDate;
47
+ description: string;
48
+ }
26
49
  export interface EditRemiDetailViewState {
27
50
  newRemiState: EditRemiDetail;
28
51
  editRemiStateById: Record<ID, EditRemiDetail>;
29
52
  }
53
+ export interface WhatForSection {
54
+ reportTitle?: string;
55
+ }
30
56
  export interface RemiDetailLocalData {
31
57
  whatForSection?: WhatForSection;
32
- updatesByLineId: Record<ID, ReimbursementLineWithRecommendation>;
58
+ updatesByLineId: Record<ID, SegregatedReimbursementLineWithRecommendation>;
33
59
  currencyConversionStateByLineId: Record<ID, FetchStateAndError>;
34
60
  totalAmount?: Amount;
35
61
  files?: Attachment[];
36
62
  paymentTo?: ID;
37
63
  }
38
- export interface WhatForSection {
39
- reportTitle?: string;
40
- }
41
64
  export declare type AutoFields = ('merchant' | 'transactionDate' | 'amount' | 'memo' | 'account' | 'class')[];
@@ -15,7 +15,7 @@ const fetchCurrencyConversionValueEpic = (actions$, state$, zeniAPI) => actions$
15
15
  state.editRemiDetailViewState.editRemiStateById[reimbursementId]
16
16
  .remiDetailLocalData;
17
17
  }
18
- const currentAmountDetails = remiDetailLocalData.updatesByLineId[lineId];
18
+ const currentAmountDetails = remiDetailLocalData.updatesByLineId[lineId].outOfPocket;
19
19
  const payload = {
20
20
  amount: {
21
21
  amount: (_a = currentAmountDetails.amount) !== null && _a !== void 0 ? _a : 0,
@@ -92,8 +92,8 @@ state$) => actions$.pipe((0, operators_1.filter)(editRemiViewReducer_1.waitForMe
92
92
  var _a, _b;
93
93
  return reimbursementLineWithRecommendation.type ===
94
94
  'out_of_pocket' &&
95
- (((_a = reimbursementLineWithRecommendation.merchant) === null || _a === void 0 ? void 0 : _a.id) === entityIdOrName ||
96
- ((_b = reimbursementLineWithRecommendation.merchant) === null || _b === void 0 ? void 0 : _b.name) === entityIdOrName);
95
+ (((_a = reimbursementLineWithRecommendation.outOfPocket.merchant) === null || _a === void 0 ? void 0 : _a.id) === entityIdOrName ||
96
+ ((_b = reimbursementLineWithRecommendation.outOfPocket.merchant) === null || _b === void 0 ? void 0 : _b.name) === entityIdOrName);
97
97
  });
98
98
  const lineIds = lineDetails
99
99
  .map((lineDetail) => lineDetail.lineId)
@@ -1,10 +1,10 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
- import { initializeRemiToLocalStore, saveRemiUpdatesToLocalStore } from '../editRemiViewReducer';
4
3
  import { RootState } from '../../../../../reducer';
5
4
  import { Recommendation } from '../../../../../commonStateTypes/recommendationBase';
6
5
  import { AccountBase, RecommendedAccountBase } from '../../../../../entity/account/accountState';
7
6
  import { ClassBase, RecommendedClassBase } from '../../../../../entity/class/classState';
7
+ import { initializeRemiToLocalStore, saveRemiUpdatesToLocalStore } from '../editRemiViewReducer';
8
8
  export declare type ActionType = ReturnType<typeof initializeRemiToLocalStore> | ReturnType<typeof saveRemiUpdatesToLocalStore>;
9
9
  export declare const initializeRemiToLocalStoreEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
10
10
  export declare const getRecommendedCategoryClass: (recommendation?: Recommendation[] | undefined, account?: AccountBase | undefined, classObj?: ClassBase | undefined) => {
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRecommendedCategoryClass = exports.initializeRemiToLocalStoreEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
- const editRemiViewReducer_1 = require("../editRemiViewReducer");
7
6
  const merchantSelector_1 = require("../../../../../entity/merchant/merchantSelector");
7
+ const editRemiViewReducer_1 = require("../editRemiViewReducer");
8
8
  const initializeRemiToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editRemiViewReducer_1.initializeRemiToLocalStore.match), (0, operators_1.mergeMap)((action) => {
9
9
  var _a, _b;
10
10
  const { reimbursementId } = action.payload;
@@ -17,23 +17,67 @@ const initializeRemiToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
17
17
  const isPendingApproval = reimbursement.reimbursementInfo.stage.code === 'pending_approval';
18
18
  const updatesByLineId = {};
19
19
  (_a = reimbursement.lines) === null || _a === void 0 ? void 0 : _a.forEach((line) => {
20
- var _a, _b;
20
+ var _a, _b, _c;
21
21
  if (line.type === 'out_of_pocket') {
22
22
  const merchantId = (_a = line.merchant) === null || _a === void 0 ? void 0 : _a.id;
23
23
  const merchant = merchantId != null
24
24
  ? (0, merchantSelector_1.getMerchantByMerchantId)(state.merchantState, merchantId)
25
25
  : undefined;
26
26
  const { recommendedAccount } = (0, exports.getRecommendedCategoryClass)(merchant === null || merchant === void 0 ? void 0 : merchant.recommendations, line.lineDetail.account, line.lineDetail.class);
27
- updatesByLineId[line.lineId] = Object.assign(Object.assign({}, line), { recommendations: (_b = merchant === null || merchant === void 0 ? void 0 : merchant.recommendations) !== null && _b !== void 0 ? _b : [], recommendedAccount, isCategoryUpdateSelected: false, isCategoryFirstTimeAutofilled: false, isRetainedCategorySelected: false });
27
+ updatesByLineId[line.lineId] = {
28
+ lineId: line.lineId,
29
+ type: line.type,
30
+ fileId: line.fileId,
31
+ homeCurrencyConversions: line.homeCurrencyConversions,
32
+ outOfPocket: {
33
+ recommendations: (_b = merchant === null || merchant === void 0 ? void 0 : merchant.recommendations) !== null && _b !== void 0 ? _b : [],
34
+ recommendedAccount,
35
+ isCategoryUpdateSelected: false,
36
+ isCategoryFirstTimeAutofilled: false,
37
+ isRetainedCategorySelected: false,
38
+ merchant: {
39
+ id: merchant === null || merchant === void 0 ? void 0 : merchant.id,
40
+ name: (_c = merchant === null || merchant === void 0 ? void 0 : merchant.name) !== null && _c !== void 0 ? _c : '',
41
+ },
42
+ amount: line.amount,
43
+ currencyCode: line.currencyCode,
44
+ currencySymbol: line.currencySymbol,
45
+ description: line.description,
46
+ transactionDate: line.transactionDate,
47
+ lineDetail: line.lineDetail,
48
+ },
49
+ mileage: {},
50
+ };
28
51
  //show retain checkbox only in pending approval
29
52
  if (isPendingApproval) {
30
- updatesByLineId[line.lineId] = Object.assign(Object.assign({}, updatesByLineId[line.lineId]), { retainedAccount: recommendedAccount != null
31
- ? line.lineDetail.account
32
- : undefined, isRetainedCategorySelected: false });
53
+ updatesByLineId[line.lineId] = Object.assign(Object.assign({}, updatesByLineId[line.lineId]), { outOfPocket: Object.assign(Object.assign({}, updatesByLineId[line.lineId].outOfPocket), { retainedAccount: recommendedAccount != null
54
+ ? line.lineDetail.account
55
+ : undefined, isRetainedCategorySelected: false }) });
33
56
  }
34
57
  }
35
58
  else {
36
- updatesByLineId[line.lineId] = line;
59
+ updatesByLineId[line.lineId] = {
60
+ lineId: line.lineId,
61
+ type: line.type,
62
+ fileId: line.fileId,
63
+ homeCurrencyConversions: line.homeCurrencyConversions,
64
+ mileage: {
65
+ lineDetail: line.lineDetail,
66
+ amount: line.amount,
67
+ currencyCode: line.currencyCode,
68
+ currencySymbol: line.currencySymbol,
69
+ description: line.description,
70
+ transactionDate: line.transactionDate,
71
+ distanceMileage: line
72
+ .distanceMileage,
73
+ },
74
+ outOfPocket: {
75
+ recommendations: [],
76
+ isCategoryFirstTimeAutofilled: false,
77
+ isRetainedCategorySelected: false,
78
+ isCategoryUpdateSelected: false,
79
+ },
80
+ };
37
81
  }
38
82
  });
39
83
  const currencyConversionStateByLineId = {};