@zeniai/client-epic-state 4.18.72 → 4.18.73

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,7 +39,6 @@ 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,
43
42
  third_party_merchant_id: vendorRecommendation.thirdPartyMerchantId,
44
43
  vendor_id: (_a = vendorRecommendation.id) !== null && _a !== void 0 ? _a : null,
45
44
  qbo_id: (_b = vendorRecommendation.qboId) !== null && _b !== void 0 ? _b : null,
@@ -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, _d;
43
+ var _a, _b, _c;
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,13 +52,18 @@ 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
- 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
- };
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
+ }
62
67
  }
63
68
  let customerUpdates = undefined;
64
69
  if (tranSelectedEntity != null && tranSelectedEntity.type === 'customer') {
@@ -190,11 +195,6 @@ const toEntityUpdatePayload = (entityUpdates) => {
190
195
  is_bulk_update: entityUpdate.isBulkUpdate,
191
196
  updated_entity_id: entityUpdate.updatedEntityId,
192
197
  };
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;
@@ -82,7 +82,7 @@ const toTransactionUpdatesFromTransactionCategorizationLocalData = (transactionC
82
82
  };
83
83
  if (recommended.class != null || recommended.account != null) {
84
84
  const entityId = entityDetails.entityId;
85
- doUpdateEntityUpdates(entityUpdates, entityId, entityDetails.entityType, recommended, false, undefined, entityDetails.entityName);
85
+ doUpdateEntityUpdates(entityUpdates, entityId, entityDetails.entityType, recommended, false, undefined);
86
86
  }
87
87
  }
88
88
  }
@@ -103,36 +103,35 @@ const toTransactionUpdatesFromTransactionCategorizationLocalData = (transactionC
103
103
  };
104
104
  };
105
105
  exports.toTransactionUpdatesFromTransactionCategorizationLocalData = toTransactionUpdatesFromTransactionCategorizationLocalData;
