@zeniai/client-epic-state 5.1.34 → 5.1.35

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 (65) hide show
  1. package/README.md +3 -1
  2. package/lib/commonStateTypes/viewAndReport/agingReportStateTypes.d.ts +1 -1
  3. package/lib/entity/accountRecon/accountReconPayload.d.ts +22 -0
  4. package/lib/entity/accountRecon/accountReconPayload.js +26 -1
  5. package/lib/entity/accountRecon/accountReconReducer.d.ts +5 -2
  6. package/lib/entity/accountRecon/accountReconReducer.js +36 -2
  7. package/lib/entity/accountRecon/accountReconSelector.d.ts +6 -1
  8. package/lib/entity/accountRecon/accountReconSelector.js +5 -0
  9. package/lib/entity/accountRecon/accountReconState.d.ts +22 -0
  10. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.d.ts +8 -0
  11. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +10 -0
  12. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +8 -0
  13. package/lib/epic.d.ts +5 -1
  14. package/lib/epic.js +5 -1
  15. package/lib/esm/entity/accountRecon/accountReconPayload.js +26 -1
  16. package/lib/esm/entity/accountRecon/accountReconReducer.js +35 -1
  17. package/lib/esm/entity/accountRecon/accountReconSelector.js +5 -0
  18. package/lib/esm/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +10 -0
  19. package/lib/esm/epic.js +5 -1
  20. package/lib/esm/index.js +5 -5
  21. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +29 -3
  22. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +11 -0
  23. package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +2 -2
  24. package/lib/esm/view/aiCfoView/epics/fetchSkillsEpic.js +34 -0
  25. package/lib/esm/view/aiCfoView/epics/submitQuestionEpic.js +7 -1
  26. package/lib/esm/view/expenseAutomationView/epics/accountRecon/parseStatementEpic.js +34 -0
  27. package/lib/esm/view/expenseAutomationView/epics/accountRecon/reparseStatementEpic.js +31 -0
  28. package/lib/esm/view/expenseAutomationView/epics/accountRecon/updateStatementInfoEpic.js +57 -0
  29. package/lib/esm/view/expenseAutomationView/payload/reconciliationPayload.js +153 -0
  30. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +188 -9
  31. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +27 -0
  32. package/lib/esm/view/expenseAutomationView/types/reconciliationViewState.js +29 -0
  33. package/lib/esm/view/onboardingView/cockpitView/epic/initializeOnboardingCustomerViewUpdateDataEpic.js +4 -16
  34. package/lib/esm/view/onboardingView/cockpitView/onboardingCockpitViewPayload.js +2 -2
  35. package/lib/index.d.ts +10 -10
  36. package/lib/index.js +55 -37
  37. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +14 -0
  38. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +8 -4
  39. package/lib/view/aiCfoView/aiCfoViewReducer.js +30 -4
  40. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +2 -1
  41. package/lib/view/aiCfoView/aiCfoViewSelector.js +12 -0
  42. package/lib/view/aiCfoView/aiCfoViewState.d.ts +15 -0
  43. package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +2 -2
  44. package/lib/view/aiCfoView/epics/fetchSkillsEpic.d.ts +8 -0
  45. package/lib/view/aiCfoView/epics/fetchSkillsEpic.js +38 -0
  46. package/lib/view/aiCfoView/epics/submitQuestionEpic.js +7 -1
  47. package/lib/view/expenseAutomationView/epics/accountRecon/parseStatementEpic.d.ts +6 -0
  48. package/lib/view/expenseAutomationView/epics/accountRecon/parseStatementEpic.js +38 -0
  49. package/lib/view/expenseAutomationView/epics/accountRecon/reparseStatementEpic.d.ts +26 -0
  50. package/lib/view/expenseAutomationView/epics/accountRecon/reparseStatementEpic.js +35 -0
  51. package/lib/view/expenseAutomationView/epics/accountRecon/updateStatementInfoEpic.d.ts +27 -0
  52. package/lib/view/expenseAutomationView/epics/accountRecon/updateStatementInfoEpic.js +61 -0
  53. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +176 -10
  54. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +159 -0
  55. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +53 -3
  56. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +190 -10
  57. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +7 -1
  58. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.d.ts +2 -0
  59. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +29 -1
  60. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +175 -0
  61. package/lib/view/expenseAutomationView/types/reconciliationViewState.js +30 -0
  62. package/lib/view/onboardingView/cockpitView/epic/initializeOnboardingCustomerViewUpdateDataEpic.js +3 -15
  63. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewPayload.js +2 -2
  64. package/lib/view/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListState.d.ts +1 -1
  65. package/package.json +5 -2
