@zeniai/client-epic-state 5.0.67 → 5.0.69-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 (150) hide show
  1. package/lib/commonStateTypes/cacheOverrideFetchReducer.d.ts +17 -0
  2. package/lib/commonStateTypes/cacheOverrideFetchReducer.js +20 -0
  3. package/lib/commonStateTypes/pusherActions.d.ts +11 -0
  4. package/lib/commonStateTypes/pusherActions.js +6 -0
  5. package/lib/coreEpics.js +1 -1
  6. package/lib/entity/account/accountSelector.d.ts +1 -1
  7. package/lib/entity/account/accountState.d.ts +1 -1
  8. package/lib/entity/account/subAccountSelector.d.ts +1 -1
  9. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -3
  10. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +1 -2
  11. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +1 -1
  12. package/lib/entity/chargeCard/chargeCardReducer.d.ts +19 -2
  13. package/lib/entity/chargeCard/chargeCardReducer.js +35 -2
  14. package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +14 -1
  15. package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +36 -2
  16. package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +1 -1
  17. package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
  18. package/lib/entity/tenant/SessionManager.js +6 -3
  19. package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
  20. package/lib/entity/tenant/clearAllEpic.js +2 -2
  21. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +6 -2
  22. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +6 -2
  23. package/lib/entity/tenant/tenantReducer.js +6 -1
  24. package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +3 -1
  25. package/lib/epic.d.ts +12 -10
  26. package/lib/epic.js +13 -11
  27. package/lib/esm/commonStateTypes/cacheOverrideFetchReducer.js +16 -0
  28. package/lib/esm/commonStateTypes/pusherActions.js +3 -0
  29. package/lib/esm/coreEpics.js +1 -1
  30. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -3
  31. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +1 -2
  32. package/lib/esm/entity/chargeCard/chargeCardReducer.js +34 -1
  33. package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +35 -1
  34. package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
  35. package/lib/esm/entity/tenant/SessionManager.js +4 -1
  36. package/lib/esm/entity/tenant/clearAllEpic.js +2 -2
  37. package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +6 -2
  38. package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +6 -2
  39. package/lib/esm/entity/tenant/tenantReducer.js +6 -1
  40. package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +3 -1
  41. package/lib/esm/epic.js +13 -11
  42. package/lib/esm/index.js +23 -17
  43. package/lib/esm/reducer.js +2 -2
  44. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +2 -5
  45. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +2 -5
  46. package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +4 -1
  47. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
  48. package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -1
  49. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
  50. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -1
  51. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +8 -6
  52. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -1
  53. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +11 -1
  54. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
  55. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +127 -1
  56. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +20 -1
  57. package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +17 -0
  58. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -2
  59. package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -1
  60. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +61 -50
  61. package/lib/esm/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
  62. package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
  63. package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
  64. package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
  65. package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
  66. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +26 -9
  67. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
  68. package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
  69. package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
  70. package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
  71. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +49 -0
  72. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +58 -0
  73. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +12 -0
  74. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +205 -0
  75. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +71 -52
  76. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
  77. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +28 -0
  78. package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +1 -1
  79. package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +1 -1
  80. package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +1 -1
  81. package/lib/esm/view/transactionDetail/transactionDetailSelector.js +7 -1
  82. package/lib/index.d.ts +26 -19
  83. package/lib/index.js +83 -58
  84. package/lib/reducer.d.ts +2 -2
  85. package/lib/reducer.js +2 -2
  86. package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +2 -2
  87. package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +1 -1
  88. package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +2 -5
  89. package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +2 -5
  90. package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +4 -1
  91. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +1 -1
  92. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
  93. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
  94. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -1
  95. package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +8 -6
  96. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -1
  97. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
  98. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +10 -0
  99. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  100. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +21 -0
  101. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +2 -1
  102. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
  103. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +9 -3
  104. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +128 -2
  105. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -1
  106. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +14 -0
  107. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +20 -1
  108. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +10 -0
  109. package/lib/view/expenseAutomationView/types/completedSubTab.js +21 -0
  110. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -2
  111. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -4
  112. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +41 -2
  113. package/lib/view/financeStatement/financeStatementSelector.js +1 -1
  114. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +25 -2
  115. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +62 -51
  116. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +10 -0
  117. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +1 -1
  118. package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.d.ts +3 -1
  119. package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
  120. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.d.ts +3 -1
  121. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
  122. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
  123. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
  124. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
  125. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +18 -3
  126. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +27 -10
  127. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
  128. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +3 -1
  129. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
  130. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
  131. package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.d.ts +3 -1
  132. package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
  133. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +8 -0
  134. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +53 -0
  135. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +8 -0
  136. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +62 -0
  137. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +27 -0
  138. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +15 -0
  139. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +24 -0
  140. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +213 -0
  141. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +24 -2
  142. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +72 -53
  143. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +4 -0
  144. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
  145. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +12 -0
  146. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +125 -0
  147. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +32 -0
  148. package/lib/view/transactionDetail/transactionDetailSelector.js +7 -1
  149. package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +1 -1
  150. package/package.json +9 -4
@@ -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;
@@ -63,7 +63,13 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
63
63
  const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state);
64
64
  const classList = isAccountingClassesEnabled
65
65
  ? (0, classListSelector_1.getClassList)(classState, classListState)
66
- : { classes: [], nestedClassHierarchy: [], fetchState: 'Completed', error: undefined, version: 0 };
66
+ : {
67
+ classes: [],
68
+ nestedClassHierarchy: [],
69
+ fetchState: 'Completed',
70
+ error: undefined,
71
+ version: 0,
72
+ };
67
73
  const isAccountingProjectsEnabled = (0, tenantSelector_1.getIsAccountingProjectsEnabled)(state);
68
74
  const projectList = isAccountingProjectsEnabled
69
75
  ? (0, projectListSelector_1.getProjectList)(projectState, projectListState)
@@ -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.67",
3
+ "version": "5.0.69-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,17 @@
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
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0 --fix",
112
+ "lint-modified-files": "chmod +x ./scripts/lint-modified-files.sh && ./scripts/lint-modified-files.sh",
113
+ "lint:fix-modified-files": "chmod +x ./scripts/lint-modified-files.sh && LINT_FIX=true ./scripts/lint-modified-files.sh",
114
+ "tsc-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh",
115
+ "typecheck": "tsc --noEmit",
111
116
  "find-dead-code": "ts-prune | grep -v '(used in module)'",
112
117
  "find-unused-exports": "ts-unused-exports ./tsconfig.json",
113
118
  "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__\"",
119
+ "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
120
  "only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
116
121
  "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
122
  "format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",