@zeniai/client-epic-state 5.0.80 → 5.0.81-beta0ND

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 (222) hide show
  1. package/lib/commonStateTypes/cacheOverrideFetchReducer.d.ts +17 -0
  2. package/lib/commonStateTypes/cacheOverrideFetchReducer.js +20 -0
  3. package/lib/commonStateTypes/filterPrimitives.d.ts +23 -0
  4. package/lib/commonStateTypes/filterPrimitives.js +21 -0
  5. package/lib/commonStateTypes/pusherActions.d.ts +11 -0
  6. package/lib/commonStateTypes/pusherActions.js +6 -0
  7. package/lib/coreEpics.js +1 -1
  8. package/lib/entity/account/accountSelector.d.ts +27 -1
  9. package/lib/entity/account/accountSelector.js +47 -1
  10. package/lib/entity/account/accountState.d.ts +6 -1
  11. package/lib/entity/account/accountState.js +11 -4
  12. package/lib/entity/account/subAccountSelector.d.ts +1 -1
  13. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -3
  14. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +1 -2
  15. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +1 -1
  16. package/lib/entity/chargeCard/chargeCardReducer.d.ts +19 -2
  17. package/lib/entity/chargeCard/chargeCardReducer.js +35 -2
  18. package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +14 -1
  19. package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +36 -2
  20. package/lib/entity/class/classSelector.d.ts +35 -0
  21. package/lib/entity/class/classSelector.js +50 -0
  22. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +1 -0
  23. package/lib/entity/paymentAccount/paymentAccountSelector.js +4 -0
  24. package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +1 -1
  25. package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
  26. package/lib/entity/tenant/SessionManager.js +6 -3
  27. package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
  28. package/lib/entity/tenant/clearAllEpic.js +2 -2
  29. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  30. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +21 -0
  31. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +54 -0
  32. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  33. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +6 -2
  34. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  35. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  36. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +6 -2
  37. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  38. package/lib/entity/tenant/tenantReducer.d.ts +38 -25
  39. package/lib/entity/tenant/tenantReducer.js +71 -6
  40. package/lib/entity/tenant/tenantState.d.ts +1 -0
  41. package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +3 -1
  42. package/lib/epic.d.ts +13 -11
  43. package/lib/epic.js +15 -12
  44. package/lib/esm/commonStateTypes/cacheOverrideFetchReducer.js +16 -0
  45. package/lib/esm/commonStateTypes/filterPrimitives.js +20 -0
  46. package/lib/esm/commonStateTypes/pusherActions.js +3 -0
  47. package/lib/esm/coreEpics.js +1 -1
  48. package/lib/esm/entity/account/accountSelector.js +46 -1
  49. package/lib/esm/entity/account/accountState.js +7 -1
  50. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -3
  51. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +1 -2
  52. package/lib/esm/entity/chargeCard/chargeCardReducer.js +34 -1
  53. package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +35 -1
  54. package/lib/esm/entity/class/classSelector.js +48 -0
  55. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +3 -0
  56. package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
  57. package/lib/esm/entity/tenant/SessionManager.js +4 -1
  58. package/lib/esm/entity/tenant/clearAllEpic.js +2 -2
  59. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +50 -0
  60. package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +6 -2
  61. package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +6 -2
  62. package/lib/esm/entity/tenant/tenantReducer.js +69 -4
  63. package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +3 -1
  64. package/lib/esm/epic.js +15 -12
  65. package/lib/esm/index.js +38 -25
  66. package/lib/esm/reducer.js +2 -2
  67. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +2 -5
  68. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +2 -5
  69. package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +4 -1
  70. package/lib/esm/view/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
  71. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
  72. package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -1
  73. package/lib/esm/view/companyView/helpers/cockpitHelpers.js +1 -1
  74. package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +1 -1
  75. package/lib/esm/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
  76. package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +1 -16
  77. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
  78. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -1
  79. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +8 -6
  80. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -1
  81. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +11 -1
  82. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +21 -1
  83. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
  84. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +253 -14
  85. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +147 -13
  86. package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +258 -0
  87. package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +17 -0
  88. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -2
  89. package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -1
  90. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +61 -50
  91. package/lib/esm/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +87 -0
  92. package/lib/esm/view/recommendation/recommendationHelper.js +29 -0
  93. package/lib/esm/view/recommendation/recommendationReducer.js +26 -1
  94. package/lib/esm/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
  95. package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
  96. package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
  97. package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
  98. package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
  99. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +26 -9
  100. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
  101. package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
  102. package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
  103. package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
  104. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +49 -0
  105. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +58 -0
  106. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +12 -0
  107. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +205 -0
  108. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +71 -52
  109. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
  110. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +28 -0
  111. package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +4 -2
  112. package/lib/esm/view/subscriptionView/subscriptionViewSelector.js +1 -1
  113. package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +1 -1
  114. package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +1 -1
  115. package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +1 -1
  116. package/lib/esm/view/taskManager/taskListView/taskListReducer.js +1 -1
  117. package/lib/esm/view/transactionDetail/transactionDetailReducer.js +121 -6
  118. package/lib/esm/view/transactionDetail/transactionDetailSelector.js +29 -1
  119. package/lib/index.d.ts +39 -28
  120. package/lib/index.js +97 -60
  121. package/lib/reducer.d.ts +2 -2
  122. package/lib/reducer.js +2 -2
  123. package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +2 -2
  124. package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +1 -1
  125. package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +2 -5
  126. package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +2 -5
  127. package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +4 -1
  128. package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
  129. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +1 -1
  130. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
  131. package/lib/view/companyView/helpers/cockpitHelpers.js +1 -1
  132. package/lib/view/companyView/selector/companyManagementViewSelector.js +1 -1
  133. package/lib/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
  134. package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
  135. package/lib/view/creditAgentView/creditAgentViewPayload.d.ts +0 -3
  136. package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +1 -1
  137. package/lib/view/creditAgentView/creditAgentViewReducer.js +2 -17
  138. package/lib/view/creditAgentView/creditAgentViewState.d.ts +0 -5
  139. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
  140. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -1
  141. package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +8 -6
  142. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -1
  143. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
  144. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +10 -0
  145. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +2 -1
  146. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +23 -2
  147. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +21 -0
  148. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +2 -1
  149. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
  150. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +28 -5
  151. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +253 -14
  152. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -1
  153. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +16 -0
  154. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +7 -1
  155. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +150 -13
  156. package/lib/view/expenseAutomationView/transactionFilterHelpers.d.ts +66 -0
  157. package/lib/view/expenseAutomationView/transactionFilterHelpers.js +262 -0
  158. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +10 -0
  159. package/lib/view/expenseAutomationView/types/completedSubTab.js +21 -0
  160. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -2
  161. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -4
  162. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +44 -2
  163. package/lib/view/financeStatement/financeStatementSelector.js +1 -1
  164. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +25 -2
  165. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +62 -51
  166. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +10 -0
  167. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +1 -1
  168. package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.d.ts +9 -0
  169. package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +91 -0
  170. package/lib/view/recommendation/recommendationHelper.d.ts +9 -0
  171. package/lib/view/recommendation/recommendationHelper.js +31 -1
  172. package/lib/view/recommendation/recommendationReducer.d.ts +20 -1
  173. package/lib/view/recommendation/recommendationReducer.js +27 -2
  174. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  175. package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.d.ts +3 -1
  176. package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
  177. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.d.ts +3 -1
  178. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
  179. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
  180. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
  181. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
  182. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +18 -3
  183. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +27 -10
  184. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
  185. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.d.ts +1 -1
  186. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +3 -1
  187. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
  188. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
  189. package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.d.ts +3 -1
  190. package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
  191. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +8 -0
  192. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +53 -0
  193. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +8 -0
  194. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +62 -0
  195. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +27 -0
  196. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +15 -0
  197. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +24 -0
  198. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +213 -0
  199. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +24 -2
  200. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +72 -53
  201. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +4 -0
  202. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
  203. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +12 -0
  204. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +125 -0
  205. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +32 -0
  206. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  207. package/lib/view/spendManagement/spendManagementFilterHelpers.d.ts +12 -3
  208. package/lib/view/spendManagement/spendManagementFilterHelpers.js +4 -2
  209. package/lib/view/subscriptionView/subscriptionViewSelector.js +1 -1
  210. package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
  211. package/lib/view/taskManager/taskListView/taskListReducer.js +1 -1
  212. package/lib/view/transactionDetail/transactionDetailReducer.d.ts +11 -1
  213. package/lib/view/transactionDetail/transactionDetailReducer.js +122 -7
  214. package/lib/view/transactionDetail/transactionDetailSelector.d.ts +2 -0
  215. package/lib/view/transactionDetail/transactionDetailSelector.js +31 -2
  216. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +1 -0
  217. package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +1 -1
  218. package/package.json +10 -4
  219. package/lib/esm/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +0 -13
  220. package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
  221. package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.d.ts +0 -11
  222. package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +0 -17
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Shared types for the KYC / KYB document autofill flow that lives inside the
3
+ * commonSetup feature (Setup pages + Onboarding both consume it via the same
4
+ * selector view; there is no separate state slice).
5
+ *
6
+ * Backed by document-communication-agent `POST /1.0/documents/process/sync`,
7
+ * which proxies document-service ExtendAI parsers and returns one of the
8
+ * parser payloads below — each value shaped as `{value, confidence}` per field.
9
+ */
10
+ import { ID } from '../../../../commonStateTypes/common';
11
+ /**
12
+ * Form-side identity document types as picked in `SelectDocumentField`.
13
+ * These are camelCase per the web-components convention.
14
+ */
15
+ export type KycSelectDocumentType = 'driverLicense' | 'passport' | 'ssnCard' | 'stateId';
16
+ /**
17
+ * KYC document types accepted by the document-service parsers (snake_case).
18
+ * Subset of {@link KycKybProvidedDocumentType}. `stateId` from the form maps
19
+ * to no parser today and is skipped at dispatch time.
20
+ */
21
+ export type KycProvidedDocumentType = 'passport' | 'driving_license' | 'social_security_card';
22
+ /** KYB document types accepted by the document-service parsers. */
23
+ export type KybProvidedDocumentType = 'certificate_of_incorporation' | 'tax_ein';
24
+ /** All KYC / KYB document types accepted by document-communication-agent. */
25
+ export type KycKybProvidedDocumentType = KycProvidedDocumentType | KybProvidedDocumentType;
26
+ /** Field value with model confidence (0..1) as returned by ExtendAI parsers. */
27
+ export interface FieldWithConfidence<T = string | null> {
28
+ confidence: number;
29
+ value: T | null;
30
+ }
31
+ /**
32
+ * Parser payloads — keep in sync with document-service
33
+ * `processors/parsers/extend_*_parser.py`.
34
+ */
35
+ export interface ExtendPassportParsed {
36
+ date_of_birth?: FieldWithConfidence;
37
+ date_of_expiry?: FieldWithConfidence;
38
+ date_of_issue?: FieldWithConfidence;
39
+ first_name?: FieldWithConfidence;
40
+ gender?: FieldWithConfidence;
41
+ issuing_authority?: FieldWithConfidence;
42
+ last_name?: FieldWithConfidence;
43
+ mrz_line_1?: FieldWithConfidence;
44
+ mrz_line_2?: FieldWithConfidence;
45
+ nationality?: FieldWithConfidence;
46
+ passport_number?: FieldWithConfidence;
47
+ place_of_birth?: FieldWithConfidence;
48
+ }
49
+ export interface ExtendDrivingLicenseParsed {
50
+ address_city?: FieldWithConfidence;
51
+ address_state?: FieldWithConfidence;
52
+ address_street?: FieldWithConfidence;
53
+ address_zip?: FieldWithConfidence;
54
+ date_of_birth?: FieldWithConfidence;
55
+ date_of_expiry?: FieldWithConfidence;
56
+ date_of_issue?: FieldWithConfidence;
57
+ first_name?: FieldWithConfidence;
58
+ issuing_state?: FieldWithConfidence;
59
+ last_name?: FieldWithConfidence;
60
+ license_number?: FieldWithConfidence;
61
+ middle_name?: FieldWithConfidence;
62
+ }
63
+ export interface ExtendSsnCardParsed {
64
+ full_name?: FieldWithConfidence;
65
+ }
66
+ export interface ExtendCertificateOfIncorporationParsed {
67
+ company_address?: FieldWithConfidence;
68
+ company_legal_name?: FieldWithConfidence;
69
+ countries_of_operations?: FieldWithConfidence<string[]>;
70
+ date_of_incorporation?: FieldWithConfidence;
71
+ ein?: FieldWithConfidence;
72
+ industry?: FieldWithConfidence;
73
+ phone_number?: FieldWithConfidence;
74
+ product_description?: FieldWithConfidence;
75
+ purpose_of_account?: FieldWithConfidence;
76
+ registered_address?: FieldWithConfidence;
77
+ regulated_status?: FieldWithConfidence;
78
+ source_of_funds?: FieldWithConfidence;
79
+ state_of_incorporation?: FieldWithConfidence;
80
+ sub_industry?: FieldWithConfidence;
81
+ sub_us_nexus?: FieldWithConfidence;
82
+ transaction_volume_expectations?: FieldWithConfidence;
83
+ type_of_incorporation?: FieldWithConfidence;
84
+ us_nexus?: FieldWithConfidence;
85
+ website?: FieldWithConfidence;
86
+ }
87
+ export interface ExtendTaxEinParsed {
88
+ ein?: FieldWithConfidence;
89
+ irs_address?: FieldWithConfidence;
90
+ legal_business_name?: FieldWithConfidence;
91
+ trade_name?: FieldWithConfidence;
92
+ }
93
+ /** POST /1.0/documents/process/sync request body. */
94
+ export interface SyncDocumentsProcessRequest {
95
+ files: Array<{
96
+ file_id: ID;
97
+ }>;
98
+ provided_document_type: KycKybProvidedDocumentType;
99
+ metadata?: {
100
+ source?: string;
101
+ } & Record<string, unknown>;
102
+ processing_priority?: number;
103
+ }
104
+ /** POST /1.0/documents/process/sync response body. */
105
+ export interface SyncDocumentsProcessResponse {
106
+ data: ExtendPassportParsed | ExtendDrivingLicenseParsed | ExtendSsnCardParsed | ExtendCertificateOfIncorporationParsed | ExtendTaxEinParsed | null;
107
+ status: {
108
+ code: number;
109
+ message: string;
110
+ };
111
+ }
112
+ /**
113
+ * Discriminator for which Redux slice to apply the autofill to — setup pages
114
+ * (`spendManagement/commonSetup`) and onboarding (`onboardingView/customerView`)
115
+ * share the same field shapes but live in separate slices.
116
+ */
117
+ export type KycKybAutofillTarget = 'setup' | 'onboarding';
118
+ /** Confidence floor below which we drop an autofill candidate. */
119
+ export declare const KYC_KYB_AUTOFILL_MIN_CONFIDENCE = 0.5;
120
+ /**
121
+ * Maps the form-side {@link KycSelectDocumentType} (camelCase) to the
122
+ * parser-side {@link KycProvidedDocumentType} (snake_case). Returns `null` for
123
+ * `stateId`, which has no parser today.
124
+ */
125
+ export declare const toKycProvidedDocumentType: (selectType: KycSelectDocumentType) => KycProvidedDocumentType | null;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /**
3
+ * Shared types for the KYC / KYB document autofill flow that lives inside the
4
+ * commonSetup feature (Setup pages + Onboarding both consume it via the same
5
+ * selector view; there is no separate state slice).
6
+ *
7
+ * Backed by document-communication-agent `POST /1.0/documents/process/sync`,
8
+ * which proxies document-service ExtendAI parsers and returns one of the
9
+ * parser payloads below — each value shaped as `{value, confidence}` per field.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.toKycProvidedDocumentType = exports.KYC_KYB_AUTOFILL_MIN_CONFIDENCE = void 0;
13
+ /** Confidence floor below which we drop an autofill candidate. */
14
+ exports.KYC_KYB_AUTOFILL_MIN_CONFIDENCE = 0.5;
15
+ /**
16
+ * Maps the form-side {@link KycSelectDocumentType} (camelCase) to the
17
+ * parser-side {@link KycProvidedDocumentType} (snake_case). Returns `null` for
18
+ * `stateId`, which has no parser today.
19
+ */
20
+ const toKycProvidedDocumentType = (selectType) => {
21
+ switch (selectType) {
22
+ case 'driverLicense':
23
+ return 'driving_license';
24
+ case 'passport':
25
+ return 'passport';
26
+ case 'ssnCard':
27
+ return 'social_security_card';
28
+ case 'stateId':
29
+ return null;
30
+ }
31
+ };
32
+ exports.toKycProvidedDocumentType = toKycProvidedDocumentType;
@@ -46,7 +46,7 @@ export interface ReimbursementFilters {
46
46
  }
