@zeniai/client-epic-state 5.1.21 → 5.1.23-betaRD1

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 (35) hide show
  1. package/README.md +2 -1
  2. package/lib/epic.d.ts +2 -1
  3. package/lib/epic.js +2 -1
  4. package/lib/esm/epic.js +2 -1
  5. package/lib/esm/index.js +2 -2
  6. package/lib/esm/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.js +1 -0
  7. package/lib/esm/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +6 -1
  8. package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -1
  9. package/lib/esm/view/opExByVendor/opExByVendorReducer.js +28 -5
  10. package/lib/esm/view/opExByVendor/opExByVendorSelector.js +1 -0
  11. package/lib/esm/view/opExByVendor/refreshOpExByVendorReportEpic.js +21 -0
  12. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +9 -1
  13. package/lib/esm/view/transactionDetail/epics/updateTransactionDetailEpic.js +8 -0
  14. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +13 -0
  15. package/lib/index.d.ts +2 -2
  16. package/lib/index.js +34 -33
  17. package/lib/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.js +1 -0
  18. package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.d.ts +8 -0
  19. package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.d.ts +2 -1
  20. package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +6 -1
  21. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -1
  22. package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +2 -0
  23. package/lib/view/opExByVendor/opExByVendorReducer.d.ts +6 -1
  24. package/lib/view/opExByVendor/opExByVendorReducer.js +29 -6
  25. package/lib/view/opExByVendor/opExByVendorSelector.d.ts +1 -0
  26. package/lib/view/opExByVendor/opExByVendorSelector.js +1 -0
  27. package/lib/view/opExByVendor/opExByVendorState.d.ts +1 -0
  28. package/lib/view/opExByVendor/refreshOpExByVendorReportEpic.d.ts +17 -0
  29. package/lib/view/opExByVendor/refreshOpExByVendorReportEpic.js +25 -0
  30. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +9 -1
  31. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +8 -0
  32. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +13 -0
  33. package/lib/view/transactionDetail/transactionDetailState.d.ts +1 -0
  34. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +1 -0
  35. package/package.json +4 -2
@@ -11,7 +11,7 @@ const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
11
11
  const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
12
12
  function getExpenseAutomationFluxAnalysisView(state) {
13
13
  const { expenseAutomationFluxAnalysisViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
14
- const { fetchState, error, refreshStatus, uiState, reviewOperatingExpenseIdsByPeriod, selectedSectionIdsByPeriod, groupsBySelectedPeriod, fluxAnalysisEntities, bulkReviewStatus, currency, totalBalancesAndVariance, } = expenseAutomationFluxAnalysisViewState;
14
+ const { fetchState, error, lastRefreshSuccessTime, refreshStatus, uiState, reviewOperatingExpenseIdsByPeriod, selectedSectionIdsByPeriod, groupsBySelectedPeriod, fluxAnalysisEntities, bulkReviewStatus, currency, totalBalancesAndVariance, } = expenseAutomationFluxAnalysisViewState;
15
15
  const fetchStateAndError = {
16
16
  fetchState,
17
17
  error,
@@ -113,6 +113,7 @@ function getExpenseAutomationFluxAnalysisView(state) {
113
113
  refreshStatus,
114
114
  currency,
115
115
  completionStatus,
116
+ lastRefreshSuccessTime,
116
117
  };
117
118
  }
118
119
  // Helper function to transform operating expense to vendor view
@@ -5,6 +5,7 @@ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderType
5
5
  import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
6
6
  import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
7
7
  import { FluxAnalysisSectionType } from '../selectorTypes/fluxAnalysisViewSelectorTypes';
8
+ import { ZeniDate } from '../../../zeniDayJS';
8
9
  declare const toFluxAnalysisSortKey: (v: string) => "vendor" | "status" | "variance";
9
10
  export type FluxAnalysisSortKey = ReturnType<typeof toFluxAnalysisSortKey>;
10
11
  export type FluxAnalysisActionType = 'review' | 'unreview';
@@ -75,5 +76,6 @@ export interface FluxAnalysisViewState extends FetchedState {
75
76
  selectedSectionIdsByPeriod: Record<MonthYearPeriodId, FluxAnalysisSectionType[]>;
76
77
  totalBalancesAndVariance: BalancesAndVariance | undefined;
77
78
  uiState: FluxAnalysisViewUIState;
79
+ lastRefreshSuccessTime?: ZeniDate;
78
80
  }
79
81
  export {};
@@ -3,6 +3,7 @@ import { COABalanceType } from '../../commonStateTypes/coaBalance/coaBalanceType
3
3
  import { FetchState } from '../../commonStateTypes/common';
4
4
  import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
5
5
  import { ZeniAPIStatus } from '../../responsePayload';
6
+ import { ZeniDate } from '../../zeniDayJS';
6
7
  import { OpexByVendorReportPayload, OpexByVendorReportSummaryPayload } from './opExByVendorPayload';
7
8
  import { OpExByVendorQuery, OpExByVendorState, OpexByVendorSortKey } from './opExByVendorState';
8
9
  export declare const defaultTimeframePeriodsOpExByVendor: {
@@ -52,6 +53,10 @@ export declare const fetchOpExByVendor: import("@reduxjs/toolkit").ActionCreator
52
53
  }, "opExByVendor/clearOpExByVendorSearch">, updateOpExByVendorPageLimit: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<number | undefined, "opExByVendor/updateOpExByVendorPageLimit">, updateOpExByVendorSearchString: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
53
54
  searchText: string;
54
55
  timeframe: COABalanceMonthQuarterTimeframe;
55
- }, "opExByVendor/updateOpExByVendorSearchString">;
56
+ }, "opExByVendor/updateOpExByVendorSearchString">, refreshOpExByVendorReport: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"opExByVendor/refreshOpExByVendorReport">, refreshOpExByVendorReportSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
57
+ lastRefreshSuccessTime: ZeniDate | undefined;
58
+ }, "opExByVendor/refreshOpExByVendorReportSuccess">, refreshOpExByVendorReportFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], {
59
+ error: ZeniAPIStatus<Record<string, unknown>>;
60
+ }, "opExByVendor/refreshOpExByVendorReportFailure", never, never>;
56
61
  declare const _default: import("redux").Reducer<OpExByVendorState>;