@@ -7,6 +7,131 @@ import { BankStatusCodeType } from '../../../entity/accountRecon/accountReconSta
7
7
  import { CustomerBase } from '../../../entity/customer/customerState';
8
8
  import { VendorBase } from '../../../entity/vendor/vendorState';
9
9
  import { ZeniAPIStatus } from '../../../responsePayload';
10
+ import { ReconciliationSummaryPayload } from '../payload/reconciliationPayload';
11
+ export interface PolygonPoint {
12
+ x: number;
13
+ y: number;
14
+ }
15
+ export interface Citation {
16
+ page: number;
17
+ pageHeight: number;
18
+ pageWidth: number;
19
+ polygon: PolygonPoint[];
20
+ referenceText: string;
21
+ }
22
+ export interface StatementTransaction {
23
+ amount: number;
24
+ citations: Citation[];
25
+ isUserAdded: boolean;
26
+ isUserEdited: boolean;
27
+ statementTransactionId: string;
28
+ transactionDate: string;
29
+ transactionDirection: 'debit' | 'credit';
30
+ transactionMemo: string;
31
+ }
32
+ export interface StatementMeta {
33
+ closingBalance: number;
34
+ openingBalance: number;
35
+ statementDataStatus: {
36
+ code: string;
37
+ label: string;
38
+ };
39
+ statementEndDate: string;
40
+ statementStartDate: string;
41
+ statementStatus: {
42
+ code: string;
43
+ label: string;
44
+ };
45
+ statementUploadId: string;
46
+ totalDeposits: number;
47
+ totalPayments: number;
48
+ }
49
+ export interface AccountInfo {
50
+ accountId: string;
51
+ accountName: string;
52
+ accountType: string;
53
+ currencyCode: string;
54
+ last4Digits: string | null;
55
+ }
56
+ export interface FileInfo {
57
+ fileId: string;
58
+ fileName: string;
59
+ signedUrl: string;
60
+ }
61
+ export interface AiSummaryField {
62
+ code: string;
63
+ label: string;
64
+ }
65
+ export interface PreviousReconciliationInfo {
66
+ endDate: string;
67
+ reconciledAt: string;
68
+ reconciledByUserId: string;
69
+ reconciliationId: string;
70
+ startDate: string;
71
+ }
72
+ export interface AiSummaryChainStatus {
73
+ code: string;
74
+ expectedStartDate: string | null;
75
+ label: string;
76
+ previousReconciliationInfo: PreviousReconciliationInfo | null;
77
+ }
78
+ /**
79
+ * Surfaced when Confirm & Save is rejected with a 409 because the statement
80
+ * period overlaps with / leaves a gap after an already-reconciled period.
81
+ */
82
+ export interface StatementDateConflict {
83
+ errorCode: string;
84
+ expectedStartDate: string | null;
85
+ /** Present for overlap conflicts; GAP-only 409s may omit prior recon info. */
86
+ previousReconciliationInfo?: PreviousReconciliationInfo;
87
+ }
88
+ export interface AiSummary {
89
+ accountIdentified: string | null;
90
+ chainStatus: AiSummaryChainStatus;
91
+ exceptionsDetected: number;
92
+ fieldsCaptured: AiSummaryField[];
93
+ transactionsExtracted: number;
94
+ }
95
+ export interface StatementUpload {
96
+ account: AccountInfo;
97
+ file: FileInfo | null;
98
+ statementMeta: StatementMeta;
99
+ statementTransactions: StatementTransaction[];
100
+ aiSummary?: AiSummary | null;
101
+ }
102
+ export interface ParsedStatementData {
103
+ statementUpload: StatementUpload;
104
+ }
105
+ export interface ReconciliationSummaryAccounts {
106
+ done: number;
107
+ failed: number;
108
+ inProgress: number;
109
+ total: number;
110
+ }
111
+ export interface ReconciliationSummaryAutoMatched {
112
+ matchedTxns: number;
113
+ totalTxns: number;
114
+ }
115
+ export interface ReconciliationSummaryNeedsReview {
116
+ accountCount: number;
117
+ txnCount: number;
118
+ }
119
+ export interface ReconciliationSummaryProgressBar {
120
+ aiPercentageShare: number;
121
+ completePercentage: number;
122
+ humanPercentageShare: number;
123
+ remainingPercentage: number;
124
+ }
125
+ export interface ReconciliationViewSummary {
126
+ accounts: ReconciliationSummaryAccounts;
127
+ accountsToConnectCount: number;
128
+ autoMatched: ReconciliationSummaryAutoMatched;
129
+ needsReview: ReconciliationSummaryNeedsReview;
130
+ timeSavedHours: number;
131
+ timeSavedPercentage: number;
132
+ progressBar?: ReconciliationSummaryProgressBar;
133
+ }
134
+ export declare function toReconciliationViewSummary(payload: ReconciliationSummaryPayload): ReconciliationViewSummary;
10
135
  export declare const RECONCILE_ACTIONS: readonly ["reconcile", "save_reconcile_for_later", "exclude"];