47
47
  export interface ReimbursementFilterCategory {
48
48
  field: RemiListViewFilterCategoryField;
49
- matchingOperator: 'equal' | 'not-equal';
49
+ matchingOperator: 'equal' | 'not_equal';
50
50
  values: (string | ZeniDate)[];
51
51
  valuesCombinationOperator: 'ANY';
52
52
  }
@@ -1,3 +1,4 @@
1
+ import { CategoryCombinationOperator, FilterCategoryType } from '../../commonStateTypes/filterPrimitives';
1
2
  import { TimePeriod } from '../../commonStateTypes/timePeriod';
2
3
  import { UserRoleType } from '../../entity/userRole/userRoleType';
3
4
  import { RootState } from '../../reducer';
@@ -12,12 +13,20 @@ import { ReimbursementView } from './reimbursement/remiListView/remiListSelector
12
13
  import { ReimbursementFilters, RemiListViewFilterCategoryField } from './reimbursement/remiListView/remiListState';
13
14
  export type SpendManagementFiltersType = BillPayFilters | ReimbursementFilters | TaskListFilters | PaymentHistoryFilters;
14
15
  export type SpendManagementFilterEntityType = 'bill_pay' | 'reimbursement' | 'task_management' | 'charge_card_payment_history';
15
- export type FilterCategoryType = 'searchAutocomplete' | 'user' | 'dateRange' | 'numberRange' | 'dropdown';
16
+ /**
17
+ * Re-exported here so consumers of `spendManagementFilterHelpers` keep
18
+ * their existing import path stable after the primitives moved to
19
+ * `commonStateTypes/filterPrimitives`. Downstream files (`taskList`,
20
+ * `remiListState`, `chargeCardPaymentHistory`, `billListState`) and the
21
+ * CES barrel still pull `CategoryCombinationOperator` / `FilterCategoryType`
22
+ * from this module — the source of truth is upstream but the surface is
23
+ * unchanged.
24
+ */
25
+ export type { CategoryCombinationOperator, FilterCategoryType };
16
26
  export interface MatchingOperatorDropdownOption {
17
27
  label: 'is' | 'is not';
18
- value: 'equal' | 'not-equal';
28
+ value: 'equal' | 'not_equal';
19
29
  }