57
62
  export default _default;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.updateOpExByVendorSearchString = exports.updateOpExByVendorPageLimit = exports.clearOpExByVendorSearch = exports.updateOpExByVendorDownloadState = exports.updateOpExByVendorPageFetchInProgress = exports.updateOpExByVendorSortOrSearchInProgress = exports.updateOpExByVendorSort = exports.updateOpExByVendorAdditionalBalancesSelection = exports.clearOpExByVendor = exports.updateOpExByVendorUIState = exports.updateOpExByVendorTimeFrame = exports.updateOpExByVendorReportSummarySuccess = exports.updateOpExByVendorReportSummaryFailure = exports.fetchOpExByVendorReportSummary = exports.updateOpExByVendorReportSuccessForTimeframe = exports.updateOpExByVendorReportFailureForTimeframe = exports.fetchOpExByVendorReportForTimeframe = exports.updateOpExByVendorReportGenerated = exports.fetchOpExByVendor = exports.initialState = exports.initialSearchStringState = exports.defaultTimeframePeriodsOpExByVendor = void 0;
4
+ exports.refreshOpExByVendorReportFailure = exports.refreshOpExByVendorReportSuccess = exports.refreshOpExByVendorReport = exports.updateOpExByVendorSearchString = exports.updateOpExByVendorPageLimit = exports.clearOpExByVendorSearch = exports.updateOpExByVendorDownloadState = exports.updateOpExByVendorPageFetchInProgress = exports.updateOpExByVendorSortOrSearchInProgress = exports.updateOpExByVendorSort = exports.updateOpExByVendorAdditionalBalancesSelection = exports.clearOpExByVendor = exports.updateOpExByVendorUIState = exports.updateOpExByVendorTimeFrame = exports.updateOpExByVendorReportSummarySuccess = exports.updateOpExByVendorReportSummaryFailure = exports.fetchOpExByVendorReportSummary = exports.updateOpExByVendorReportSuccessForTimeframe = exports.updateOpExByVendorReportFailureForTimeframe = exports.fetchOpExByVendorReportForTimeframe = exports.updateOpExByVendorReportGenerated = exports.fetchOpExByVendor = exports.initialState = exports.initialSearchStringState = exports.defaultTimeframePeriodsOpExByVendor = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const coaBalancePayload_1 = require("../../commonPayloadTypes/v2/coaBalancePayload");
7
7
  const viewAndReportPayload_1 = require("../../commonPayloadTypes/viewAndReportPayload");
