@zeniai/client-epic-state 5.1.29-beta0ND → 5.1.29

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 (72) hide show
  1. package/README.md +1 -3
  2. package/lib/__testHelpers__/apiFailure.json +6 -0
  3. package/lib/entity/jeSchedules/jeSchedulesPayload.js +3 -2
  4. package/lib/entity/vendor/__mocks__/vendorMock.d.ts +7 -0
  5. package/lib/entity/vendor/__mocks__/vendorMock.js +311 -0
  6. package/lib/entity/vendor/__mocks__/vendorStateMocks.d.ts +8 -0
  7. package/lib/entity/vendor/__mocks__/vendorStateMocks.js +415 -0
  8. package/lib/entity/vendor/vendorPayload.d.ts +1 -1
  9. package/lib/epic.d.ts +1 -2
  10. package/lib/epic.js +1 -2
  11. package/lib/esm/__testHelpers__/apiFailure.json +6 -0
  12. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +3 -2
  13. package/lib/esm/entity/vendor/__mocks__/vendorMock.js +308 -0
  14. package/lib/esm/entity/vendor/__mocks__/vendorStateMocks.js +412 -0
  15. package/lib/esm/epic.js +1 -2
  16. package/lib/esm/index.js +2 -2
  17. package/lib/esm/view/accountMappingView/__mocks__/accountMappingSelectorMock.js +4650 -0
  18. package/lib/esm/view/addressView/__mocks__/addressViewMocks.js +203 -0
  19. package/lib/esm/view/addressView/__mocks__/json/createAddressResponse.json +23 -0
  20. package/lib/esm/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +258 -0
  21. package/lib/esm/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +418 -0
  22. package/lib/esm/view/addressView/__mocks__/json/fetchAddressResponse.json +24 -0
  23. package/lib/esm/view/addressView/__mocks__/json/updateAddressResponse.json +24 -0
  24. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +3 -29
  25. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +0 -11
  26. package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +2 -2
  27. package/lib/esm/view/aiCfoView/epics/submitQuestionEpic.js +1 -7
  28. package/lib/esm/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +9 -6
  29. package/lib/esm/view/createTransferEntry/epics/createTransferEntryEpic.js +1 -1
  30. package/lib/esm/view/onboardingView/cockpitView/epic/initializeOnboardingCustomerViewUpdateDataEpic.js +16 -4
  31. package/lib/esm/view/onboardingView/cockpitView/onboardingCockpitViewPayload.js +2 -2
  32. package/lib/esm/view/referralView/epics/sendReferralInviteEpic.js +1 -9
  33. package/lib/esm/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +3 -3
  34. package/lib/esm/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.js +2 -28
  35. package/lib/esm/view/transactionDetail/epics/updateTransactionDetailEpic.js +1 -1
  36. package/lib/esm/view/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListReducer.js +3 -1
  37. package/lib/esm/view/vendorList/vendorListReducer.js +3 -1
  38. package/lib/esm/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.js +2 -2
  39. package/lib/index.d.ts +4 -4
  40. package/lib/index.js +5 -9
  41. package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.d.ts +11 -0
  42. package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.js +4659 -0
  43. package/lib/view/addressView/__mocks__/addressViewMocks.d.ts +35 -0
  44. package/lib/view/addressView/__mocks__/addressViewMocks.js +239 -0
  45. package/lib/view/addressView/__mocks__/json/createAddressResponse.json +23 -0
  46. package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +258 -0
  47. package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +418 -0
  48. package/lib/view/addressView/__mocks__/json/fetchAddressResponse.json +24 -0
  49. package/lib/view/addressView/__mocks__/json/updateAddressResponse.json +24 -0
  50. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +0 -14
  51. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +4 -8
  52. package/lib/view/aiCfoView/aiCfoViewReducer.js +4 -30
  53. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +1 -2
  54. package/lib/view/aiCfoView/aiCfoViewSelector.js +0 -12
  55. package/lib/view/aiCfoView/aiCfoViewState.d.ts +0 -15
  56. package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +2 -2
  57. package/lib/view/aiCfoView/epics/submitQuestionEpic.js +1 -7
  58. package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +9 -6
  59. package/lib/view/createTransferEntry/epics/createTransferEntryEpic.js +1 -1
  60. package/lib/view/onboardingView/cockpitView/epic/initializeOnboardingCustomerViewUpdateDataEpic.js +15 -3
  61. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewPayload.js +2 -2
  62. package/lib/view/referralView/epics/sendReferralInviteEpic.js +1 -9
  63. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +3 -3
  64. package/lib/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.js +2 -28
  65. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +1 -1
  66. package/lib/view/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListReducer.js +3 -1
  67. package/lib/view/vendorList/vendorListReducer.js +3 -1
  68. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.js +2 -2
  69. package/package.json +2 -5
  70. package/lib/esm/view/aiCfoView/epics/fetchSkillsEpic.js +0 -34
  71. package/lib/view/aiCfoView/epics/fetchSkillsEpic.d.ts +0 -8
  72. package/lib/view/aiCfoView/epics/fetchSkillsEpic.js +0 -38
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAiCfoView = void 0;
4
4
  exports.getSuggestedQuestionsForPageContext = getSuggestedQuestionsForPageContext;
