@zeniai/client-epic-state 5.1.25-betaRD1 → 5.1.25-betaRD2

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.
@@ -167,7 +167,7 @@ function preparePayload(transactionState, vendorState, transactionDetailState, t
167
167
  }
168
168
  return undefined;
169
169
  }
170
- const toTransactionUpdatePayload = (updates, detail, cotTransactionTracking, isAccountingProjectsEnabled, vendorUpdates, customerUpdates, tranSelectedEntity) => {
170
+ export const toTransactionUpdatePayload = (updates, detail, cotTransactionTracking, isAccountingProjectsEnabled, vendorUpdates, customerUpdates, tranSelectedEntity) => {
171
171
  const transaction = Object.assign({}, detail);
172
172
  transaction.memo = updates.memo ?? '';
173
173
  // Unlike `memo` (always reset to '' when absent), `documentId` falls back to
@@ -230,14 +230,23 @@ const toTransactionUpdatePayload = (updates, detail, cotTransactionTracking, isA
230
230
  basePayload = toCustomerTransactionPayload(transaction);
231
231
  // For invoice/credit_memo only, project lives at the transaction level.
232
232
  // Guard behind the projects feature flag to avoid touching the field when
233
- // projects are disabled for this tenant.
233
+ // projects are disabled for this tenant. Clear-project (null injection) is
234
+ // intentionally out of scope for this change — the null write-back path will
235
+ // be added in a follow-up once the backend contract is confirmed.
234
236
  if (isAccountingProjectsEnabled &&
235
237
  (transaction.type === 'invoice' || transaction.type === 'credit_memo') &&
236
238
  updates.project != null) {
237
239
  basePayload = {
238
240
  ...basePayload,
239
241
  accounting_project_id: updates.project.projectId,
240
- accounting_project_integration_id: updates.project.accountingProviderProjectId ?? null,
242
+ // Only spread integration_id when we have a concrete value; omitting it
243
+ // avoids accidentally nulling out the server-side value when the load
244
+ // path didn't surface the field (e.g. list-shaped data or pre-deploy store).
245
+ ...(updates.project.accountingProviderProjectId != null
246
+ ? {
247
+ accounting_project_integration_id: updates.project.accountingProviderProjectId,
248
+ }
249
+ : {}),
241
250
  accounting_project_name: updates.project.projectName,
242
251
  };
243
252
  }
@@ -1,10 +1,18 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { COTTransactionTracking } from '../../../commonStateTypes/recommendationBase';
3
+ import { CustomerBase } from '../../../entity/customer/customerState';
4
+ import { Entity } from '../../../entity/genericEntity/entity';
2
5
  import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
6
+ import { TransactionPayload } from '../../../entity/transaction/payloadTypes/transactionPayload';
3
7
  import { updateTransaction, updateTransactions } from '../../../entity/transaction/transactionReducer';
8
+ import { SupportedTransaction } from '../../../entity/transaction/transactionState';
4
9
  import { updateVendors } from '../../../entity/vendor/vendorReducer';
10
+ import { VendorBase } from '../../../entity/vendor/vendorState';
5
11
  import { RootState } from '../../../reducer';
6
12
  import { ZeniAPI } from '../../../zeniAPI';
7
13
  import { syncTransactionCategorizationFromDetailSave } from '../../expenseAutomationView/reducers/transactionsViewReducer';
8
14
  import { initializeTransactionDetailLocalData, markTransactionAsNotMiscategorized, updateStatusConsolidatedSaveTransactionDetail, updateTransactionDetail, updateTransactionDetailSaveStatus, updateTransactionStateIfUpdateActionNotAllowed } from '../transactionDetailReducer';
15
+ import { TransactionUpdates } from '../transactionDetailState';
9
16
  export type ActionType = ReturnType<typeof updateTransactionDetail> | ReturnType<typeof updateTransaction> | ReturnType<typeof updateTransactions> | ReturnType<typeof updateTransactionStateIfUpdateActionNotAllowed> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateTransactionDetailSaveStatus> | ReturnType<typeof updateStatusConsolidatedSaveTransactionDetail> | ReturnType<typeof initializeTransactionDetailLocalData> | ReturnType<typeof updateVendors> | ReturnType<typeof markTransactionAsNotMiscategorized> | ReturnType<typeof syncTransactionCategorizationFromDetailSave>;
10
17
  export declare const updateTransactionDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
18
+ export declare const toTransactionUpdatePayload: (updates: TransactionUpdates, detail: SupportedTransaction, cotTransactionTracking: COTTransactionTracking, isAccountingProjectsEnabled: boolean, vendorUpdates?: VendorBase, customerUpdates?: CustomerBase, tranSelectedEntity?: Entity) => Partial<TransactionPayload>;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.updateTransactionDetailEpic = void 0;
6
+ exports.toTransactionUpdatePayload = exports.updateTransactionDetailEpic = void 0;
7
7
  const get_1 = __importDefault(require("lodash/get"));
8
8
  const rxjs_1 = require("rxjs");
9
9
  const operators_1 = require("rxjs/operators");
@@ -164,7 +164,7 @@ function preparePayload(transactionState, vendorState, transactionDetailState, t
164
164
  };
165
165
  }
166
166
  if (detail != null) {
167
- const transUpdates = toTransactionUpdatePayload(saveUpdates.updates, detail, cotTransactionTracking, isAccountingProjectsEnabled, vendorUpdates, customerUpdates, currentSelectedEntity);
167
+ const transUpdates = (0, exports.toTransactionUpdatePayload)(saveUpdates.updates, detail, cotTransactionTracking, isAccountingProjectsEnabled, vendorUpdates, customerUpdates, currentSelectedEntity);
168
168
  const entityUpdates = toEntityUpdatePayload(saveUpdates.entityRelatedUpdates);
169
169
  return {
170
170
  entity_related_updates: entityUpdates,
@@ -237,14 +237,23 @@ const toTransactionUpdatePayload = (updates, detail, cotTransactionTracking, isA
237
237
  basePayload = (0, customerTransactionPayload_1.toCustomerTransactionPayload)(transaction);
238
238
  // For invoice/credit_memo only, project lives at the transaction level.
239
239
  // Guard behind the projects feature flag to avoid touching the field when
240
- // projects are disabled for this tenant.
240
+ // projects are disabled for this tenant. Clear-project (null injection) is
241
+ // intentionally out of scope for this change — the null write-back path will
242
+ // be added in a follow-up once the backend contract is confirmed.
241
243
  if (isAccountingProjectsEnabled &&
242
244
  (transaction.type === 'invoice' || transaction.type === 'credit_memo') &&
243
245
  updates.project != null) {
244
246
  basePayload = {
245
247
  ...basePayload,
246
248
  accounting_project_id: updates.project.projectId,
247
- accounting_project_integration_id: updates.project.accountingProviderProjectId ?? null,
249
+ // Only spread integration_id when we have a concrete value; omitting it
250
+ // avoids accidentally nulling out the server-side value when the load
251
+ // path didn't surface the field (e.g. list-shaped data or pre-deploy store).
252
+ ...(updates.project.accountingProviderProjectId != null
253
+ ? {
254
+ accounting_project_integration_id: updates.project.accountingProviderProjectId,
255
+ }
256
+ : {}),
248
257
  accounting_project_name: updates.project.projectName,
249
258
  };
250
259
  }
@@ -266,6 +275,7 @@ const toTransactionUpdatePayload = (updates, detail, cotTransactionTracking, isA
266
275
  // Inject COT flags into the payload
267
276
  return (0, transactionPayload_1.injectCOTFlagsIntoTransactionPayload)(basePayload, transaction);
268
277
  };
278
+ exports.toTransactionUpdatePayload = toTransactionUpdatePayload;
269
279
  const checkIfClassMissingForAnyLineItem = (transactionPayload) => {
270
280
  let isAnyClassMissing = false;
271
281
  if (transactionPayload.lines != null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.25-betaRD1",
3
+ "version": "5.1.25-betaRD2",
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",