@@ -26,6 +26,10 @@ exports.initialState = {
26
26
  error: undefined,
27
27
  },
28
28
  },
29
+ refreshStatus: {
30
+ fetchState: 'Not-Started',
31
+ error: undefined,
32
+ },
29
33
  summaryFetchState: {
30
34
  fetchState: 'Not-Started',
31
35
  error: undefined,
@@ -263,12 +267,32 @@ const opexByVendor = (0, toolkit_1.createSlice)({
263
267
  [timeframe]: [],
264
268
  };
265
269
  },
270
+ refreshOpExByVendorReport(draft) {
271
+ draft.refreshStatus = { fetchState: 'In-Progress', error: undefined };
272
+ },
273
+ refreshOpExByVendorReportSuccess(draft, action) {
274
+ draft.refreshStatus = { fetchState: 'Completed', error: undefined };
275
+ if (action.payload.lastRefreshSuccessTime != null) {
276
+ draft.lastRefreshSuccessTime = action.payload.lastRefreshSuccessTime;
277
+ }
278
+ },
279
+ refreshOpExByVendorReportFailure: {
280
+ prepare(error) {
281
+ return { payload: { error } };
282
+ },
283
+ reducer(draft, action) {
284
+ draft.refreshStatus = {
285
+ fetchState: 'Error',
286
+ error: action.payload.error,
287
+ };
288
+ },
289
+ },
266
290
  clearOpExByVendor(draft) {
267
291
  Object.assign(draft, exports.initialState);
268
292
  },
269
293
  },
270
294
  });
271
- _a = opexByVendor.actions, exports.fetchOpExByVendor = _a.fetchOpExByVendor, exports.updateOpExByVendorReportGenerated = _a.updateOpExByVendorReportGenerated, exports.fetchOpExByVendorReportForTimeframe = _a.fetchOpExByVendorReportForTimeframe, exports.updateOpExByVendorReportFailureForTimeframe = _a.updateOpExByVendorReportFailureForTimeframe, exports.updateOpExByVendorReportSuccessForTimeframe = _a.updateOpExByVendorReportSuccessForTimeframe, exports.fetchOpExByVendorReportSummary = _a.fetchOpExByVendorReportSummary, exports.updateOpExByVendorReportSummaryFailure = _a.updateOpExByVendorReportSummaryFailure, exports.updateOpExByVendorReportSummarySuccess = _a.updateOpExByVendorReportSummarySuccess, exports.updateOpExByVendorTimeFrame = _a.updateOpExByVendorTimeFrame, exports.updateOpExByVendorUIState = _a.updateOpExByVendorUIState, exports.clearOpExByVendor = _a.clearOpExByVendor, exports.updateOpExByVendorAdditionalBalancesSelection = _a.updateOpExByVendorAdditionalBalancesSelection, exports.updateOpExByVendorSort = _a.updateOpExByVendorSort, exports.updateOpExByVendorSortOrSearchInProgress = _a.updateOpExByVendorSortOrSearchInProgress, exports.updateOpExByVendorPageFetchInProgress = _a.updateOpExByVendorPageFetchInProgress, exports.updateOpExByVendorDownloadState = _a.updateOpExByVendorDownloadState, exports.clearOpExByVendorSearch = _a.clearOpExByVendorSearch, exports.updateOpExByVendorPageLimit = _a.updateOpExByVendorPageLimit, exports.updateOpExByVendorSearchString = _a.updateOpExByVendorSearchString;
295
+ _a = opexByVendor.actions, exports.fetchOpExByVendor = _a.fetchOpExByVendor, exports.updateOpExByVendorReportGenerated = _a.updateOpExByVendorReportGenerated, exports.fetchOpExByVendorReportForTimeframe = _a.fetchOpExByVendorReportForTimeframe, exports.updateOpExByVendorReportFailureForTimeframe = _a.updateOpExByVendorReportFailureForTimeframe, exports.updateOpExByVendorReportSuccessForTimeframe = _a.updateOpExByVendorReportSuccessForTimeframe, exports.fetchOpExByVendorReportSummary = _a.fetchOpExByVendorReportSummary, exports.updateOpExByVendorReportSummaryFailure = _a.updateOpExByVendorReportSummaryFailure, exports.updateOpExByVendorReportSummarySuccess = _a.updateOpExByVendorReportSummarySuccess, exports.updateOpExByVendorTimeFrame = _a.updateOpExByVendorTimeFrame, exports.updateOpExByVendorUIState = _a.updateOpExByVendorUIState, exports.clearOpExByVendor = _a.clearOpExByVendor, exports.updateOpExByVendorAdditionalBalancesSelection = _a.updateOpExByVendorAdditionalBalancesSelection, exports.updateOpExByVendorSort = _a.updateOpExByVendorSort, exports.updateOpExByVendorSortOrSearchInProgress = _a.updateOpExByVendorSortOrSearchInProgress, exports.updateOpExByVendorPageFetchInProgress = _a.updateOpExByVendorPageFetchInProgress, exports.updateOpExByVendorDownloadState = _a.updateOpExByVendorDownloadState, exports.clearOpExByVendorSearch = _a.clearOpExByVendorSearch, exports.updateOpExByVendorPageLimit = _a.updateOpExByVendorPageLimit, exports.updateOpExByVendorSearchString = _a.updateOpExByVendorSearchString, exports.refreshOpExByVendorReport = _a.refreshOpExByVendorReport, exports.refreshOpExByVendorReportSuccess = _a.refreshOpExByVendorReportSuccess, exports.refreshOpExByVendorReportFailure = _a.refreshOpExByVendorReportFailure;
272
296
  exports.default = opexByVendor.reducer;