11
136
  export declare const toReconcileActions: (v: string) => "reconcile" | "save_reconcile_for_later" | "exclude";
12
137
  export type ReconcileActionType = ReturnType<typeof toReconcileActions>;
@@ -107,9 +232,11 @@ export interface ReconciliationViewState extends FetchStateAndError {
107
232
  reconTabsState: ReconciliationTabsState;
108
233
  refreshStatus: FetchStateAndError;
109
234
  selectedTab: ReconciliationViewTabType;
235
+ statementProcessingFailed: boolean;
110
236
  statementUploadChosen: boolean;
111
237
  selectedAccountId?: ID;
112
238
  selectedDrawerAccountId?: ID;
239
+ summary?: ReconciliationViewSummary;
113
240
  }
114
241
  export interface BankConnectionStatus {
115
242
  connectionInProgress: boolean;
@@ -120,19 +247,67 @@ export interface AccountReconciliationRecords {
120
247
  accountIDs: ID[];
121
248
  reconciliationByAccountID: Record<ID, AccountReconciliationDataWithTransactionFetchState>;
122
249
  }
250
+ export interface StatementTransactionForUpdate {
251
+ amount: number;
252
+ transactionDate: string;
253
+ transactionDirection: 'debit' | 'credit';
254
+ transactionMemo: string;
255
+ statementTransactionId?: string;
256
+ }
257
+ export interface StatementTransactionsUpdate {
258
+ added: StatementTransactionForUpdate[];
259
+ deletedIds: string[];
260
+ updated: StatementTransactionForUpdate[];
261
+ }
262
+ export interface StatementUpdateLocalData {
263
+ statementMeta: StatementMeta;
264
+ statementTransactions: StatementTransactionsUpdate;
265
+ }
266
+ export interface StatementUpdateLocalDataPayload {
267
+ statement_meta: {
268
+ opening_balance: number;
269
+ statement_end_date: string;
270
+ statement_start_date: string;
271
+ total_deposits: number;
272
+ total_payments: number;
273
+ };
274
+ statement_transactions: {
275
+ added: Array<{
276
+ amount: number;
277
+ transaction_date: string;
278
+ transaction_direction: 'debit' | 'credit';
279
+ transaction_memo: string;
280
+ }>;
281
+ deleted_ids: string[];
282
+ updated: Array<{
283
+ amount: number;
284
+ statement_transaction_id: string;
285
+ transaction_date: string;
286
+ transaction_direction: 'debit' | 'credit';
287
+ transaction_memo: string;
288
+ }>;
289
+ };
290
+ }
123
291
  export interface AccountReconciliationLocalData {
124
292
  accountSource?: ReconciliationAccountSourceType;
293
+ statementUpdateLocalData?: StatementUpdateLocalData;
125
294
  }
126
295
  export interface AccountReconciliationDataWithTransactionFetchState {
127
296
  accountId: ID;
128
297
  localData: AccountReconciliationLocalData;
129
298
  refreshStatus: FetchStateAndError;
299
+ reparseStatementStatus: FetchStateAndError;
300
+ statementDateConflict: StatementDateConflict | null;
130
301
  statementDeleteStatus: FetchStateAndError;
302
+ /** Derived from bank_status.code === 'parsing' for read-only list/drawer banners. */
131
303
  statementParseInProgress: boolean;
304
+ /** Client-driven fetch state for the parseStatement epic (In-Progress/Completed/Error). */
305
+ statementParseStatus: FetchStateAndError;
132
306
  statementUpdateStatus: FetchStateAndError;
133
307
  statementUploadStatus: FetchStateAndError;
134
308
  transactionFetchState: FetchStateAndError;
135
309
  accountDetectionReason?: string;
310
+ parsedStatementData?: ParsedStatementData;
136
311
  reconciliationId?: ID;
137
312
  }
138
313
  export {};
@@ -1,7 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toReconciliationTabsType = exports.toReconcileActions = exports.RECONCILE_ACTIONS = void 0;
4
+ exports.toReconciliationViewSummary = toReconciliationViewSummary;
4
5
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
6
+ function toReconciliationViewSummary(payload) {
7
+ return {
8
+ accounts: {
9
+ done: payload.accounts.done,
10
+ failed: payload.accounts.failed,
11
+ inProgress: payload.accounts.in_progress,
12
+ total: payload.accounts.total,
13
+ },
14
+ accountsToConnectCount: payload.accounts_to_connect_count,
15
+ autoMatched: {
16
+ matchedTxns: payload.auto_matched.matched_txns,
17
+ totalTxns: payload.auto_matched.total_txns,
18
+ },
19
+ needsReview: {
20
+ accountCount: payload.needs_review.account_count,
21
+ txnCount: payload.needs_review.txn_count,
22
+ },
23
+ timeSavedHours: 0,
24
+ timeSavedPercentage: payload.time_saved_percentage,
25
+ progressBar: payload.progress_bar != null
26
+ ? {
27
+ aiPercentageShare: payload.progress_bar.ai_percentage_share,
28
+ completePercentage: payload.progress_bar.complete_percentage,
29
+ humanPercentageShare: payload.progress_bar.human_percentage_share,
30
+ remainingPercentage: payload.progress_bar.remaining_percentage,
31
+ }
32
+ : undefined,
33
+ };
34
+ }
5
35
  exports.RECONCILE_ACTIONS = [
6
36
  'reconcile',
7
37
  'save_reconcile_for_later',
@@ -116,32 +116,20 @@ 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);
120
119
  if (isCardsEnabled && isBankingOnly) {
121
- const selectedProducts = ['zeni_cards', 'zeni_checking'];
122
- if (isTreasuryEnabled) {
123
- selectedProducts.push('zeni_treasury');
124
- }
125
- return selectedProducts;
120
+ return [];
126
121
  }
127
122
  else if (isBankingOnly) {
128
- const selectedProducts = ['zeni_checking'];
129
- if (isTreasuryEnabled) {
130
- selectedProducts.push('zeni_treasury');
131
- }
132
- return selectedProducts;
123
+ return [];
133
124
  }
134
125
  else if (isCardsEnabled) {
135
- return ['zeni_cards'];
126
+ return [];
136
127
  }
137
128
  else if (isBookkeepingEnabled) {
138
129
  return [
139
130
  'bookkeeping',
140
131
  'zeni_bill_pay',
141
- 'zeni_checking',
142
132
  'zeni_reimbursements',
143
- 'zeni_treasury',
144
- 'zeni_cards',
145
133
  ];
146
134
  }
147
135
  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 = true;
54
+ onboardingCustomerPayload.is_banking_enabled = isChecking;
55
55
  onboardingCustomerPayload.is_spend_management_enabled = true;
56
- onboardingCustomerPayload.is_card_enabled = true;
56
+ onboardingCustomerPayload.is_card_enabled = isCards;
57
57
  onboardingCustomerPayload.is_treasury_enabled = isTreasury;
58
58
  }