106
- const doUpdateEntityUpdates = (entityUpdates, entityId, entityType, recommendation, isBulkUpdate = false, updatedEntityId, entityName) => {
106
+ const doUpdateEntityUpdates = (entityUpdates, entityId, entityType, recommendation, isBulkUpdate = false, updatedEntityId) => {
107
107
  // see if this entity is already being updated
108
108
  const entityKey = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
109
109
  const entityUpdate = entityUpdates[entityKey];
110
- const commonUpdate = Object.assign({ recommendations: recommendation, entityId: entityId === entityName ? null : entityId }, (entityType === 'vendor' && entityName != null
111
- ? { vendorName: entityName }
112
- : {}));
113
110
  if (entityUpdate == null) {
114
- entityUpdates[entityKey] = Object.assign({ entityType,
111
+ entityUpdates[entityKey] = {
112
+ entityId,
113
+ entityType,
114
+ recommendations: recommendation,
115
115
  isBulkUpdate,
116
- updatedEntityId }, commonUpdate);
116
+ updatedEntityId,
117
+ };
117
118
  }
118
119
  else {
119
- entityUpdates[entityKey] = Object.assign(Object.assign({}, entityUpdate), commonUpdate);
120
+ entityUpdates[entityKey] = Object.assign(Object.assign({}, entityUpdate), { recommendations: recommendation });
120
121
  }
121
122
  };
122
123
  const getEntityDetails = (entity, lineItemLocalData, vendorUpdates, customerUpdates, currentSelectedEntityLine) => {
123
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
124
+ var _a, _b, _c, _d, _e, _f;
124
125
  if (entity != null) {
125
126
  return {
126
127
  entityId: (_a = entity.qboId) !== null && _a !== void 0 ? _a : entity.id,
127
128
  entityType: entity.type,
128
- entityName: entity.name,
129
129
  };
130
130
  }
131
- if (vendorUpdates != null) {
131
+ if (vendorUpdates != null && vendorUpdates.id != null) {
132
132
  return {
133
- entityId: (_c = (_b = vendorUpdates.qboId) !== null && _b !== void 0 ? _b : vendorUpdates.id) !== null && _c !== void 0 ? _c : vendorUpdates.name,
133
+ entityId: vendorUpdates.id,
134
134
  entityType: 'vendor',
135
- entityName: vendorUpdates.name,
136
135
  };
137
136
  }
138
137
  if (customerUpdates != null && customerUpdates.id != null) {
@@ -143,25 +142,24 @@ const getEntityDetails = (entity, lineItemLocalData, vendorUpdates, customerUpda
143
142
  }
144
143
  if (lineItemLocalData.lineEntity != null) {
145
144
  return {
146
- entityId: (_d = lineItemLocalData.lineEntity.qboId) !== null && _d !== void 0 ? _d : lineItemLocalData.lineEntity.id,
145
+ entityId: (_b = lineItemLocalData.lineEntity.qboId) !== null && _b !== void 0 ? _b : lineItemLocalData.lineEntity.id,
147
146
  entityType: lineItemLocalData.vendor != null ? 'vendor' : 'customer',
148
- entityName: lineItemLocalData.lineEntity.name,
149
147
  };
150
148
  }
151
- if (((_e = lineItemLocalData.customer) === null || _e === void 0 ? void 0 : _e.id) != null &&
149
+ if (((_c = lineItemLocalData.customer) === null || _c === void 0 ? void 0 : _c.id) != null &&
152
150
  currentSelectedEntityLine != null &&
153
151
  currentSelectedEntityLine.type === 'customer') {
154
152
  return {
155
- entityId: (_f = currentSelectedEntityLine.qboId) !== null && _f !== void 0 ? _f : lineItemLocalData.customer.id,
153
+ entityId: (_d = currentSelectedEntityLine.qboId) !== null && _d !== void 0 ? _d : lineItemLocalData.customer.id,
156
154
  entityType: 'customer',
157
155
  };
158
156
  }
159
- if (currentSelectedEntityLine != null &&
157
+ if (((_e = lineItemLocalData.vendor) === null || _e === void 0 ? void 0 : _e.id) != null &&
158
+ currentSelectedEntityLine != null &&
160
159
  currentSelectedEntityLine.type === 'vendor') {
161
160
  return {
162
- entityId: (_g = currentSelectedEntityLine.qboId) !== null && _g !== void 0 ? _g : (_h = lineItemLocalData.vendor) === null || _h === void 0 ? void 0 : _h.id,
161
+ entityId: (_f = currentSelectedEntityLine.qboId) !== null && _f !== void 0 ? _f : lineItemLocalData.vendor.id,
163
162
  entityType: 'vendor',
164
- entityName: (_j = currentSelectedEntityLine.name) !== null && _j !== void 0 ? _j : (_k = lineItemLocalData.vendor) === null || _k === void 0 ? void 0 : _k.name,
165
163
  };
166
164
  }
167
165
  return undefined;
@@ -20,12 +20,11 @@ export interface TransactionCategorizationPayload {
20
20
  }
21
21
  export type TransactionCategorizationResponse = ZeniAPIResponse<TransactionCategorizationPayload>;
22
22
  export interface EntityRelatedUpdatesPayload {
23
- entity_id: string | null;
23
+ entity_id: string;
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;
29
28
  }
30
29
  export interface UpdateTransactionCategorizationPayload {
31
30
  transaction: Partial<TransactionPayload>;
@@ -117,12 +117,11 @@ export interface TransactionUpdates {
117
117
  vendorId?: ID;
118
118
  }
119
119
  export interface EntityRelatedRecommendationUpdates {
120
- entityId: ID | null;
120
+ entityId: ID;
121
121
  entityType: EntityType;
122
122
  isBulkUpdate: boolean;
123
123
  recommendations: Recommendation;
124
124
  updatedEntityId: ID | undefined;
125
- vendorName?: string;
126
125
  }
127
126
  export interface TransactionSaveUpdates {
128
127
  anyBulkUpdates: boolean;
@@ -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, entityDetails.entityName);
137
+ doUpdateEntityUpdates(entityUpdates, entityId, entityDetails.entityType, recommended, lineItem.isUpdateAllChecked, updatedEntityId);
138
138
  }
139
139
  }
140
140
  }
@@ -153,20 +153,21 @@ const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLoc
153
153
  };
154
154
  };
155
155
  exports.toTransactionUpdatesFromTransactionDetailLocalData = toTransactionUpdatesFromTransactionDetailLocalData;
156
- const doUpdateEntityUpdates = (entityUpdates, entityId, entityType, recommendation, isBulkUpdate = false, updatedEntityId, entityName) => {
156
+ const doUpdateEntityUpdates = (entityUpdates, entityId, entityType, recommendation, isBulkUpdate = false, updatedEntityId) => {
157
157
  // see if this entity is already being updated
158
- const entityKey = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId !== null && entityId !== void 0 ? entityId : entityName);
158
+ const entityKey = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
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
- : {}));
163
160
  if (entityUpdate == null) {
164
- entityUpdates[entityKey] = Object.assign({ entityType,
161
+ entityUpdates[entityKey] = {
162
+ entityId,
163
+ entityType,
164
+ recommendations: recommendation,
165
165
  isBulkUpdate,
166
- updatedEntityId }, commonUpdate);
166
+ updatedEntityId,
167
+ };
167
168
  }
168
169
  else {
169
- entityUpdates[entityKey] = Object.assign(Object.assign({}, entityUpdate), commonUpdate);
170
+ entityUpdates[entityKey] = Object.assign(Object.assign({}, entityUpdate), { recommendations: recommendation });
170
171
  }
171
172
  };