273
297
  const doUpdateOpexByVendorReport = (draft, timeframe, reportPayload, queryProps) => {
274
298
  if (reportPayload.status.is_report_generated == null) {
@@ -321,10 +345,9 @@ const doUpdateOpexByVendorReportSummary = (draft, reportPayload) => {
321
345
  const report = (0, viewAndReportPayload_1.mapReportPayloadToReport)(reportPayload);
322
346
  draft.firstMonthOfFY = report.firstMonthOfFY;
323
347
  draft.bookCloseDate = report.bookCloseDate;
324
- draft.lastRefreshSuccessTime =
325
- reportPayload.status.last_refresh_success_time != null
326
- ? (0, zeniDayJS_1.date)(reportPayload.status.last_refresh_success_time)
327
- : undefined;
348
+ if (reportPayload.status.last_refresh_success_time != null) {
349
+ draft.lastRefreshSuccessTime = (0, zeniDayJS_1.date)(reportPayload.status.last_refresh_success_time);
350
+ }
328
351
  draft.totalOpexByVendor = (0, coaBalancePayload_1.combineCOABalanceGrouped)((0, coaBalancePayload_1.mapCOABalanceGroupedPayloadV2ToCOABalanceGrouped)(reportPayload.operating_expenses, reportPayload.currency, 'month'), (0, coaBalancePayload_1.mapCOABalanceGroupedPayloadV2ToCOABalanceGrouped)(reportPayload.operating_expenses, reportPayload.currency, 'quarter'));
329
352
  draft.summaryOpexByVendorKey = mapVendorSummaryBalances(reportPayload.operating_expenses, reportPayload.currency);
330
353
  }
@@ -28,6 +28,7 @@ export interface OpExByVendorReport extends SelectorReport {
28
28
  filter: COABalancesFilter;
29
29
  isReportGenerated: boolean;
30
30
  opexBalances: OpExBalancesByVendor[];
31
+ refreshStatus: FetchStateAndError;
31
32
  reportFetchState: {
32
33
  month: FetchStateAndError;
33
34
  quarter: FetchStateAndError;
@@ -71,6 +71,7 @@ exports.getOpExByVendorReport = (0, toolkit_1.createSelector)((state) => state.o
71
71
  filter,
72
72
  isReportGenerated: opExByVendorState.opExByVendorReportGenerated,
73
73
  lastRefreshSuccessTime: opExByVendorState.lastRefreshSuccessTime,
74
+ refreshStatus: opExByVendorState.refreshStatus,
74
75
  opexBalances,
75
76
  summaryBalances,
76
77
  allTimeframeTicks,
@@ -65,6 +65,7 @@ export interface OpExByVendorState extends Omit<Report, 'dataAvailable'> {
65
65
  quarter: OpexVendorKey[];
66
66
  };
67
67
  opExByVendorReportGenerated: boolean;
68
+ refreshStatus: FetchStateAndError;
68
69
  reportFetchState: {
69
70
  month: FetchStateAndError;
70
71
  quarter: FetchStateAndError;
@@ -0,0 +1,17 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../reducer';
3
+ import { ZeniAPIStatus } from '../../responsePayload';
4
+ import { ZeniAPI } from '../../zeniAPI';
5
+ import { refreshOpExByVendorReport, refreshOpExByVendorReportFailure, refreshOpExByVendorReportSuccess } from './opExByVendorReducer';
6
+ export type ActionType = ReturnType<typeof refreshOpExByVendorReport> | ReturnType<typeof refreshOpExByVendorReportSuccess> | ReturnType<typeof refreshOpExByVendorReportFailure>;
7
+ export declare const refreshOpExByVendorReportEpic: (actions$: ActionsObservable<ActionType>, _state: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
8
+ payload: {
9
+ lastRefreshSuccessTime: import("../../zeniDayJS").ZeniDate | undefined;
10
+ };
11
+ type: "opExByVendor/refreshOpExByVendorReportSuccess";
12
+ } | {
13
+ payload: {
14
+ error: ZeniAPIStatus<Record<string, unknown>>;
15
+ };
16
+ type: "opExByVendor/refreshOpExByVendorReportFailure";
17
+ }>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.refreshOpExByVendorReportEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../responsePayload");
7
+ const zeniDayJS_1 = require("../../zeniDayJS");
8
+ const opExByVendorReducer_1 = require("./opExByVendorReducer");
9
+ const refreshOpExByVendorReportEpic = (actions$, _state, zeniAPI) => actions$.pipe((0, operators_1.filter)(opExByVendorReducer_1.refreshOpExByVendorReport.match), (0, operators_1.switchMap)(() => {
10
+ return zeniAPI
11
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/reports/operating-expenses-by-vendor/refresh`)
12
+ .pipe((0, operators_1.mergeMap)((response) => {
13
+ if (response.status.code >= 200 && response.status.code < 300) {
14
+ const lastRefreshSuccessTime = response.status.last_refresh_success_time != null
15
+ ? (0, zeniDayJS_1.date)(response.status.last_refresh_success_time)
16
+ : undefined;
17
+ return (0, rxjs_1.of)((0, opExByVendorReducer_1.refreshOpExByVendorReportSuccess)({ lastRefreshSuccessTime }));
18
+ }
19
+ else {
20
+ return (0, rxjs_1.of)((0, opExByVendorReducer_1.refreshOpExByVendorReportFailure)(response.status));
21
+ }
22
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, opExByVendorReducer_1.refreshOpExByVendorReportFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Refresh OpEx by Vendor REST API call errored out: ' +
23
+ JSON.stringify(error))))));
24
+ }));
25
+ exports.refreshOpExByVendorReportEpic = refreshOpExByVendorReportEpic;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isTransactionUncategorized = exports.isTransactionMiscategorized = exports.toRecommendedClassBase = exports.toRecommendedAccountBase = exports.toTransactionUpdatesFromTransactionDetailLocalData = void 0;
4
4
  const recommendationBase_1 = require("../../../commonStateTypes/recommendationBase");
5
+ const customerTransaction_1 = require("../../../entity/transaction/stateTypes/customerTransaction");
5
6
  const transactionType_1 = require("../../../entity/transaction/stateTypes/transactionType");
6
7
  const vendorTransaction_1 = require("../../../entity/transaction/stateTypes/vendorTransaction");
7
8
  const transactionHelper_1 = require("../../../entity/transaction/transactionHelper");
@@ -33,6 +34,10 @@ const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLoc
33
34
  const isTransactionMisCategorized = (0, exports.isTransactionMiscategorized)(transaction, isExpenseAutomationEnabled);
34
35
  updates.memo = transactionDetailLocalData.memo;
35
36
  updates.documentId = transactionDetailLocalData.documentId;
37
+ // For invoice and credit_memo, project is at the transaction level.
38
+ if ((0, customerTransaction_1.isCustomerTransaction)(transaction)) {
39
+ updates.project = transactionDetailLocalData.project;
40
+ }
36
41
  const selectedEntity = transactionDetailLocalData.selectedEntity;
37
42
  const updatedEntityId = transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor ===
38
43
  true
@@ -55,7 +60,10 @@ const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLoc
55
60
  lineDescription: lineItem.lineDescription,
56
61
  class: lineItem.class,
57
62
  account: lineItem.account,
58
- project: lineItem.project,
63
+ // Project is at the transaction level for invoice/credit_memo; omit from lines.
64
+ ...(!(0, customerTransaction_1.isCustomerTransaction)(transaction)
65
+ ? { project: lineItem.project }
66
+ : {}),
59
67
  recommendation: (0, transactionHelper_1.convertCOTRecommendationsToRegular)(lineItem.recommendationsWithCOT),
60
68
  };
61
69
  if (line.type === 'journal_entry_transaction_line' ||
@@ -233,6 +233,14 @@ const toTransactionUpdatePayload = (updates, detail, cotTransactionTracking, ven
233
233
  let basePayload;
234
234
  if ((0, customerTransaction_1.isCustomerTransaction)(transaction)) {
235
235
  basePayload = (0, customerTransactionPayload_1.toCustomerTransactionPayload)(transaction);
236
+ // For invoice/credit_memo, project is at the transaction level; inject it here.
237
+ if (updates.project != null) {
238
+ basePayload = {
239
+ ...basePayload,
240
+ accounting_project_id: updates.project.projectId,
241
+ accounting_project_name: updates.project.projectName,
242
+ };
243
+ }
236
244
  }
237
245
  else if ((0, vendorTransaction_1.isVendorTransaction)(transaction)) {
238
246
  if (tranSelectedEntity != null && tranSelectedEntity.type === 'customer') {
@@ -15,6 +15,13 @@ const toTransactionDetailLocalData = (transaction, defaultVendorId, uncategorize
15
15
  const vendorId = defaultVendorId ?? transaction.vendor?.id;
16
16
  transactionLocal.memo = transaction.memo;
17
17
  transactionLocal.documentId = transaction.documentId;
18
+ // For invoice and credit_memo, project is at the transaction level (not on lines).
19
+ if ((0, customerTransaction_1.isCustomerTransaction)(transaction) && transaction.projectId != null) {
20
+ transactionLocal.project = {
21
+ projectId: transaction.projectId,
22
+ projectName: transaction.projectName ?? '',
23
+ };
24
+ }
18
25
  transactionLocal.vendorUpdates =
19
26
  (0, vendorTransaction_1.isVendorTransaction)(transaction) && vendorId != null
20
27
  ? {
@@ -429,6 +436,7 @@ const toUpdateLineItemsOriginalCategoryClass = (transaction, transactionDetailLo
429
436
  ...transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData,
430
437
  memo: transactionDetailLocalData.memo,
431
438
  documentId: transactionDetailLocalData.documentId,
439
+ project: transactionDetailLocalData.project,
432
440
  lineItemById: newLineItems,
433
441
  vendorDetails: transactionDetailLocalData.vendorDetails,
434
442
  vendorUpdates: transactionDetailLocalData.vendorUpdates,
@@ -534,6 +542,7 @@ const toSetAllLineItemsToCategoryClass = (transaction, transactionDetailLocalDat
534
542
  ...transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData,
535
543
  memo: transactionDetailLocalData.memo,
536
544
  documentId: transactionDetailLocalData.documentId,
545
+ project: transactionDetailLocalData.project,
537
546
  lineItemById: newLineItems,
538
547
  vendorUpdates: transactionDetailLocalData.vendorUpdates,
539
548
  vendorDetails: transactionDetailLocalData.vendorDetails,
@@ -580,6 +589,7 @@ const toSetAllLineItemsLocalDataIsUpdateAllChecked = (transaction, transactionDe
580
589
  ...transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData,
581
590
  memo: transactionDetailLocalData.memo,
582
591
  documentId: transactionDetailLocalData.documentId,
592
+ project: transactionDetailLocalData.project,
583
593
  lineItemById: newLineItems,
584
594
  vendorDetails: transactionDetailLocalData.vendorDetails,
585
595
  vendorUpdates: transactionDetailLocalData.vendorUpdates,
@@ -738,6 +748,7 @@ const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDet
738
748
  ...transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData,
739
749
  memo: transactionDetailLocalData.memo,
740
750
  documentId: transactionDetailLocalData.documentId,
751
+ project: transactionDetailLocalData.project,
741
752
  lineItemById: newLineItems,
742
753
  vendorUpdates: transactionDetailLocalData.vendorUpdates,
743
754
  vendorDetails: transactionDetailLocalData.vendorDetails,
@@ -792,6 +803,7 @@ const removeEntityRecommendationForLineIdInLocalData = (transaction, transaction
792
803
  ...transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData,
793
804
  memo: transactionDetailLocalData.memo,
794
805
  documentId: transactionDetailLocalData.documentId,
806
+ project: transactionDetailLocalData.project,
795
807
  lineItemById: newLineItems,
796
808
  vendorDetails: transactionDetailLocalData.vendorDetails,
797
809
  vendorUpdates: transactionDetailLocalData.vendorUpdates,
@@ -1015,6 +1027,7 @@ const toUpdateLineItemsToOriginalVendor = (transaction, transactionDetailLocalDa
1015
1027
  ...transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData,
1016
1028
  memo: transactionDetailLocalData.memo,
1017
1029
  documentId: transactionDetailLocalData.documentId,
1030
+ project: transactionDetailLocalData.project,
1018
1031
  lineItemById: newLineItems,
1019
1032
  isVendorUpdateAllChecked: false,
1020
1033
  latestUpdatedLineWithEntity: transactionDetailLocalData.latestUpdatedLineWithEntity,
@@ -62,6 +62,7 @@ export interface TransactionUpdates {
62
62
  customerId?: ID;
63
63
  documentId?: string;
64
64
  memo?: string;
65
+ project?: ProjectBase;
65
66
  vendorId?: ID;
66
67
  }
67
68
  export interface EntityRelatedRecommendationUpdates {
@@ -54,6 +54,7 @@ export interface TransactionDetailLocalData {
54
54
  latestSelectedEntityOnLineItem?: Entity;
55
55
  latestUpdatedLineWithEntity?: ID;
56
56
  memo?: string;
57
+ project?: ProjectBase;
57
58
  selectedEntity?: Entity;
58
59
  updatePreviousTransactionsWithUpdatedVendor?: boolean;
59
60
  vendorDetails?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.21",
3
+ "version": "5.1.23-betaRD1",
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
  "module": "lib/esm/index.js",
@@ -79,6 +79,7 @@
79
79
  "ts-prune": "^0.10.3",
80
80
  "ts-unused-exports": "^11.0.1",
81
81
  "typescript": "^5.7.3",
82
+ "vite": "^7.3.5",
82
83
  "vitest": "^4.1.8"
83
84
  },
84
85
  "dependencies": {
@@ -129,7 +130,8 @@
129
130
  "postversion": "git push && git push --tags",
130
131
  "check-dependencies": "node ./scripts/check_dependencies.js",
131
132
  "clean-overrides": "node ./scripts/clean_overrides.js",
132
- "create-release-branch": "chmod +x ./scripts/create_release_branch.sh && ./scripts/create_release_branch.sh",
133
+ "create-or-update-release-branch": "chmod +x ./scripts/create_or_update_release_branch.sh && ./scripts/create_or_update_release_branch.sh",
134
+ "bump-versions-master": "chmod +x ./scripts/bump_versions_master.sh && ./scripts/bump_versions_master.sh",
133
135
  "bump-update-web-app-cockpit-beta": "chmod +x ./scripts/bump_and_update_web_app_ui_beta.sh && ./scripts/bump_and_update_web_app_ui_beta.sh",
134
136
  "send-release-notes": "chmod +x ./scripts/send_release_notes.sh && ./scripts/send_release_notes.sh",
135
137
  "update-slack-group-topic": "chmod +x ./scripts/update-slack-group-topic.sh && ./scripts/update-slack-group-topic.sh",