5
- exports.getSkills = getSkills;
6
5
  const aiCfoReducer_1 = require("../../entity/aiCfo/aiCfoReducer");
7
6
  const aiCfoSelector_1 = require("../../entity/aiCfo/aiCfoSelector");
8
7
  const aiCfoViewReducer_1 = require("./aiCfoViewReducer");
@@ -28,14 +27,3 @@ exports.getAiCfoView = getAiCfoView;
28
27
  function getSuggestedQuestionsForPageContext(state, pageContext) {
29
28
  return state.aiCfoViewState?.suggestedQuestionsByPageContext?.[pageContext];
30
29
  }
31
- // Stable fallback so getSkills returns a referentially-stable object when skills
32
- // state is absent — a fresh literal each call would defeat useSelector identity
33
- // checks and cause needless re-renders.
34
- const EMPTY_SKILLS_STATE = {
35
- fetchState: 'Not-Started',
36
- error: undefined,
37
- skills: [],
38
- };
39
- function getSkills(state) {
40
- return state.aiCfoViewState?.skills ?? EMPTY_SKILLS_STATE;
41
- }
@@ -37,19 +37,6 @@ export interface SuggestedQuestionsForPageContext extends FetchStateAndError {
37
37
  suggestedQuestions: string[];
38
38
  generatedAt?: string;
39
39
  }
40
- /** A chat-visible skill shown in the `/` menu. */
41
- export interface Skill {
42
- description: string | null;
43
- displayName: string | null;
44
- hasScripts: boolean;
45
- macroId: string;
46
- name: string;
47
- parameterHints: Record<string, unknown> | null;
48
- semver: string | null;
49
- }
50
- export interface SkillsState extends FetchStateAndError {
51
- skills: Skill[];
52
- }
53
40
  export interface AiCfoViewState extends FetchStateAndError {
54
41
  allChatSessionIds: ID[];
55
42
  createSessionAndSubmitState: FetchStateAndError;
@@ -63,8 +50,6 @@ export interface AiCfoViewState extends FetchStateAndError {
63
50
  reasoning: FetchStateAndError;
64
51
  thought: FetchStateAndError;
65
52
  }>;
66
- /** Chat-visible skills for the `/` menu. */
67
- skills: SkillsState;
68
53
  stopSubmitStateByChatSessionId: Record<ID, FetchStateAndError>;
69
54
  /** Keyed by `page_context` query value (e.g. balance_sheet). */
70
55
  suggestedQuestionsByPageContext: Partial<Record<AiCfoSuggestedQuestionsPageContext, SuggestedQuestionsForPageContext>>;
@@ -69,7 +69,7 @@ function waitForChannelSubscription(pusherInstance, channelName, timeoutMs = 500
69
69
  }));
70
70
  }