172
173
  const toRecommendedAccountBase = (amountValue, accountBase, recommendationBase) => {
@@ -198,19 +199,17 @@ const toRecommendedClassBase = (amountValue, classBase, recommendationBase) => {
198
199
  };
199
200
  exports.toRecommendedClassBase = toRecommendedClassBase;
200
201
  const getEntityDetails = (entity, lineItemLocalData, vendorUpdates, customerUpdates) => {
201
- var _a, _b, _c, _d;
202
+ var _a, _b;
202
203
  if (entity != null) {
203
204
  return {
204
205
  entityId: (_a = entity.qboId) !== null && _a !== void 0 ? _a : entity.id,
205
206
  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,
214
213
  };
215
214
  }
216
215
  if (customerUpdates != null &&
@@ -221,11 +220,10 @@ const getEntityDetails = (entity, lineItemLocalData, vendorUpdates, customerUpda
221
220
  entityType: 'customer',
222
221
  };
223
222
  }
224
- if (vendorUpdates != null) {
223
+ if (vendorUpdates != null && vendorUpdates.id != null) {
225
224
  return {
226
- entityId: (_d = (_c = vendorUpdates.qboId) !== null && _c !== void 0 ? _c : vendorUpdates.id) !== null && _d !== void 0 ? _d : vendorUpdates.name,
225
+ entityId: vendorUpdates.id,
227
226
  entityType: 'vendor',
228
- entityName: vendorUpdates.name,
229
227
  };
230
228
  }
231
229
  return undefined;
@@ -123,7 +123,6 @@ 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;
127
126
  const transactionDetailKey = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
128
127
  const detail = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, transactionDetailKey);
129
128
  const tranDetail = (0, get_1.default)(transactionDetailState.transactionDetailById, transactionDetailKey, undefined);
@@ -135,13 +134,16 @@ function preparePayload(transactionState, vendorState, transactionDetailState, t
135
134
  currentSelectedEntity != null &&
136
135
  currentSelectedEntity.type === 'vendor') {
137
136
  const vendor = (0, vendorSelector_1.getVendorByVendorId)(vendorState, tranVendorUpdates.qboId);
138
- const vendorSource = vendor !== null && vendor !== void 0 ? vendor : ((tranVendorUpdates === null || tranVendorUpdates === void 0 ? void 0 : tranVendorUpdates.name) != null ? tranVendorUpdates : undefined);
139
- if (vendorSource) {
137
+ if (vendor != null) {
140
138
  vendorUpdates = {
141
- id: vendorSource.qboId === vendorSource.name
142
- ? ''
143
- : ((_a = vendorSource.qboId) !== null && _a !== void 0 ? _a : ''),
144
- name: vendorSource.name,
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,
145
147
  };
146
148
  }
147
149
  }
@@ -274,11 +276,6 @@ const toEntityUpdatePayload = (entityUpdates) => {
274
276
  is_bulk_update: entityUpdate.isBulkUpdate,
275
277
  updated_entity_id: entityUpdate.updatedEntityId,
276
278
  };
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
- }
282
279
  entityUpdatesPayload.push(entityUpdatePayload);
283
280
  }
284
281
  return entityUpdatesPayload;
@@ -14,13 +14,11 @@ interface TransactionDetailPayload {
14
14
  }
15
15
  export type TransactionDetailResponse = ZeniAPIResponse<TransactionDetailPayload>;
16
16
  export interface EntityRelatedUpdatesPayload {
17
- entity_id: string | null;
17
+ entity_id: string;
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;
24
22
  }
25
23
  export interface UpdateTransactionDetailPayload {
26
24
  transaction: Partial<TransactionPayload>;
@@ -531,12 +531,11 @@ 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;
535
534
  const key = type === 'customer' ? 'customerUpdates' : 'vendorUpdates';
536
535
  const transactionDetailLocalData = Object.assign(Object.assign({}, detail), { [key]: {
537
536
  name: updates.name,
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 : '',
537
+ id: updates.id,
538
+ qboId: updates.qboId,
540
539
  }, selectedEntity: entity });
541
540
  if (resetRecommendations === true) {
542
541
  for (const key in transactionDetailLocalData.lineItemById) {
@@ -62,12 +62,11 @@ export interface TransactionUpdates {
62
62
  vendorId?: ID;
63
63
  }
64
64
  export interface EntityRelatedRecommendationUpdates {
65
- entityId: ID | null;
65
+ entityId: ID;
66
66
  entityType: EntityType;
67
67
  isBulkUpdate: boolean;
68
68
  recommendations: Recommendation;
69
69
  updatedEntityId: ID | undefined;
70
- vendorName?: string;
71
70
  }
72
71
  export interface TransactionSaveUpdates {
73
72
  anyBulkUpdates: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.18.72",
3
+ "version": "4.18.73",
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",