@zeniai/client-epic-state 4.18.96 → 4.18.98

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.
@@ -39,6 +39,7 @@ const toRecommendedVendorBasePayload = (vendorRecommendation) => {
39
39
  var _a, _b, _c, _d, _e;
40
40
  return {
41
41
  vendor_name: vendorRecommendation.name,
42
+ vendor_name_confidence: vendorRecommendation.vendorNameConfidence,
42
43
  third_party_merchant_id: vendorRecommendation.thirdPartyMerchantId,
43
44
  vendor_id: (_a = vendorRecommendation.id) !== null && _a !== void 0 ? _a : null,
44
45
  qbo_id: (_b = vendorRecommendation.qboId) !== null && _b !== void 0 ? _b : null,
@@ -37,7 +37,6 @@ const fetchDashboardEpic = (actions$, state$) => actions$.pipe((0, operators_1.f
37
37
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
38
38
  const { userId, companyId, fetchFullReport, cacheOverride, excludeResources, tenantId, } = action.payload;
39
39
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
40
- const userRoleMap = (0, userRoleType_1.getUserRoleMap)(currentTenant.userRole);
41
40
  const isReimbursementFeatureEnabled = (_a = currentTenant.company) === null || _a === void 0 ? void 0 : _a.featuresActivationInfo.isReimbursementFeatureEnabled;
42
41
  const isAdmin = Boolean(currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.userRole) === true
43
42
  ? (0, userRoleType_1.hasAdminLevelAccess)(currentTenant.userRole)
@@ -89,7 +88,7 @@ const fetchDashboardEpic = (actions$, state$) => actions$.pipe((0, operators_1.f
89
88
  refreshViewInBackground: false,
90
89
  }));
91
90
  }
92
- if ((0, userRoleType_1.hasTreasuryAccess)(userRoleMap)) {
91
+ if (excludeResources.includes('treasury_promo_card') === false) {
93
92
  actions.push((0, treasurySetupViewReducer_1.fetchTreasuryFunds)());
94
93
  }
95
94
  return (0, rxjs_1.from)(actions);
@@ -205,7 +204,7 @@ const fetchDashboardEpic = (actions$, state$) => actions$.pipe((0, operators_1.f
205
204
  .fetchState !== 'In-Progress' &&
206
205
  state.treasurySetupViewState.treasuryFundsDetails.fetchStatus
207
206
  .fetchState !== 'Completed' &&
208
- (0, userRoleType_1.hasTreasuryAccess)(userRoleMap)) {
207
+ excludeResources.includes('treasury_promo_card') === false) {
209
208
  fetchActions.push((0, treasurySetupViewReducer_1.fetchTreasuryFunds)());
210
209
  }
211
210
  return (0, rxjs_1.from)(fetchActions);
@@ -1,7 +1,6 @@
1
1
  import { ReportID, SelectorReport, SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
2
2
  import { TenantsOrdered } from '../../entity/tenant/tenantSelector';
3
3
  import { LoggedInUser, Tenant } from '../../entity/tenant/tenantState';
4
- import { RoleMap } from '../../entity/userRole/userRoleType';
5
4
  import { RootState } from '../../reducer';
6
5
  import { CardType } from './dashboardState';
7
6
  export interface DashboardReport extends SelectorReport {
@@ -12,4 +11,4 @@ export interface DashboardReport extends SelectorReport {
12
11
  currentTenant?: Tenant;
13
12
  }
14
13
  export declare const getDashboard: (state: RootState, additionalExcludedReports: ReportID[], // used when reports are excluded through statsig
15
- signedInUser: LoggedInUser | undefined, isExpenseAutomationFeatureEnabledV2: boolean, isExpenseAutomationFeatureEnabled: boolean, isDebitCardFeatureEnabled: boolean, isTreasuryFeatureEnabled: boolean, userRoleMap?: RoleMap) => DashboardReport;
14
+ signedInUser: LoggedInUser | undefined, isExpenseAutomationFeatureEnabledV2: boolean, isExpenseAutomationFeatureEnabled: boolean, isDebitCardFeatureEnabled: boolean, isTreasuryFeatureEnabled: boolean) => DashboardReport;
@@ -45,7 +45,7 @@ const tenantSelector = (0, toolkit_1.createSelector)(tenantSelector_1.getTenants
45
45
  exports.getDashboard = (0, toolkit_1.createSelector)(tenantSelector, cardBalanceSelector_1.getCardBalance, cashBalanceSelector_1.getCashBalance, getOperatingExpensesForLast5Periods, getRevenueForLast4Periods, topExSelector_1.getTop6Expenses, getNetBurnOrIncomeForLast4Periods, getNetBurnOrIncomeStoryCard, getCashPositionLast5Periods, getCashInCashOutLast4Periods, insightsCardSelector_1.getInsights, companyPassportViewSelector_1.getCompanyPassportView, tasksCardSelector_1.getTasksCardReport, billPayCardSelector_1.getBillPayCardReport, reimbursementCardSelector_1.getReimbursementCardReport, apAgingSelector, arAgingSelector, zeniAccountsPromoCardSelector_1.getZeniAccountsPromoCard, referralSelector_1.getRewardsPlanCard, dashboardLayoutSelector_1.getDashboardCardsOrdered, (state) => {
46
46
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
47
47
  return (0, monthEndCloseChecksViewSelector_1.getMonthEndCloseChecksViewByTenantId)(state, currentTenant.tenantId);
48
- }, (state) => state.tenantState, (_state, additionalExcludedReports) => additionalExcludedReports, (_state, _additionalExcludedReports, signedInUser) => signedInUser, (_state, _excluded, _signedInUser, isExpenseAutomationFeatureEnabledV2) => isExpenseAutomationFeatureEnabledV2, (_state, _excluded, _signedInUser, _enabledV2, isExpenseAutomationFeatureEnabled) => isExpenseAutomationFeatureEnabled, (_state, _excluded, _signedInUser, _enabledV2, _enabled, isDebitCardFeatureEnabled) => isDebitCardFeatureEnabled, (_state, _excluded, _signedInUser, _enabledV2, _enabled, _debitEnabled, isTreasuryFeatureEnabled) => isTreasuryFeatureEnabled, (_state, _excluded, _signedInUser, _enabledV2, _enabled, _debitEnabled, _treasuryEnabled, userRoleMap) => userRoleMap, (tenants, cardBalance, cashBalance, opEx, revenue, topEx, netBurnOrIncome, netBurnOrIncomeStoryCard, cashPosition, cashInCashOut, insightsView, companyPassportView, tasksCard, billPayCard, reimbursementCard, apAgingReport, arAgingReport, zeniAccountsPromoCard, rewardsPlanCard, cards, monthEndCloseChecksView, tenantState, additionalExcludedReports, signedInUser, isExpenseAutomationFeatureEnabledV2, isExpenseAutomationFeatureEnabled, isDebitCardFeatureEnabled, isTreasuryFeatureEnabled, userRoleMap) => {
48
+ }, (state) => state.tenantState, (_state, additionalExcludedReports) => additionalExcludedReports, (_state, _additionalExcludedReports, signedInUser) => signedInUser, (_state, _excluded, _signedInUser, isExpenseAutomationFeatureEnabledV2) => isExpenseAutomationFeatureEnabledV2, (_state, _excluded, _signedInUser, _enabledV2, isExpenseAutomationFeatureEnabled) => isExpenseAutomationFeatureEnabled, (_state, _excluded, _signedInUser, _enabledV2, _enabled, isDebitCardFeatureEnabled) => isDebitCardFeatureEnabled, (_state, _excluded, _signedInUser, _enabledV2, _enabled, _debitEnabled, isTreasuryFeatureEnabled) => isTreasuryFeatureEnabled, (tenants, cardBalance, cashBalance, opEx, revenue, topEx, netBurnOrIncome, netBurnOrIncomeStoryCard, cashPosition, cashInCashOut, insightsView, companyPassportView, tasksCard, billPayCard, reimbursementCard, apAgingReport, arAgingReport, zeniAccountsPromoCard, rewardsPlanCard, cards, monthEndCloseChecksView, tenantState, additionalExcludedReports, signedInUser, isExpenseAutomationFeatureEnabledV2, isExpenseAutomationFeatureEnabled, isDebitCardFeatureEnabled, isTreasuryFeatureEnabled) => {
49
49
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
50
50
  const isReimbursementFeatureEnabled = (_a = tenants.currentTenant.company) === null || _a === void 0 ? void 0 : _a.featuresActivationInfo.isReimbursementFeatureEnabled;
51
51
  const isBillPayFeatureEnabled = (_b = tenants.currentTenant.company) === null || _b === void 0 ? void 0 : _b.featuresActivationInfo.isBillPayFeatureEnabled;
@@ -182,11 +182,8 @@ exports.getDashboard = (0, toolkit_1.createSelector)(tenantSelector, cardBalance
182
182
  }
183
183
  }
184
184
  // remove treasury promo card if its already enabled
185
- const isUserHasTreasuryAccess = (0, userRoleType_1.hasTreasuryAccess)(userRoleMap);
186
185
  const isTreasuryTOSAccepted = (_0 = (_z = tenants.currentTenant.companyTreasuryInfo) === null || _z === void 0 ? void 0 : _z.info) === null || _0 === void 0 ? void 0 : _0.isTreasuryTOSAccepted;
187
- if (isTreasuryTOSAccepted === true ||
188
- isTreasuryFeatureEnabled === false ||
189
- isUserHasTreasuryAccess === false) {
186
+ if (isTreasuryTOSAccepted === true || isTreasuryFeatureEnabled === false) {
190
187
  cardsToRemove.add('treasury_promo_card');
191
188
  }
192
189
  cardsCopy = cardsCopy.filter((c) => !cardsToRemove.has(c));
@@ -40,7 +40,7 @@ const updateTransactionCategorizationEpic = (actions$, state$, zeniAPI) => actio
40
40
  }));
41
41
  exports.updateTransactionCategorizationEpic = updateTransactionCategorizationEpic;
42
42
  function prepareTransactionPayload(selectedTab, transactionState, vendorState, transactionsViewState, transactionId, saveUpdates, cotTrackingByTransactionId) {
43
- var _a, _b, _c;
43
+ var _a, _b, _c, _d;
44
44
  const detail = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, transactionId);
45
45
  const tranDetail = (0, get_1.default)(transactionsViewState.transactionCategorizationView[selectedTab]
46
46
  .transactionReviewLocalDataById, transactionId, undefined);
@@ -52,18 +52,13 @@ function prepareTransactionPayload(selectedTab, transactionState, vendorState, t
52
52
  tranSelectedEntity != null &&
53
53
  tranSelectedEntity.type === 'vendor') {
54
54
  const vendor = (0, vendorSelector_1.getVendorByVendorId)(vendorState, tranVendorUpdates.qboId);
55
- if (vendor != null) {
56
- vendorUpdates = {
57
- id: vendor.qboId,
58
- name: vendor.name,
59
- };
60
- }
61
- else {
62
- vendorUpdates = {
63
- id: tranVendorUpdates.qboId,
64
- name: tranVendorUpdates.name,
65
- };
66
- }
55
+ const vendorSource = vendor !== null && vendor !== void 0 ? vendor : tranVendorUpdates;
56
+ vendorUpdates = {
57
+ id: vendorSource.qboId === vendorSource.name
58
+ ? ''
59
+ : ((_d = vendorSource.qboId) !== null && _d !== void 0 ? _d : ''),
60
+ name: vendorSource.name,
61
+ };
67
62
  }
68
63
  let customerUpdates = undefined;
69
64
  if (tranSelectedEntity != null && tranSelectedEntity.type === 'customer') {
@@ -195,6 +190,11 @@ const toEntityUpdatePayload = (entityUpdates) => {
195
190
  is_bulk_update: entityUpdate.isBulkUpdate,
196
191
  updated_entity_id: entityUpdate.updatedEntityId,
197
192
  };
193
+ // Add vendor_name if it's a vendor entity and name is provided
194
+ if (entityUpdate.entityType === 'vendor' &&
195
+ entityUpdate.vendorName != null) {
196
+ entityUpdatePayload.vendor_name = entityUpdate.vendorName;
197
+ }
198
198
  entityUpdatesPayload.push(entityUpdatePayload);
199
199
  }
200
200
  return entityUpdatesPayload;
@@ -83,7 +83,7 @@ const toTransactionUpdatesFromTransactionCategorizationLocalData = (transactionC
83
83
  };
84
84
  if (recommended.class != null || recommended.account != null) {
85
85
  const entityId = entityDetails.entityId;
86
- doUpdateEntityUpdates(entityUpdates, entityId, entityDetails.entityType, recommended, false, undefined);
86
+ doUpdateEntityUpdates(entityUpdates, entityId, entityDetails.entityType, recommended, false, undefined, entityDetails.entityName);
87
87
  }
88
88
  }
89
89
  }
@@ -104,35 +104,36 @@ const toTransactionUpdatesFromTransactionCategorizationLocalData = (transactionC
104
104
  };
105
105
  };
106
106
  exports.toTransactionUpdatesFromTransactionCategorizationLocalData = toTransactionUpdatesFromTransactionCategorizationLocalData;
107
- const doUpdateEntityUpdates = (entityUpdates, entityId, entityType, recommendation, isBulkUpdate = false, updatedEntityId) => {
107
+ const doUpdateEntityUpdates = (entityUpdates, entityId, entityType, recommendation, isBulkUpdate = false, updatedEntityId, entityName) => {
108
108
  // see if this entity is already being updated
109
109
  const entityKey = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
110
110
  const entityUpdate = entityUpdates[entityKey];
111
+ const commonUpdate = Object.assign({ recommendations: recommendation, entityId: entityId === entityName ? null : entityId }, (entityType === 'vendor' && entityName != null
112
+ ? { vendorName: entityName }
113
+ : {}));
111
114
  if (entityUpdate == null) {
112
- entityUpdates[entityKey] = {
113
- entityId,
114
- entityType,
115
- recommendations: recommendation,
115
+ entityUpdates[entityKey] = Object.assign({ entityType,
116
116
  isBulkUpdate,
117
- updatedEntityId,
118
- };
117
+ updatedEntityId }, commonUpdate);
119
118
  }
120
119
  else {
121
- entityUpdates[entityKey] = Object.assign(Object.assign({}, entityUpdate), { recommendations: recommendation });
120
+ entityUpdates[entityKey] = Object.assign(Object.assign({}, entityUpdate), commonUpdate);
122
121
  }
123
122
  };
124
123
  const getEntityDetails = (entity, lineItemLocalData, vendorUpdates, customerUpdates, currentSelectedEntityLine) => {
125
- var _a, _b, _c, _d, _e, _f;
124
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
126
125
  if (entity != null) {
127
126
  return {
128
127
  entityId: (_a = entity.qboId) !== null && _a !== void 0 ? _a : entity.id,
129
128
  entityType: entity.type,
129
+ entityName: entity.name,
130
130
  };
131
131
  }
132
- if (vendorUpdates != null && vendorUpdates.id != null) {
132
+ if (vendorUpdates != null) {
133
133
  return {
134
- entityId: vendorUpdates.id,
134
+ entityId: (_c = (_b = vendorUpdates.qboId) !== null && _b !== void 0 ? _b : vendorUpdates.id) !== null && _c !== void 0 ? _c : vendorUpdates.name,
135
135
  entityType: 'vendor',
136
+ entityName: vendorUpdates.name,
136
137
  };
137
138
  }
138
139
  if (customerUpdates != null && customerUpdates.id != null) {
@@ -143,24 +144,26 @@ const getEntityDetails = (entity, lineItemLocalData, vendorUpdates, customerUpda
143
144
  }
144
145
  if (lineItemLocalData.lineEntity != null) {
145
146
  return {
146
- entityId: (_b = lineItemLocalData.lineEntity.qboId) !== null && _b !== void 0 ? _b : lineItemLocalData.lineEntity.id,
147
+ entityId: (_d = lineItemLocalData.lineEntity.qboId) !== null && _d !== void 0 ? _d : lineItemLocalData.lineEntity.id,
147
148
  entityType: lineItemLocalData.vendor != null ? 'vendor' : 'customer',
149
+ entityName: lineItemLocalData.lineEntity.name,
148
150
  };
149
151
  }
150
- if (((_c = lineItemLocalData.customer) === null || _c === void 0 ? void 0 : _c.id) != null &&
152
+ if (((_e = lineItemLocalData.customer) === null || _e === void 0 ? void 0 : _e.id) != null &&
151
153
  currentSelectedEntityLine != null &&
152
154
  currentSelectedEntityLine.type === 'customer') {
153
155
  return {
154
- entityId: (_d = currentSelectedEntityLine.qboId) !== null && _d !== void 0 ? _d : lineItemLocalData.customer.id,
156
+ entityId: (_f = currentSelectedEntityLine.qboId) !== null && _f !== void 0 ? _f : lineItemLocalData.customer.id,
155
157
  entityType: 'customer',
156
158
  };
157
159
  }
158
- if (((_e = lineItemLocalData.vendor) === null || _e === void 0 ? void 0 : _e.id) != null &&
160
+ if (((_g = lineItemLocalData.vendor) === null || _g === void 0 ? void 0 : _g.id) != null &&
159
161
  currentSelectedEntityLine != null &&
160
162
  currentSelectedEntityLine.type === 'vendor') {
161
163
  return {
162
- entityId: (_f = currentSelectedEntityLine.qboId) !== null && _f !== void 0 ? _f : lineItemLocalData.vendor.id,
164
+ entityId: (_h = currentSelectedEntityLine.qboId) !== null && _h !== void 0 ? _h : lineItemLocalData.vendor.id,
163
165
  entityType: 'vendor',
166
+ entityName: (_j = currentSelectedEntityLine.name) !== null && _j !== void 0 ? _j : lineItemLocalData.vendor.name,
164
167
  };
165
168
  }
166
169
  return undefined;
@@ -20,11 +20,12 @@ export interface TransactionCategorizationPayload {
20
20
  }
21
21
  export type TransactionCategorizationResponse = ZeniAPIResponse<TransactionCategorizationPayload>;
22
22
  export interface EntityRelatedUpdatesPayload {
23
- entity_id: string;
23
+ entity_id: string | null;
24
24
  entity_type: string;
25
25
  is_bulk_update: boolean;
26
26
  recommendations: EntityRecommendationPayload;
27
27
  updated_entity_id: string | undefined;
28
+ vendor_name?: string;
28
29
  }
29
30
  export interface UpdateTransactionCategorizationPayload {
30
31
  transaction: Partial<TransactionPayload>;
@@ -117,11 +117,12 @@ export interface TransactionUpdates {
117
117
  vendorId?: ID;
118
118
  }
119
119
  export interface EntityRelatedRecommendationUpdates {
120
- entityId: ID;
120
+ entityId: ID | null;
121
121
  entityType: EntityType;
122
122
  isBulkUpdate: boolean;
123
123
  recommendations: Recommendation;
124
124
  updatedEntityId: ID | undefined;
125
+ vendorName?: string;
125
126
  }
126
127
  export interface TransactionSaveUpdates {
127
128
  anyBulkUpdates: boolean;
@@ -10,15 +10,10 @@ const getTreasuryTransferMoney = (state) => {
10
10
  const { treasuryTransferMoneyState, treasuryDetailState, treasurySetupViewState, depositAccountState, paymentAccountState, depositAccountListState, paymentAccountListState, } = state;
11
11
  const { localData, fetchState, error } = treasuryTransferMoneyState;
12
12
  const depositAccountsView = (0, depositAccountListSelector_1.getAllDepositAccounts)(depositAccountState, depositAccountListState);
13
- const paymentAccountsView = (0, paymentAccountListSelector_1.getAllPaymentAccounts)(paymentAccountState, paymentAccountListState);
14
13
  let transferParties = [];
15
- const transferMoneyPartiesFetchState = (0, reduceFetchState_1.reduceAllFetchState)([
16
- depositAccountsView,
17
- paymentAccountsView,
18
- ]).fetchState;
19
- if (depositAccountsView.fetchState === 'Completed' &&
20
- paymentAccountsView.fetchState === 'Completed') {
21
- transferParties = (0, setupViewSelector_1.getAllFundingAccounts)(depositAccountsView.depositAccounts, paymentAccountsView.paymentAccounts, paymentAccountListState.paymentAccountBalanceFetchStatus);
14
+ const transferMoneyPartiesFetchState = depositAccountsView.fetchState;
15
+ if (depositAccountsView.fetchState === 'Completed') {
16
+ transferParties = depositAccountsView.depositAccounts.map((depositAcc) => (0, setupViewSelector_1.mapDepositAccToFundingAccount)(depositAcc));
22
17
  }
23
18
  const primaryPaymentAccount = (0, paymentAccountListSelector_1.getPrimaryPaymentAccount)(paymentAccountState, paymentAccountListState);
24
19
  const treasuryAccount = {
@@ -30,7 +25,6 @@ const getTreasuryTransferMoney = (state) => {
30
25
  };
31
26
  const allRequiredDataFetchState = (0, reduceFetchState_1.reduceAllFetchState)([
32
27
  depositAccountsView,
33
- paymentAccountsView,
34
28
  treasuryDetailState,
35
29
  treasurySetupViewState.currentAllocation.fetchStatus,
36
30
  treasurySetupViewState,
@@ -134,7 +134,7 @@ const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLoc
134
134
  entityId = customerIdToUpdate;
135
135
  }
136
136
  }
137
- doUpdateEntityUpdates(entityUpdates, entityId, entityDetails.entityType, recommended, lineItem.isUpdateAllChecked, updatedEntityId);
137
+ doUpdateEntityUpdates(entityUpdates, entityId, entityDetails.entityType, recommended, lineItem.isUpdateAllChecked, updatedEntityId, entityDetails.entityName);
138
138
  }
139
139
  }
140
140
  }
@@ -153,21 +153,20 @@ const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLoc
153
153
  };
154
154
  };
155
155
  exports.toTransactionUpdatesFromTransactionDetailLocalData = toTransactionUpdatesFromTransactionDetailLocalData;
156
- const doUpdateEntityUpdates = (entityUpdates, entityId, entityType, recommendation, isBulkUpdate = false, updatedEntityId) => {
156
+ const doUpdateEntityUpdates = (entityUpdates, entityId, entityType, recommendation, isBulkUpdate = false, updatedEntityId, entityName) => {
157
157
  // see if this entity is already being updated
158
- const entityKey = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
158
+ const entityKey = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId !== null && entityId !== void 0 ? entityId : entityName);
159
159
  const entityUpdate = entityUpdates[entityKey];
160
+ const commonUpdate = Object.assign({ recommendations: recommendation, entityId: entityId === entityName ? null : entityId }, (entityType === 'vendor' && entityName != null
161
+ ? { vendorName: entityName }
162
+ : {}));
160
163
  if (entityUpdate == null) {
161
- entityUpdates[entityKey] = {
162
- entityId,
163
- entityType,
164
- recommendations: recommendation,
164
+ entityUpdates[entityKey] = Object.assign({ entityType,
165
165
  isBulkUpdate,
166
- updatedEntityId,
167
- };
166
+ updatedEntityId }, commonUpdate);
168
167
  }
169
168
  else {
170
- entityUpdates[entityKey] = Object.assign(Object.assign({}, entityUpdate), { recommendations: recommendation });
169
+ entityUpdates[entityKey] = Object.assign(Object.assign({}, entityUpdate), commonUpdate);
171
170
  }
172
171
  };
173
172
  const toRecommendedAccountBase = (amountValue, accountBase, recommendationBase) => {
@@ -199,17 +198,19 @@ const toRecommendedClassBase = (amountValue, classBase, recommendationBase) => {
199
198
  };
200
199
  exports.toRecommendedClassBase = toRecommendedClassBase;
201
200
  const getEntityDetails = (entity, lineItemLocalData, vendorUpdates, customerUpdates) => {
202
- var _a, _b;
201
+ var _a, _b, _c, _d;
203
202
  if (entity != null) {
204
203
  return {
205
204
  entityId: (_a = entity.qboId) !== null && _a !== void 0 ? _a : entity.id,
206
205
  entityType: entity.type,
206
+ entityName: entity.name,
207
207
  };
208
208
  }
209
209
  if (lineItemLocalData.lineEntity != null) {
210
210
  return {
211
211
  entityId: (_b = lineItemLocalData.lineEntity.qboId) !== null && _b !== void 0 ? _b : lineItemLocalData.lineEntity.id,
212
212
  entityType: lineItemLocalData.lineEntity.type,
213
+ entityName: lineItemLocalData.lineEntity.name,
213
214
  };
214
215
  }
215
216
  if (customerUpdates != null &&
@@ -220,10 +221,11 @@ const getEntityDetails = (entity, lineItemLocalData, vendorUpdates, customerUpda
220
221
  entityType: 'customer',
221
222
  };
222
223
  }
223
- if (vendorUpdates != null && vendorUpdates.id != null) {
224
+ if (vendorUpdates != null) {
224
225
  return {
225
- entityId: vendorUpdates.id,
226
+ entityId: (_d = (_c = vendorUpdates.qboId) !== null && _c !== void 0 ? _c : vendorUpdates.id) !== null && _d !== void 0 ? _d : vendorUpdates.name,
226
227
  entityType: 'vendor',
228
+ entityName: vendorUpdates.name,
227
229
  };
228
230
  }
229
231
  return undefined;
@@ -123,6 +123,7 @@ const updateTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe
123
123
  }));
124
124
  exports.updateTransactionDetailEpic = updateTransactionDetailEpic;
125
125
  function preparePayload(transactionState, vendorState, transactionDetailState, transactionId, saveUpdates, cotTransactionTracking) {
126
+ var _a;
126
127
  const transactionDetailKey = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
127
128
  const detail = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, transactionDetailKey);
128
129
  const tranDetail = (0, get_1.default)(transactionDetailState.transactionDetailById, transactionDetailKey, undefined);
@@ -134,16 +135,13 @@ function preparePayload(transactionState, vendorState, transactionDetailState, t
134
135
  currentSelectedEntity != null &&
135
136
  currentSelectedEntity.type === 'vendor') {
136
137
  const vendor = (0, vendorSelector_1.getVendorByVendorId)(vendorState, tranVendorUpdates.qboId);
137
- if (vendor != null) {
138
+ const vendorSource = vendor !== null && vendor !== void 0 ? vendor : tranVendorUpdates;
139
+ if (vendorSource) {
138
140
  vendorUpdates = {
139
- id: vendor === null || vendor === void 0 ? void 0 : vendor.qboId,
140
- name: vendor === null || vendor === void 0 ? void 0 : vendor.name,
141
- };
142
- }
143
- else if (tranVendorUpdates.name != null) {
144
- vendorUpdates = {
145
- id: tranVendorUpdates.qboId,
146
- name: tranVendorUpdates.name,
141
+ id: vendorSource.qboId === vendorSource.name
142
+ ? ''
143
+ : ((_a = vendorSource.qboId) !== null && _a !== void 0 ? _a : ''),
144
+ name: vendorSource.name,
147
145
  };
148
146
  }
149
147
  }
@@ -276,6 +274,11 @@ const toEntityUpdatePayload = (entityUpdates) => {
276
274
  is_bulk_update: entityUpdate.isBulkUpdate,
277
275
  updated_entity_id: entityUpdate.updatedEntityId,
278
276
  };
277
+ // Add vendor_name if it's a vendor entity and name is provided
278
+ if (entityUpdate.entityType === 'vendor' &&
279
+ entityUpdate.vendorName != null) {
280
+ entityUpdatePayload.vendor_name = entityUpdate.vendorName;
281
+ }
279
282
  entityUpdatesPayload.push(entityUpdatePayload);
280
283
  }
281
284
  return entityUpdatesPayload;
@@ -14,11 +14,13 @@ interface TransactionDetailPayload {
14
14
  }
15
15
  export type TransactionDetailResponse = ZeniAPIResponse<TransactionDetailPayload>;
16
16
  export interface EntityRelatedUpdatesPayload {
17
- entity_id: string;
17
+ entity_id: string | null;
18
18
  entity_type: string;
19
19
  is_bulk_update: boolean;
20
20
  recommendations: EntityRecommendationPayload;
21
21
  updated_entity_id: string | undefined;
22
+ customer_name?: string;
23
+ vendor_name?: string;
22
24
  }
23
25
  export interface UpdateTransactionDetailPayload {
24
26
  transaction: Partial<TransactionPayload>;
@@ -531,11 +531,12 @@ const transactionDetail = (0, toolkit_1.createSlice)({
531
531
  _a = transactionDetail.actions, exports.downloadAccountingProviderAttachment = _a.downloadAccountingProviderAttachment, exports.downloadAccountingProviderAttachmentSuccess = _a.downloadAccountingProviderAttachmentSuccess, exports.downloadAccountingProviderAttachmentFailure = _a.downloadAccountingProviderAttachmentFailure, exports.fetchTransactionDetail = _a.fetchTransactionDetail, exports.updateTransactionDetailFetchState = _a.updateTransactionDetailFetchState, exports.removeTransactionDetail = _a.removeTransactionDetail, exports.clearTransactionDetail = _a.clearTransactionDetail, exports.uploadMissingAttachmentSuccess = _a.uploadMissingAttachmentSuccess, exports.updateTransactionDetail = _a.updateTransactionDetail, exports.updateTransactionDetailSaveStatus = _a.updateTransactionDetailSaveStatus, exports.clearTransactionDetailSaveStatus = _a.clearTransactionDetailSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.deleteTransactionAttachment = _a.deleteTransactionAttachment, exports.deleteTransactionAttachmentFailure = _a.deleteTransactionAttachmentFailure, exports.deleteTransactionAttachmentSuccess = _a.deleteTransactionAttachmentSuccess, exports.updateStatusForTransactionNotMiscategorizedUpdate = _a.updateStatusForTransactionNotMiscategorizedUpdate, exports.updateStatusConsolidatedSaveTransactionDetail = _a.updateStatusConsolidatedSaveTransactionDetail, exports.updateTransactionStateIfUpdateActionNotAllowed = _a.updateTransactionStateIfUpdateActionNotAllowed, exports.saveTransactionDetail = _a.saveTransactionDetail, exports.initializeTransactionDetailLocalData = _a.initializeTransactionDetailLocalData, exports.saveTransactionDetailLocalData = _a.saveTransactionDetailLocalData, exports.clearTransactionDetailLocalData = _a.clearTransactionDetailLocalData, exports.resetLineItemsCategoryClassInLocalData = _a.resetLineItemsCategoryClassInLocalData, exports.setAllLineItemsToCategoryClassInLocalData = _a.setAllLineItemsToCategoryClassInLocalData, exports.setAllLineItemsLocalDataIsUpdateAllChecked = _a.setAllLineItemsLocalDataIsUpdateAllChecked, exports.setEntityRecommendationForLineIdsForTransactionDetail = _a.setEntityRecommendationForLineIdsForTransactionDetail, exports.removeEntityRecommendationForLineIdForTransactionDetail = _a.removeEntityRecommendationForLineIdForTransactionDetail, exports.updateSelectedVendor = _a.updateSelectedVendor, exports.updateSelectedCustomer = _a.updateSelectedCustomer, exports.resetVendor = _a.resetVendor, exports.resetSelectedCustomer = _a.resetSelectedCustomer, exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = _a.updateLocalDataWithTransactionsUpdateWithVendorCheckbox, exports.updateVendorToAllLineItems = _a.updateVendorToAllLineItems, exports.resetAllLineItemsToVendor = _a.resetAllLineItemsToVendor, exports.updateLatestSelectedEntity = _a.updateLatestSelectedEntity, exports.updateVendorBulkRecommendationsFetchStatus = _a.updateVendorBulkRecommendationsFetchStatus, exports.setIsVendorUpdateAllChecked = _a.setIsVendorUpdateAllChecked;
532
532
  exports.default = transactionDetail.reducer;
533
533
  function getUpdatedEntityLocalData(detail, updates, entity, resetRecommendations, type) {
534
+ var _a, _b, _c, _d;
534
535
  const key = type === 'customer' ? 'customerUpdates' : 'vendorUpdates';
535
536
  const transactionDetailLocalData = Object.assign(Object.assign({}, detail), { [key]: {
536
537
  name: updates.name,
537
- id: updates.id,
538
- qboId: updates.qboId,
538
+ id: (_b = (_a = updates.id) !== null && _a !== void 0 ? _a : updates.name) !== null && _b !== void 0 ? _b : '',
539
+ qboId: (_d = (_c = updates.qboId) !== null && _c !== void 0 ? _c : updates.name) !== null && _d !== void 0 ? _d : '',
539
540
  }, selectedEntity: entity });
540
541
  if (resetRecommendations === true) {
541
542
  for (const key in transactionDetailLocalData.lineItemById) {
@@ -62,11 +62,12 @@ export interface TransactionUpdates {
62
62
  vendorId?: ID;
63
63
  }
64
64
  export interface EntityRelatedRecommendationUpdates {
65
- entityId: ID;
65
+ entityId: ID | null;
66
66
  entityType: EntityType;
67
67
  isBulkUpdate: boolean;
68
68
  recommendations: Recommendation;
69
69
  updatedEntityId: ID | undefined;
70
+ vendorName?: string;
70
71
  }
71
72
  export interface TransactionSaveUpdates {
72
73
  anyBulkUpdates: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.18.96",
3
+ "version": "4.18.98",
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",