20
- export type CategoryCombinationOperator = 'AND' | 'OR';
21
30
  export interface BillPayFilterCategoryDropdownOption {
22
31
  value: BillListViewFilterCategoryField;
23
32
  multiple?: boolean;
@@ -14,6 +14,8 @@ const helpers_1 = require("./helpers");
14
14
  const remiListSelector_1 = require("./reimbursement/remiListView/remiListSelector");
15
15
  const remiListState_1 = require("./reimbursement/remiListView/remiListState");
16
16
  //filters items against filter values representing a range. ex: date (from-to), amount(1k<-->5k)
17
+ // Spend Management uses only equal/not_equal — TC amount operators
18
+ // (inBetween, lessThan, greaterThan) live in the TC filter pipeline.
17
19
  const filterItemOnRangeCategoryType = (valueForItem, currentFilter) => {
18
20
  let doesItemFallInValueRange = false;
19
21
  const filterField = currentFilter.field;
@@ -47,7 +49,7 @@ const filterItemOnCategoriesWithSingleValue = (categoryValue, currentFilter, ran
47
49
  return filterItemOnRangeCategoryType(categoryValue, currentFilter);
48
50
  }
49
51
  // if filter category is not rangeType
50
- if (currentFilter.matchingOperator === 'not-equal') {
52
+ if (currentFilter.matchingOperator === 'not_equal') {
51
53
  return currentFilter.values.indexOf(categoryValue.toString()) === -1;
52
54
  }
53
55
  return currentFilter.values.indexOf(categoryValue.toString()) > -1;
@@ -121,7 +123,7 @@ const applyAdvancedFiltersOnList = (entity, allItems, filters, filteredItems = [
121
123
  ? getCategoryValueForTaskList(key, item)
122
124
  : getCategoryValueForPaymentHistory(key, item);
123
125
  if (categoryValue == null) {
124
- if (currentFilter.matchingOperator === 'not-equal') {
126
+ if (currentFilter.matchingOperator === 'not_equal') {
125
127
  return true;
126
128
  }
127
129
  return false;
@@ -217,7 +217,7 @@ const applyAdvancedFiltersOnCompaniesList = (allCompanies, filters, filteredComp
217
217
  const key = currentFilter.field;
218
218
  const categoryValue = getCategoryValueForCompany(key, company);
219
219
  if (categoryValue == null) {
220
- if (currentFilter.matchingOperator === 'not-equal') {
220
+ if (currentFilter.matchingOperator === 'not_equal') {
221
221
  return true;
222
222
  }
223
223
  return false;
@@ -44,7 +44,7 @@ export interface TaskListFilters {
44
44
  }
45
45
  export interface TaskFilterCategory {
46
46
  field: TaskListFilterCategoryField;
47
- matchingOperator: 'equal' | 'not-equal';
47
+ matchingOperator: 'equal' | 'not_equal';
48
48
  values: (string | ZeniDate)[];
49
49
  valuesCombinationOperator: 'ANY';
50
50
  }
@@ -70,7 +70,7 @@ exports.initialState = {
70
70
  categories: [
71
71
  {
72
72
  field: 'status',
73
- matchingOperator: 'not-equal',
73
+ matchingOperator: 'not_equal',
74
74
  values: ['resolved'],
75
75
  valuesCombinationOperator: 'ANY',
76
76
  },
@@ -115,7 +115,17 @@ export declare const downloadAccountingProviderAttachment: import("@reduxjs/tool
115
115
  amount: number;
116
116
  recommendationWithCOTByLineId: RecommendationWithCOTByLineId;
117
117
  uncategorizedIncomeExpense: UncategorizedAccounts;
118
- }, "transactionDetail/setEntityRecommendationForLineIdsForTransactionDetail", never, never>, removeEntityRecommendationForLineIdForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineId: string], {
118
+ }, "transactionDetail/setEntityRecommendationForLineIdsForTransactionDetail", never, never>, markCategoryClassRecommendationsInProgressForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, lineIds: string[]], {
119
+ transactionId: TransactionID;
120
+ lineIds: string[];
121
+ }, "transactionDetail/markCategoryClassRecommendationsInProgressForTransactionDetail", never, never>, markCategoryClassRecommendationsCompletedForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, lineIds: string[]], {
122
+ transactionId: TransactionID;
123
+ lineIds: string[];
124
+ }, "transactionDetail/markCategoryClassRecommendationsCompletedForTransactionDetail", never, never>, markCategoryClassRecommendationsFailureForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, lineIds: string[], error: ZeniAPIStatus<Record<string, unknown>>], {
125
+ transactionId: TransactionID;
126
+ lineIds: string[];
127
+ error: ZeniAPIStatus<Record<string, unknown>>;
128
+ }, "transactionDetail/markCategoryClassRecommendationsFailureForTransactionDetail", never, never>, removeEntityRecommendationForLineIdForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineId: string], {
119
129
  transactionId: TransactionID;
120
130
  transaction: SupportedTransaction;
121
131
  lineId: string;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  var _a;
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.setIsVendorUpdateAllChecked = exports.updateVendorBulkRecommendationsFetchStatus = exports.updateLatestSelectedEntity = exports.resetAllLineItemsToVendor = exports.updateVendorToAllLineItems = exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = exports.resetSelectedCustomer = exports.resetVendor = exports.updateSelectedCustomer = exports.updateSelectedVendor = exports.removeEntityRecommendationForLineIdForTransactionDetail = exports.setEntityRecommendationForLineIdsForTransactionDetail = exports.setAllLineItemsLocalDataIsUpdateAllChecked = exports.setAllLineItemsToCategoryClassInLocalData = exports.resetLineItemsCategoryClassInLocalData = exports.clearTransactionDetailLocalData = exports.saveTransactionDetailLocalData = exports.initializeTransactionDetailLocalData = exports.saveTransactionDetail = exports.updateTransactionStateIfUpdateActionNotAllowed = exports.updateStatusConsolidatedSaveTransactionDetail = exports.updateStatusForTransactionNotMiscategorizedUpdate = exports.deleteTransactionAttachmentSuccess = exports.deleteTransactionAttachmentFailure = exports.deleteTransactionAttachment = exports.markTransactionAsNotMiscategorized = exports.clearTransactionDetailSaveStatus = exports.updateTransactionDetailSaveStatus = exports.updateTransactionDetail = exports.uploadMissingAttachmentSuccess = exports.clearTransactionDetail = exports.removeTransactionDetail = exports.updateTransactionDetailFetchState = exports.fetchTransactionDetail = exports.downloadAccountingProviderAttachmentFailure = exports.downloadAccountingProviderAttachmentSuccess = exports.downloadAccountingProviderAttachment = exports.initialState = void 0;
7
+ exports.setIsVendorUpdateAllChecked = exports.updateVendorBulkRecommendationsFetchStatus = exports.updateLatestSelectedEntity = exports.resetAllLineItemsToVendor = exports.updateVendorToAllLineItems = exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = exports.resetSelectedCustomer = exports.resetVendor = exports.updateSelectedCustomer = exports.updateSelectedVendor = exports.removeEntityRecommendationForLineIdForTransactionDetail = exports.markCategoryClassRecommendationsFailureForTransactionDetail = exports.markCategoryClassRecommendationsCompletedForTransactionDetail = exports.markCategoryClassRecommendationsInProgressForTransactionDetail = exports.setEntityRecommendationForLineIdsForTransactionDetail = exports.setAllLineItemsLocalDataIsUpdateAllChecked = exports.setAllLineItemsToCategoryClassInLocalData = exports.resetLineItemsCategoryClassInLocalData = exports.clearTransactionDetailLocalData = exports.saveTransactionDetailLocalData = exports.initializeTransactionDetailLocalData = exports.saveTransactionDetail = exports.updateTransactionStateIfUpdateActionNotAllowed = exports.updateStatusConsolidatedSaveTransactionDetail = exports.updateStatusForTransactionNotMiscategorizedUpdate = exports.deleteTransactionAttachmentSuccess = exports.deleteTransactionAttachmentFailure = exports.deleteTransactionAttachment = exports.markTransactionAsNotMiscategorized = exports.clearTransactionDetailSaveStatus = exports.updateTransactionDetailSaveStatus = exports.updateTransactionDetail = exports.uploadMissingAttachmentSuccess = exports.clearTransactionDetail = exports.removeTransactionDetail = exports.updateTransactionDetailFetchState = exports.fetchTransactionDetail = exports.downloadAccountingProviderAttachmentFailure = exports.downloadAccountingProviderAttachmentSuccess = exports.downloadAccountingProviderAttachment = exports.initialState = void 0;
8
8
  const toolkit_1 = require("@reduxjs/toolkit");
9
9
  const get_1 = __importDefault(require("lodash/get"));
10
10
  const entity_1 = require("../../entity/genericEntity/entity");
@@ -245,12 +245,34 @@ const transactionDetail = (0, toolkit_1.createSlice)({
245
245
  saveTransactionDetailLocalData(draft, action) {
246
246
  const key = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
247
247
  const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
248
- if (detail != null) {
249
- draft.transactionDetailById[key] = {
250
- ...detail,
251
- transactionDetailLocalData: action.payload.transactionLocalData,
252
- };
248
+ if (detail == null) {
249
+ return;
253
250
  }
251
+ const incoming = action.payload.transactionLocalData;
252
+ const prevById = detail.transactionDetailLocalData.lineItemById;
253
+ // Per-line `categoryClassRecommendationsFetchState` is owned by the
254
+ // recommendation epic/reducers (markInProgress / markCompleted /
255
+ // markFailure / setEntityRecommendationForLineIdsForTransactionDetail).
256
+ // Callers that rebuild `transactionLocalData` from a UI snapshot will
257
+ // typically have an out-of-date copy of this field (e.g. payee-change
258
+ // captures the snapshot before the epic's start arm runs and would
259
+ // otherwise clobber In-Progress back to undefined). Treat the field as
260
+ // sticky: only let the caller override it when they explicitly set it.
261
+ const mergedLineItemById = {};
262
+ Object.entries(incoming.lineItemById ?? {}).forEach(([lineId, line]) => {
263
+ mergedLineItemById[lineId] = {
264
+ ...line,
265
+ categoryClassRecommendationsFetchState: line.categoryClassRecommendationsFetchState ??
266
+ prevById?.[lineId]?.categoryClassRecommendationsFetchState,
267
+ };
268
+ });
269
+ draft.transactionDetailById[key] = {
270
+ ...detail,
271
+ transactionDetailLocalData: {
272
+ ...incoming,
273
+ lineItemById: mergedLineItemById,
274
+ },
275
+ };
254
276
  },
255
277
  saveTransactionDetail(draft, action) {
256
278
  const key = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
@@ -372,6 +394,21 @@ const transactionDetail = (0, toolkit_1.createSlice)({
372
394
  const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
373
395
  if (detail != null) {
374
396
  const newLocalData = (0, transactionDetailLocalDataHelper_1.setEntityRecommendationForLineIdInLocalData)(transaction, detail.transactionDetailLocalData, action.payload.entity, lineIds, uncategorizedIncomeExpense, recommendationWithCOTByLineId);
397
+ // Release the per-line fetch flag for every line this fetch
398
+ // covered so the inline skeleton resolves and the page-level
399
+ // Save button can re-enable.
400
+ lineIds.forEach((lineId) => {
401
+ const lineItem = newLocalData.lineItemById[lineId];
402
+ if (lineItem != null) {
403
+ newLocalData.lineItemById[lineId] = {
404
+ ...lineItem,
405
+ categoryClassRecommendationsFetchState: {
406
+ fetchState: 'Completed',
407
+ error: undefined,
408
+ },
409
+ };
410
+ }
411
+ });
375
412
  draft.transactionDetailById[key] = {
376
413
  ...detail,
377
414
  transactionDetailLocalData: newLocalData,
@@ -392,6 +429,84 @@ const transactionDetail = (0, toolkit_1.createSlice)({
392
429
  };
393
430
  },
394
431
  },
432
+ // Start arm of the line-update recommendations fetch for the detail
433
+ // page. Flips covered lines to In-Progress; detail page has no
434
+ // checkbox, so no auto-uncheck side effect.
435
+ markCategoryClassRecommendationsInProgressForTransactionDetail: {
436
+ reducer(draft, action) {
437
+ const { transactionId, lineIds } = action.payload;
438
+ const key = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
439
+ const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
440
+ if (detail != null) {
441
+ lineIds.forEach((lineId) => {
442
+ const lineItem = detail.transactionDetailLocalData.lineItemById[lineId];
443
+ if (lineItem != null) {
444
+ detail.transactionDetailLocalData.lineItemById[lineId] = {
445
+ ...lineItem,
446
+ categoryClassRecommendationsFetchState: {
447
+ fetchState: 'In-Progress',
448
+ error: undefined,
449
+ },
450
+ };
451
+ }
452
+ });
453
+ }
454
+ },
455
+ prepare(transactionId, lineIds) {
456
+ return { payload: { transactionId, lineIds } };
457
+ },
458
+ },
459
+ // Completed arm. Used when the HTTP call succeeded but the server
460
+ // returned no per-line recommendations — still need to release the
461
+ // In-Progress flag.
462
+ markCategoryClassRecommendationsCompletedForTransactionDetail: {
463
+ reducer(draft, action) {
464
+ const { transactionId, lineIds } = action.payload;
465
+ const key = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
466
+ const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
467
+ if (detail != null) {
468
+ lineIds.forEach((lineId) => {
469
+ const lineItem = detail.transactionDetailLocalData.lineItemById[lineId];
470
+ if (lineItem != null) {
471
+ detail.transactionDetailLocalData.lineItemById[lineId] = {
472
+ ...lineItem,
473
+ categoryClassRecommendationsFetchState: {
474
+ fetchState: 'Completed',
475
+ error: undefined,
476
+ },
477
+ };
478
+ }
479
+ });
480
+ }
481
+ },
482
+ prepare(transactionId, lineIds) {
483
+ return { payload: { transactionId, lineIds } };
484
+ },
485
+ },
486
+ markCategoryClassRecommendationsFailureForTransactionDetail: {
487
+ reducer(draft, action) {
488
+ const { transactionId, lineIds, error } = action.payload;
489
+ const key = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
490
+ const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
491
+ if (detail != null) {
492
+ lineIds.forEach((lineId) => {
493
+ const lineItem = detail.transactionDetailLocalData.lineItemById[lineId];
494
+ if (lineItem != null) {
495
+ detail.transactionDetailLocalData.lineItemById[lineId] = {
496
+ ...lineItem,
497
+ categoryClassRecommendationsFetchState: {
498
+ fetchState: 'Error',
499
+ error,
500
+ },
501
+ };
502
+ }
503
+ });
504
+ }
505
+ },
506
+ prepare(transactionId, lineIds, error) {
507
+ return { payload: { transactionId, lineIds, error } };
508
+ },
509
+ },
395
510
  removeEntityRecommendationForLineIdForTransactionDetail: {
396
511
  reducer(draft, action) {
397
512
  const { transaction, lineId } = action.payload;
@@ -663,7 +778,7 @@ const transactionDetail = (0, toolkit_1.createSlice)({
663
778
  },
664
779
  },
665
780
  });
666
- _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;
781
+ _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.markCategoryClassRecommendationsInProgressForTransactionDetail = _a.markCategoryClassRecommendationsInProgressForTransactionDetail, exports.markCategoryClassRecommendationsCompletedForTransactionDetail = _a.markCategoryClassRecommendationsCompletedForTransactionDetail, exports.markCategoryClassRecommendationsFailureForTransactionDetail = _a.markCategoryClassRecommendationsFailureForTransactionDetail, 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;
667
782
  exports.default = transactionDetail.reducer;
668
783
  function getUpdatedEntityLocalData(detail, updates, entity, resetRecommendations, type) {
669
784
  const key = type === 'customer' ? 'customerUpdates' : 'vendorUpdates';
@@ -18,6 +18,7 @@ export interface TransactionDetailReport extends SelectorView {
18
18
  classHierarchyList: NestedClassHierarchyForReport[];
19
19
  classList: ClassListSelectorView;
20
20
  deleteStatusByAttachmentName: Record<string, FetchStateAndError>;
21
+ hasInFlightCategoryClassRecommendations: boolean;
21
22
  isAccountingClassesEnabled: boolean;
22
23
  isAccountingProjectsEnabled: boolean;
23
24
  linkedTransactions: SupportedTransactionWithCOT[];
@@ -30,6 +31,7 @@ export interface TransactionDetailReport extends SelectorView {
30
31
  export interface VendorDetailsView extends SelectorView {
31
32
  vendors: Vendor[];
32
33
  }
34
+ export declare const getDetailInFlightRecommendations: (state: RootState, transactionId: TransactionID) => boolean;
33
35
  export declare const getTransactionDetail: (state: RootState, transactionId: TransactionID, fetchLinkedTransactions?: boolean) => TransactionDetailReport;
34
36
  export declare function getTransactionDetailForTransaction(rootState: RootState, transactionId: TransactionID): TransactionDetailReport | undefined;
35
37
  export declare const getInitialUpdatablePeriodsForTransactionRecommendations: (companyIncorporationDate?: ZeniDate, bookCloseDate?: ZeniDate) => {
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getInitialUpdatablePeriodsForTransactionRecommendations = exports.getTransactionDetail = void 0;
6
+ exports.getInitialUpdatablePeriodsForTransactionRecommendations = exports.getTransactionDetail = exports.getDetailInFlightRecommendations = void 0;
7
7
  exports.getTransactionDetailForTransaction = getTransactionDetailForTransaction;
8
8
  const get_1 = __importDefault(require("lodash/get"));
9
9
  const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
@@ -17,6 +17,27 @@ const accountListSelector_1 = require("../accountList/accountListSelector");
17
17
  const classListSelector_1 = require("../classList/classListSelector");
18
18
  const projectListSelector_1 = require("../projectList/projectListSelector");
19
19
  const transactionDetailState_1 = require("./transactionDetailState");
20
+ // "Any line on this transaction is fetching category/class recommendations?"
21
+ // Inlined as a plain function because the upstream selector
22
+ // `getTransactionDetail` is also un-memoized and the iteration is O(lines)
23
+ // — typically <10. Exported standalone so consumers that only need the
24
+ // flag (e.g. footer save-disable) can avoid materializing the whole
25
+ // detail report.
26
+ const getDetailInFlightRecommendations = (state, transactionId) => {
27
+ const detailKey = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
28
+ const detail = (0, get_1.default)(state.transactionDetailState.transactionDetailById, detailKey, undefined);
29
+ if (detail == null) {
30
+ return false;
31
+ }
32
+ for (const lineItem of Object.values(detail.transactionDetailLocalData.lineItemById)) {
33
+ if (lineItem.categoryClassRecommendationsFetchState?.fetchState ===
34
+ 'In-Progress') {
35
+ return true;
36
+ }
37
+ }
38
+ return false;
39
+ };
40
+ exports.getDetailInFlightRecommendations = getDetailInFlightRecommendations;
20
41
  const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = true) => {
21
42
  const { transactionDetailState, transactionState, vendorState, vendorListState, accountState, classState, classListState, accountListState, projectState, projectListState, } = state;
22
43
  const detailKey = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
@@ -63,7 +84,13 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
63
84
  const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state);
64
85
  const classList = isAccountingClassesEnabled
65
86
  ? (0, classListSelector_1.getClassList)(classState, classListState)
66
- : { classes: [], nestedClassHierarchy: [], fetchState: 'Completed', error: undefined, version: 0 };
87
+ : {
88
+ classes: [],
89
+ nestedClassHierarchy: [],
90
+ fetchState: 'Completed',
91
+ error: undefined,
92
+ version: 0,
93
+ };
67
94
  const isAccountingProjectsEnabled = (0, tenantSelector_1.getIsAccountingProjectsEnabled)(state);
68
95
  const projectList = isAccountingProjectsEnabled
69
96
  ? (0, projectListSelector_1.getProjectList)(projectState, projectListState)
@@ -79,6 +106,7 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
79
106
  : [];
80
107
  const transactionDetailAnyUpdateStatus = reduceUpdateFetchStates(transactionDetail);
81
108
  const vendors = (0, vendorSelector_1.getVendorsByVendorIds)(vendorState, vendorListState.vendorIds);
109
+ const hasInFlightCategoryClassRecommendations = (0, exports.getDetailInFlightRecommendations)(state, transactionId);
82
110
  return {
83
111
  reportId: 'transaction_detail',
84
112
  reportTitle: 'Transaction Detail',
@@ -94,6 +122,7 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
94
122
  classHierarchyList,
95
123
  accountsHierarchyList,
96
124
  classList: classList,
125
+ hasInFlightCategoryClassRecommendations,
97
126
  isAccountingClassesEnabled,
98
127
  isAccountingProjectsEnabled,
99
128
  projectList,
@@ -14,6 +14,7 @@ export interface TransactionDetailLineItemData extends TransactionLineBase {
14
14
  isClassMiscategorized: boolean;
15
15
  account?: AccountBase;
16
16
  billable?: BillableStatus;
17
+ categoryClassRecommendationsFetchState?: FetchStateAndError;
17
18
  class?: ClassBase;
18
19
  customer?: CustomerBase;
19
20
  isCategoryUpdateSelected?: boolean;
@@ -1,5 +1,5 @@
1
- import { RootState } from '../../reducer';
2
1
  import { FetchState } from '../../commonStateTypes/common';
2
+ import { RootState } from '../../reducer';
3
3
  export declare const getZeniOAuthApproveFetchState: (state: RootState) => FetchState;
4
4
  export declare const getZeniOAuthApproveRedirectUrl: (state: RootState) => string | undefined;
5
5
  export declare const getZeniOAuthApproveError: (state: RootState) => string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.80",
3
+ "version": "5.0.81-beta0ND",
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",
@@ -106,12 +106,18 @@
106
106
  "scripts": {
107
107
  "clean": "rimraf lib",
108
108
  "test:typecheck": "echo 'Typechecking test files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.typecheck.json",
109
- "test": "pnpm test:typecheck && vitest run --typecheck",
110
- "lint": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
109
+ "test:typecheck-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh master tsconfig.typecheck.json",
110
+ "test": "pnpm lint-modified-files && pnpm test:typecheck-modified-files && vitest run --typecheck",
111
+ "test:full": "vitest run --typecheck",
112
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0 --fix",
113
+ "lint-modified-files": "chmod +x ./scripts/lint-modified-files.sh && ./scripts/lint-modified-files.sh",
114
+ "lint:fix-modified-files": "chmod +x ./scripts/lint-modified-files.sh && LINT_FIX=true ./scripts/lint-modified-files.sh",
115
+ "tsc-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh",
116
+ "typecheck": "tsc --noEmit",
111
117
  "find-dead-code": "ts-prune | grep -v '(used in module)'",
112
118
  "find-unused-exports": "ts-unused-exports ./tsconfig.json",
113
119
  "circular-dependency": "npx madge --circular --extensions ts ./src",
114
- "build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\" \"echo 'Running tests and typecheck...' && pnpm test\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
120
+ "build": "concurrently --kill-others-on-fail --handle-input \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\" \"echo 'Running tests and typecheck (incl. lint-modified-files)...' && pnpm test\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
115
121
  "only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
116
122
  "only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
117
123
  "format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
@@ -1,13 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
- import { fetchCreditAgentAccess, fetchCreditAgentAccessFailure, fetchCreditAgentAccessSuccess, } from '../creditAgentViewReducer';
5
- export const fetchCreditAgentAccessEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCreditAgentAccess.match), switchMap(() => {
6
- const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cockpit/cards-cockpit-access`;
7
- return zeniAPI.getJSON(url).pipe(switchMap((response) => {
8
- if (isSuccessResponse(response) && response.data != null) {
9
- return of(fetchCreditAgentAccessSuccess(response.data.is_allowed === true));
10
- }
11
- return of(fetchCreditAgentAccessFailure(response.status));
12
- }), catchError((error) => of(fetchCreditAgentAccessFailure(createZeniAPIStatus('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
13
- }));