59
59
  else if (isChecking && isCards) {
@@ -20,7 +20,7 @@ export interface VendorFiling1099ListQuery {
20
20
  sortKey: VendorFiling1099ListViewSortKey;
21
21
  sortOrder: SortOrder;
22
22
  }
23
- declare const toVendorFiling1099ListViewSortKey: (v: string) => "status" | "w9" | "legal_name" | "total" | "tax_classification" | "filing1099type";
23
+ declare const toVendorFiling1099ListViewSortKey: (v: string) => "status" | "w9" | "total" | "legal_name" | "tax_classification" | "filing1099type";
24
24
  export type VendorFiling1099ListViewSortKey = ReturnType<typeof toVendorFiling1099ListViewSortKey>;
25
25
  export type Type1099Download = 'nec' | 'misc' | 'int';
26
26
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.34",
3
+ "version": "5.1.35",
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,9 @@
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",
135
+ "bump-versions-beta": "chmod +x ./scripts/bump_versions_beta.sh && ./scripts/bump_versions_beta.sh",
133
136
  "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
137
  "send-release-notes": "chmod +x ./scripts/send_release_notes.sh && ./scripts/send_release_notes.sh",
135
138
  "update-slack-group-topic": "chmod +x ./scripts/update-slack-group-topic.sh && ./scripts/update-slack-group-topic.sh",