71
71
  const createSessionAndSubmitEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.createSessionAndSubmit.match), (0, operators_1.switchMap)((action) => {
72
- const { agentId, userId, questionAnswerId, questionId, createdAt, question, files, pageContext, macroId, } = action.payload;
72
+ const { agentId, userId, questionAnswerId, questionId, createdAt, question, files, pageContext, } = action.payload;
73
73
  const payload = {
74
74
  agent_id: agentId,
75
75
  ...(pageContext != null && { page_context: pageContext }),
@@ -116,7 +116,7 @@ const createSessionAndSubmitEpic = (actions$, _state$, zeniAPI) => actions$.pipe
116
116
  // This allows fetchChatHistory to run after the question is submitted
117
117
  (0, rxjs_1.of)((0, aiCfoViewReducer_1.createSessionAndSubmitSuccess)(),
118
118
  // Submit the question after handlers are bound
119
- (0, aiCfoViewReducer_1.submitQuestion)(sessionId, questionAnswerId, userId, questionId, createdAt, question, files, macroId),
119
+ (0, aiCfoViewReducer_1.submitQuestion)(sessionId, questionAnswerId, userId, questionId, createdAt, question, files),
120
120
  // Add question payload optimistically after submitQuestion (matches original order)
121
121
  // This is idempotent - won't create duplicates if called multiple times
122
122
  // submitQuestionEpic will find the question already exists and only update the response
@@ -7,7 +7,7 @@ const aiCfoReducer_1 = require("../../../entity/aiCfo/aiCfoReducer");
7
7
  const responsePayload_1 = require("../../../responsePayload");
8
8
  const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
9
9
  const submitQuestionEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.submitQuestion.match), (0, operators_1.mergeMap)((action) => {
10
- const { questionAnswerId, userId, sessionId, questionId, createdAt, question, files, macroId, } = action.payload;
10
+ const { questionAnswerId, userId, sessionId, questionId, createdAt, question, files, } = action.payload;
11
11
  const { aiCfoViewState } = state$.value;
12
12
  const { uiState } = aiCfoViewState;
13
13
  const agentId = uiState.agentId;
@@ -20,21 +20,15 @@ const submitQuestionEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
20
20
  const formData = new FormData();
21
21
  formData.append('chat_session_id', sessionId);
22
22
  formData.append('message', question);
23
- if (macroId != null) {
24
- formData.append('macro_id', macroId);
25
- }
26
23
  for (const file of files) {
27
24
  formData.append('files', file, file.name);
28
25
  }
29
26
  apiCall = zeniAPI.postFormData(endpoint, formData);
30
27
  }
31
28
  else {
32
- // `message` is the display token (e.g. "/flux"); `macro_id` tells the chat
33
- // service to expand the skill's instructions as the actual agent prompt.
34
29
  apiCall = zeniAPI.postAndGetJSON(endpoint, {
35
30
  chat_session_id: sessionId,
36
31
  message: question,
37
- ...(macroId != null && { macro_id: macroId }),
38
32
  });
39
33
  }
40
34
  return apiCall.pipe((0, operators_1.mergeMap)((response) => {
@@ -7,6 +7,7 @@ const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer")
7
7
  const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
8
  const transactionSelector_1 = require("../../../../entity/transaction/transactionSelector");
9
9
  const vendorReducer_1 = require("../../../../entity/vendor/vendorReducer");
10
+ const vendorPayload_1 = require("../../../../entity/vendor/vendorPayload");
10
11
  const responsePayload_1 = require("../../../../responsePayload");
11
12
  const zeniUrl_1 = require("../../../../zeniUrl");
12
13
  const accountListSelector_1 = require("../../../accountList/accountListSelector");
@@ -38,11 +39,13 @@ const saveTransactionVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((
38
39
  const actions = [
39
40
  (0, vendorReducer_1.updateVendors)(response.data.vendors ?? []),
40
41
  ];
42
+ const savedVendor = response.data.vendors[0];
43
+ const resolvedVendorId = (0, vendorPayload_1.getVendorPayloadIdentifier)(savedVendor) ?? undefined;
41
44
  actions.push((0, transactionVendorViewReducer_1.updateTransactionVendorLocalData)({
42
- vendorId: response.data.vendors[0].vendor_id,
45
+ vendorId: resolvedVendorId,
43
46
  localData: {
44
- vendorName: response.data.vendors[0].vendor_name,
45
- vendorId: response.data.vendors[0].vendor_id,
47
+ vendorName: savedVendor.vendor_name,
48
+ vendorId: resolvedVendorId,
46
49
  },
47
50
  }));
48
51
  if (effectiveVendorId == null &&
@@ -70,7 +73,7 @@ const saveTransactionVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((
70
73
  name: response.data.vendors[0].vendor_name,
71
74
  id: response.data.vendors[0].qbo_id,
72
75
  type: 'vendor',
73
- zeniId: response.data.vendors[0].vendor_id,
76
+ zeniId: savedVendor.vendor_id ?? '',
74
77
  qboId: response.data.vendors[0].qbo_id,
75
78
  logo: (0, zeniUrl_1.toZeniUrlWithoutBaseURL)(response.data.vendors[0].logo?.url ?? ''),
76
79
  },
@@ -83,14 +86,14 @@ const saveTransactionVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((
83
86
  transactionId: action.payload.transactionId,
84
87
  vendorUpdates: {
85
88
  name: response.data.vendors[0].vendor_name,
86
- id: response.data.vendors[0].vendor_id,
89
+ id: savedVendor.vendor_id ?? '',
87
90
  qboId: response.data.vendors[0].qbo_id,
88
91
  },
89
92
  entity: {
90
93
  name: response.data.vendors[0].vendor_name,
91
94
  id: response.data.vendors[0].qbo_id,
92
95
  type: 'vendor',
93
- zeniId: response.data.vendors[0].vendor_id,
96
+ zeniId: savedVendor.vendor_id ?? '',
94
97
  qboId: response.data.vendors[0].qbo_id,
95
98
  logo: (0, zeniUrl_1.toZeniUrlWithoutBaseURL)(response.data.vendors[0].logo?.url ?? ''),
96
99
  },
@@ -92,7 +92,7 @@ function handleSuccessWithTransactionBody(transactionPayload, vendorPayload, pre
92
92
  (0, transactionReducer_1.updateTransaction)((0, transactionDetailState_1.getTransactionDetailKey)(newTransactionId), transactionPayload),
93
93
  (0, transactionDetailReducer_1.initializeTransactionDetailLocalData)({
94
94
  transactionId: newTransactionId,
95
- vendorId: vendorPayload?.[0]?.vendor_id,
95
+ vendorId: vendorPayload?.[0]?.vendor_id ?? undefined,
96
96
  }),
97
97
  ...buildSuccessSideEffects(sourceTransactionId),
98
98
  ];
@@ -116,20 +116,32 @@ const getSelectedProducts = (isDebitCardFlagEnabled, tenant) => {
116
116
  const isBookkeepingEnabled = (0, tenantSelector_1.isTenantBookkeepingEnabled)(tenant);
117
117
  const isOtherProductsEnabled = (0, tenantSelector_1.isOtherProductsEnabledForTenant)(tenant);
118
118
  const isCardsEnabled = (0, tenantSelector_1.isTenantCardsOnly)(tenant);
119
+ const isTreasuryEnabled = (0, tenantSelector_1.isTenantTreasuryEnabled)(tenant);
119
120
  if (isCardsEnabled && isBankingOnly) {
120
- return [];
121
+ const selectedProducts = ['zeni_cards', 'zeni_checking'];
122
+ if (isTreasuryEnabled) {
123
+ selectedProducts.push('zeni_treasury');
124
+ }
125
+ return selectedProducts;
121
126
  }
122
127
  else if (isBankingOnly) {
123
- return [];
128
+ const selectedProducts = ['zeni_checking'];
129
+ if (isTreasuryEnabled) {
130
+ selectedProducts.push('zeni_treasury');
131
+ }
132
+ return selectedProducts;
124
133
  }
125
134
  else if (isCardsEnabled) {
126
- return [];
135
+ return ['zeni_cards'];
127
136
  }
128
137
  else if (isBookkeepingEnabled) {
129
138
  return [
130
139
  'bookkeeping',
131
140
  'zeni_bill_pay',
141
+ 'zeni_checking',
132
142
  'zeni_reimbursements',
143
+ 'zeni_treasury',
144
+ 'zeni_cards',
133
145
  ];
134
146
  }
135
147
  else if (isOtherProductsEnabled) {
@@ -51,9 +51,9 @@ const toOnboardingCustomerPayload = (onboardingCustomer, sendInvite, company, te
51
51
  const isTreasury = selectedProducts.includes('zeni_treasury');
52
52
  if (isBookkeeping) {
53
53
  onboardingCustomerPayload.is_book_keeping_enabled = true;
54
- onboardingCustomerPayload.is_banking_enabled = isChecking;
54
+ onboardingCustomerPayload.is_banking_enabled = true;
55
55
  onboardingCustomerPayload.is_spend_management_enabled = true;
56
- onboardingCustomerPayload.is_card_enabled = isCards;
56
+ onboardingCustomerPayload.is_card_enabled = true;
57
57
  onboardingCustomerPayload.is_treasury_enabled = isTreasury;
58
58
  }
59
59
  else if (isChecking && isCards) {
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sendReferralInviteEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
7
6
  const responsePayload_1 = require("../../../responsePayload");
8
7
  const referralReducer_1 = require("../referralReducer");
9
8
  const sendReferralInviteEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(referralReducer_1.sendReferralInvite.match), (0, operators_1.switchMap)(() => {
@@ -17,14 +16,7 @@ const sendReferralInviteEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
17
16
  .postAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/company-referrals`, invitePayload)
18
17
  .pipe((0, operators_1.mergeMap)((response) => {
19
18
  if ((0, responsePayload_1.isSuccessStatus)(response)) {
20
- const actions = [
21
- (0, referralReducer_1.sendReferralInviteSuccess)(),
22
- (0, snackbarReducer_1.openSnackbar)({
23
- messageSection: 'referral_invite_sent',
24
- messageText: 'success',
25
- type: 'success',
26
- }),
27
- ];
19
+ const actions = [(0, referralReducer_1.sendReferralInviteSuccess)()];
28
20
  return actions;
29
21
  }
30
22
  else {
@@ -104,11 +104,11 @@ const fetchBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
104
104
  }
105
105
  else {
106
106
  fetchActions.push((0, billDetailViewReducer_1.updateBillDetail)({ billId, billDetail: response.data }));
107
- fetchActions.push((0, billDetailViewReducer_1.updateBillDetailFetchState)(transcationId, 'Completed', undefined, vendorInResponse?.vendor_id));
107
+ fetchActions.push((0, billDetailViewReducer_1.updateBillDetailFetchState)(transcationId, 'Completed', undefined, vendorInResponse?.vendor_id ?? undefined));
108
108
  const transactionInResponse = response.data?.transaction;
109
109
  if (transactionInResponse != null &&
110
110
  transactionInResponse.total_amount != null &&
111
- vendorInResponse != null) {
111
+ vendorInResponse.vendor_id != null) {
112
112
  fetchActions.push((0, billPayReviewReducer_1.fetchDuplicateBill)(vendorInResponse.vendor_name, vendorInResponse.vendor_id, transactionInResponse.total_amount, transactionInResponse.recipient_total_amount, transactionInResponse.document_id, billId));
113
113
  }
114
114
  const billHasPaymentError = [
@@ -165,7 +165,7 @@ function removeCompleteTransaction(billId, transaction) {
165
165
  function getVendorPreviousBillsActions(billTransactionPayload) {
166
166
  const fetchPreviousBillsActions = [];
167
167
  const vendorId = billTransactionPayload.vendor_id;
168
- if (Boolean(vendorId) === true) {
168
+ if (vendorId != null && vendorId !== '') {
169
169
  fetchPreviousBillsActions.push((0, previousBillsReducer_1.fetchPreviousBills)(vendorId, false));
170
170
  }
171
171
  return fetchPreviousBillsActions;
@@ -12,36 +12,10 @@ const transactionsViewReducer_1 = require("../../expenseAutomationView/reducers/
12
12
  const transactionDetailReducer_1 = require("../transactionDetailReducer");
13
13
  const transactionDetailState_1 = require("../transactionDetailState");
14
14
  const markTransactionAsNotMiscategorizedEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionDetailReducer_1.markTransactionAsNotMiscategorized.match), (0, operators_1.mergeMap)((action) => {
15
- // Expense-automation customers must be marked review-complete through the
16
- // same endpoint the categorization list uses; mark-miscategorized-as-correct
17
- // does not move their lines out of review. Mirror the list flow by reviewing
18
- // the transaction's categorizable line ids (updatesByLineId).
19
- const { url, body } = action.payload.isExpenseAutomationEnabled === true
20
- ? {
21
- url: `${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/mark-as-reviewed`,
22
- body: {
23
- transactions_reviewed: [
24
- {
25
- transaction_id: action.payload.transactionId.id,
26
- line_ids: Object.keys(action.payload.transactionSaveUpdates.updates
27
- ?.updatesByLineId ?? {}),
28
- },
29
- ],
30
- },
31
- }
32
- : {
33
- url: `${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${action.payload.transactionId.id}/mark-miscategorized-as-correct`,
34
- body: preparePayload(action.payload.transactionId),
35
- };
36
15
  return zeniAPI
37
- .putAndGetJSON(url, body)
16
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${action.payload.transactionId.id}/mark-miscategorized-as-correct`, preparePayload(action.payload.transactionId))
38
17
  .pipe((0, operators_1.mergeMap)((response) => {
39
- // mark-as-reviewed can return 200 while still listing this
40
- // transaction under transactions_reviewed_failed; don't clear it then.
41
- const reviewedFailedForExpenseAutomation = action.payload.isExpenseAutomationEnabled === true &&
42
- (response.data?.transactions_reviewed_failed ?? []).some((reviewed) => reviewed.transaction_id === action.payload.transactionId.id);
43
- if ((0, responsePayload_1.isSuccessStatus)(response) &&
44
- !reviewedFailedForExpenseAutomation) {
18
+ if ((0, responsePayload_1.isSuccessStatus)(response)) {
45
19
  const actions = [];
46
20
  actions.push((0, transactionDetailReducer_1.updateStatusForTransactionNotMiscategorizedUpdate)(action.payload.transactionId, 'Completed', undefined));
47
21
  const transactionKey = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
@@ -67,7 +67,7 @@ const updateTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe
67
67
  actions.push((0, transactionReducer_1.updateTransaction)(transactionDetailKeyForResponse, response.data.transaction));
68
68
  actions.push((0, transactionDetailReducer_1.initializeTransactionDetailLocalData)({
69
69
  transactionId: transactionIdResp,
70
- vendorId: response.data.vendors?.[0]?.vendor_id,
70
+ vendorId: response.data.vendors?.[0]?.vendor_id ?? undefined,
71
71
  }));
72
72
  actions.push((0, transactionDetailReducer_1.updateTransactionDetailSaveStatus)(transactionIdResp, 'Completed'));
73
73
  let callMarkTransactionAsNotMiscategorized = true;
@@ -79,7 +79,9 @@ const vendorFiling1099List = (0, toolkit_1.createSlice)({
79
79
  },
80
80
  updateVendorsFiling1099List(draft, action) {
81
81
  const { response } = action.payload;
82
- const newVendorIds = response.data?.report.vendors?.map((vendor) => vendor.vendor_id) ?? [];
82
+ const newVendorIds = response.data?.report.vendors
83
+ ?.map((vendor) => vendor.vendor_id)
84
+ .filter((vendorId) => vendorId != null) ?? [];
83
85
  draft.vendorIds = [...new Set([...draft.vendorIds, ...newVendorIds])];
84
86
  draft.isVendor1099Populated =
85
87
  response.data?.report.is_vendor_1099_populated ?? true;
@@ -88,7 +88,9 @@ const vendorList = (0, toolkit_1.createSlice)({
88
88
  },
89
89
  updateVendorsList(draft, action) {
90
90
  const { response, searchString, view } = action.payload;
91
- const newVendorIds = response.data?.vendors?.map((vendor) => vendor.vendor_id) ?? [];
91
+ const newVendorIds = response.data?.vendors
92
+ ?.map((vendor) => vendor.vendor_id)
93
+ .filter((vendorId) => vendorId != null) ?? [];
92
94
  if (searchString.length > 0) {
93
95
  if (action.payload.keepExistingListItems === false) {
94
96
  draft.searchResults = newVendorIds;
@@ -317,8 +317,8 @@ const toVendorReviewViewLocalDataById = (vendorsPayload) => {
317
317
  const mapPayloadToVendorFirstReviewView = (payload) => {
318
318
  const { recommendationIds, nonExistingRecommendations } = (0, commonTypes_1.toAllRecommendationsFromPayload)(payload.recommendations);
319
319
  return {
320
- vendorId: payload.vendor_id,
321
- selectedVendorId: payload.vendor_id,
320
+ vendorId: payload.vendor_id ?? '',
321
+ selectedVendorId: payload.vendor_id ?? '',
322
322
  status: {
323
323
  code: (0, commonTypes_1.toVendorFirstReviewViewStatusesTypeStrict)(payload.status.code),
324
324
  name: payload.status.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.29-beta0ND",
3
+ "version": "5.1.29",
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,7 +79,6 @@
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",
83
82
  "vitest": "^4.1.8"
84
83
  },
85
84
  "dependencies": {
@@ -130,9 +129,7 @@
130
129
  "postversion": "git push && git push --tags",
131
130
  "check-dependencies": "node ./scripts/check_dependencies.js",
132
131
  "clean-overrides": "node ./scripts/clean_overrides.js",
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",
135
- "bump-versions-beta": "chmod +x ./scripts/bump_versions_beta.sh && ./scripts/bump_versions_beta.sh",
132
+ "create-release-branch": "chmod +x ./scripts/create_release_branch.sh && ./scripts/create_release_branch.sh",
136
133
  "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",
137
134
  "send-release-notes": "chmod +x ./scripts/send_release_notes.sh && ./scripts/send_release_notes.sh",
138
135
  "update-slack-group-topic": "chmod +x ./scripts/update-slack-group-topic.sh && ./scripts/update-slack-group-topic.sh",
@@ -1,34 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
- import { fetchSkills, fetchSkillsFailure, fetchSkillsSuccess, } from '../aiCfoViewReducer';
5
- const toSkill = (s) => ({
6
- macroId: s.macro_id,
7
- name: s.name,
8
- displayName: s.display_name,
9
- description: s.description,
10
- semver: s.semver,
11
- parameterHints: s.parameter_hints,
12
- hasScripts: s.has_scripts,
13
- });
14
- /** GET {aiCfoMicroServiceBaseUrl}/1.0/skills — chat-visible skills for the `/` menu. */
15
- export const fetchSkillsEpic = (actions$,
16
- // state$ intentionally unused: the `/` menu dispatches this once per slash-entry
17
- // (the composer dedupes), so we always re-fetch the (small, singleton) list.
18
- _state$, zeniAPI) => actions$.pipe(filter(fetchSkills.match),
19
- // switchMap: a singleton list endpoint with no key — cancel any in-flight
20
- // fetch so the latest dispatch wins (no racing writes to `skills`).
21
- switchMap(() => {
22
- // aiCfoMicroServiceBaseUrl already targets the chat service (it serves the
23
- // /1.0/agents/{id} submit route too); /1.0/skills lives on the same service.
24
- const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/skills`;
25
- return zeniAPI.getJSON(url).pipe(mergeMap((response) => {
26
- if (isSuccessResponse(response) && response.data != null) {
27
- // Guard the array: a malformed 2xx body without `skills` must not crash .map.
28
- return of(fetchSkillsSuccess({
29
- skills: (response.data.skills ?? []).map(toSkill),
30
- }));
31
- }
32
- return of(fetchSkillsFailure(response.status));
33
- }), catchError((error) => of(fetchSkillsFailure(createZeniAPIStatus('Unexpected Error', 'Fetch skills REST API call failed', error instanceof Error ? { message: error.message } : undefined)))));
34
- }));
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../reducer';
4
- import { ZeniAPI } from '../../../zeniAPI';
5
- import { fetchSkills, fetchSkillsFailure, fetchSkillsSuccess } from '../aiCfoViewReducer';
6
- export type ActionType = ReturnType<typeof fetchSkills> | ReturnType<typeof fetchSkillsSuccess> | ReturnType<typeof fetchSkillsFailure>;
7
- /** GET {aiCfoMicroServiceBaseUrl}/1.0/skills — chat-visible skills for the `/` menu. */
8
- export declare const fetchSkillsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchSkillsEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../responsePayload");
7
- const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
8
- const toSkill = (s) => ({
9
- macroId: s.macro_id,
10
- name: s.name,
11
- displayName: s.display_name,
12
- description: s.description,
13
- semver: s.semver,
14
- parameterHints: s.parameter_hints,
15
- hasScripts: s.has_scripts,
16
- });
17
- /** GET {aiCfoMicroServiceBaseUrl}/1.0/skills — chat-visible skills for the `/` menu. */
18
- const fetchSkillsEpic = (actions$,
19
- // state$ intentionally unused: the `/` menu dispatches this once per slash-entry
20
- // (the composer dedupes), so we always re-fetch the (small, singleton) list.
21
- _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.fetchSkills.match),
22
- // switchMap: a singleton list endpoint with no key — cancel any in-flight
23
- // fetch so the latest dispatch wins (no racing writes to `skills`).
24
- (0, operators_1.switchMap)(() => {
25
- // aiCfoMicroServiceBaseUrl already targets the chat service (it serves the
26
- // /1.0/agents/{id} submit route too); /1.0/skills lives on the same service.
27
- const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/skills`;
28
- return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
29
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
30
- // Guard the array: a malformed 2xx body without `skills` must not crash .map.
31
- return (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchSkillsSuccess)({
32
- skills: (response.data.skills ?? []).map(toSkill),
33
- }));
34
- }
35
- return (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchSkillsFailure)(response.status));
36
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchSkillsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch skills REST API call failed', error instanceof Error ? { message: error.message } : undefined)))));
37
- }));
38
- exports.fetchSkillsEpic = fetchSkillsEpic;