@zeniai/client-epic-state 5.1.0 → 5.1.1-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 (106) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/commonStateTypes/animations.js +1 -0
  3. package/lib/entity/company/companyPayload.d.ts +4 -0
  4. package/lib/entity/company/companyPayload.js +4 -0
  5. package/lib/entity/company/companyStateTypes.d.ts +4 -0
  6. package/lib/entity/jeSchedules/jeSchedulesPayload.js +18 -6
  7. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +1 -0
  8. package/lib/entity/paymentAccount/paymentAccountSelector.js +9 -0
  9. package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
  10. package/lib/entity/tenant/clearAllEpic.js +2 -2
  11. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  12. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +21 -0
  13. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +54 -0
  14. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  15. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  16. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  17. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  18. package/lib/entity/tenant/tenantReducer.d.ts +38 -25
  19. package/lib/entity/tenant/tenantReducer.js +70 -10
  20. package/lib/entity/tenant/tenantState.d.ts +1 -0
  21. package/lib/entity/transaction/payloadTypes/transactionPayload.js +4 -2
  22. package/lib/epic.d.ts +8 -3
  23. package/lib/epic.js +9 -3
  24. package/lib/esm/commonStateTypes/animations.js +1 -0
  25. package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +1 -1
  26. package/lib/esm/entity/company/companyPayload.js +4 -0
  27. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +18 -6
  28. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +8 -0
  29. package/lib/esm/entity/tenant/clearAllEpic.js +2 -2
  30. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +50 -0
  31. package/lib/esm/entity/tenant/tenantReducer.js +68 -8
  32. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +4 -2
  33. package/lib/esm/epic.js +9 -3
  34. package/lib/esm/index.js +12 -9
  35. package/lib/esm/reducer.js +3 -3
  36. package/lib/esm/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.js +3 -3
  37. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -1
  38. package/lib/esm/view/fileView/epic/deleteFileEpic.js +2 -2
  39. package/lib/esm/view/fileView/epic/deleteFileListEpic.js +2 -2
  40. package/lib/esm/view/fileView/epic/updateFileNameEpic.js +2 -2
  41. package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +40 -0
  42. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +29 -0
  43. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +40 -0
  44. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +218 -50
  45. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +12 -2
  46. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +12 -0
  47. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +1 -1
  48. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +1 -1
  49. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +1 -3
  50. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +1 -2
  51. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +1 -1
  52. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +58 -0
  53. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +77 -0
  54. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +14 -0
  55. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +207 -0
  56. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +106 -52
  57. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
  58. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +41 -0
  59. package/lib/index.d.ts +15 -11
  60. package/lib/index.js +64 -44
  61. package/lib/reducer.d.ts +3 -3
  62. package/lib/reducer.js +3 -3
  63. package/lib/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.d.ts +1 -1
  64. package/lib/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.js +2 -2
  65. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -1
  66. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +1 -1
  67. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -1
  68. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -1
  69. package/lib/view/fileView/epic/deleteFileEpic.js +1 -1
  70. package/lib/view/fileView/epic/deleteFileListEpic.js +1 -1
  71. package/lib/view/fileView/epic/updateFileNameEpic.js +1 -1
  72. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +7 -0
  73. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +44 -0
  74. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.d.ts +8 -0
  75. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +33 -0
  76. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +9 -0
  77. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +44 -0
  78. package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +3 -0
  79. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +41 -4
  80. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +220 -51
  81. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +5 -1
  82. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +15 -2
  83. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +40 -0
  84. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +13 -1
  85. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +1 -1
  86. package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.d.ts +1 -1
  87. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +1 -1
  88. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +1 -3
  89. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.d.ts +1 -1
  90. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +1 -2
  91. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +28 -0
  92. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +62 -0
  93. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +9 -0
  94. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +81 -0
  95. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +24 -0
  96. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +17 -0
  97. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +29 -0
  98. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +215 -0
  99. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +28 -2
  100. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +107 -53
  101. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +7 -2
  102. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
  103. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +19 -0
  104. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +154 -0
  105. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +46 -0
  106. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../../../../reducer';
3
+ import { ZeniAPI } from '../../../../../zeniAPI';
4
+ import { newAddressInLocalStore } from '../../../../addressView/addressViewReducer';
5
+ import { applyKycDocumentAutofillForOnboarding } from '../../../../onboardingView/customerView/onboardingCustomerViewReducer';
6
+ import { parseUploadedKycDocument, parseUploadedKycDocumentFailure } from '../../kycKybAutofillActions';
7
+ import { applyKycDocumentAutofillForSetup } from '../../setupViewReducer';
8
+ export type ActionType = ReturnType<typeof parseUploadedKycDocument | typeof parseUploadedKycDocumentFailure | typeof applyKycDocumentAutofillForSetup | typeof applyKycDocumentAutofillForOnboarding | typeof newAddressInLocalStore>;
9
+ export declare const parseUploadedKycDocumentEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseUploadedKycDocumentEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../../responsePayload");
7
+ const addressViewReducer_1 = require("../../../../addressView/addressViewReducer");
8
+ const onboardingCustomerViewReducer_1 = require("../../../../onboardingView/customerView/onboardingCustomerViewReducer");
9
+ const kycKybAutofillActions_1 = require("../../kycKybAutofillActions");
10
+ const kycKybParseMapper_1 = require("../../kycKybParseMapper");
11
+ const setupViewReducer_1 = require("../../setupViewReducer");
12
+ const PROCESS_DOCUMENT_SYNC_PATH = '/1.0/documents/process/sync';
13
+ const parseUploadedKycDocumentEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(kycKybAutofillActions_1.parseUploadedKycDocument.match), (0, operators_1.mergeMap)((action) => {
14
+ const { target, companyId, officerType, fileId, documentType } = action.payload;
15
+ const url = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}${PROCESS_DOCUMENT_SYNC_PATH}`;
16
+ const requestPayload = {
17
+ provided_document_type: documentType,
18
+ files: [{ file_id: fileId }],
19
+ processing_priority: 10,
20
+ metadata: { source: 'kyc_kyb_autofill' },
21
+ };
22
+ const failureAction = (0, kycKybAutofillActions_1.parseUploadedKycDocumentFailure)({ target, fileId });
23
+ return zeniAPI
24
+ .postAndGetJSON(url, requestPayload)
25
+ .pipe((0, operators_1.mergeMap)((response) => {
26
+ if (!(0, responsePayload_1.isSuccessResponse)(response) || response.data == null) {
27
+ return (0, rxjs_1.of)(failureAction);
28
+ }
29
+ // Sync API returns a batch envelope: `data.files[0].extracted_data`
30
+ // is the parser payload; `data` itself is the request-level wrapper
31
+ // ({request_id, status, files, metadata, ...}). Drill in before
32
+ // dispatching to the mapper.
33
+ const extracted = response.data.files?.[0]?.extracted_data;
34
+ if (extracted == null) {
35
+ return (0, rxjs_1.of)(failureAction);
36
+ }
37
+ let result;
38
+ switch (documentType) {
39
+ case 'passport':
40
+ result = (0, kycKybParseMapper_1.mapPassportToOfficer)(extracted);
41
+ break;
42
+ case 'driving_license':
43
+ result = (0, kycKybParseMapper_1.mapDrivingLicenseToOfficer)(extracted);
44
+ break;
45
+ case 'social_security_card':
46
+ result = (0, kycKybParseMapper_1.mapSsnCardToOfficer)(extracted);
47
+ break;
48
+ }
49
+ if (result.autoFilledFieldNames.length === 0) {
50
+ return (0, rxjs_1.of)(failureAction);
51
+ }
52
+ const applyAction = target === 'setup'
53
+ ? (0, setupViewReducer_1.applyKycDocumentAutofillForSetup)({
54
+ companyId,
55
+ officerType,
56
+ fileId,
57
+ values: result.values,
58
+ autoFilledFieldNames: result.autoFilledFieldNames,
59
+ })
60
+ : (0, onboardingCustomerViewReducer_1.applyKycDocumentAutofillForOnboarding)({
61
+ companyId,
62
+ officerType,
63
+ fileId,
64
+ values: result.values,
65
+ autoFilledFieldNames: result.autoFilledFieldNames,
66
+ });
67
+ const actions = [applyAction];
68
+ // Driving licenses also carry the home address, which lives in the
69
+ // addressView slice (keyed `officer_<n>_address`). Seed it so the
70
+ // section's address field + ✦ badge pick it up.
71
+ if (result.address != null) {
72
+ const addressType = `${officerType.toLowerCase()}_address`;
73
+ actions.push((0, addressViewReducer_1.newAddressInLocalStore)({
74
+ addressType,
75
+ addressToCreate: result.address,
76
+ }));
77
+ }
78
+ return (0, rxjs_1.from)(actions);
79
+ }), (0, operators_1.catchError)(() => (0, rxjs_1.of)(failureAction)));
80
+ }));
81
+ exports.parseUploadedKycDocumentEpic = parseUploadedKycDocumentEpic;
@@ -0,0 +1,24 @@
1
+ import { ID } from '../../../commonStateTypes/common';
2
+ import { CompanyOfficerType } from '../../companyView/types/companyPassport/companyUsersLocalData';
3
+ import { KybProvidedDocumentType, KycKybAutofillTarget, KycProvidedDocumentType } from './types/kycKybAutofill';
4
+ export interface ParseUploadedKycDocumentPayload {
5
+ companyId: ID;
6
+ documentType: KycProvidedDocumentType;
7
+ fileId: ID;
8
+ officerType: CompanyOfficerType;
9
+ target: KycKybAutofillTarget;
10
+ }
11
+ export interface ParseUploadedKybDocumentPayload {
12
+ companyId: ID;
13
+ documentType: KybProvidedDocumentType;
14
+ fileId: ID;
15
+ target: KycKybAutofillTarget;
16
+ }
17
+ export declare const parseUploadedKycDocument: import("@reduxjs/toolkit").ActionCreatorWithPayload<ParseUploadedKycDocumentPayload, string>;
18
+ export declare const parseUploadedKybDocument: import("@reduxjs/toolkit").ActionCreatorWithPayload<ParseUploadedKybDocumentPayload, string>;
19
+ export interface ParseUploadedDocumentFailurePayload {
20
+ fileId: ID;
21
+ target: KycKybAutofillTarget;
22
+ }
23
+ export declare const parseUploadedKycDocumentFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ParseUploadedDocumentFailurePayload, string>;
24
+ export declare const parseUploadedKybDocumentFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ParseUploadedDocumentFailurePayload, string>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseUploadedKybDocumentFailure = exports.parseUploadedKycDocumentFailure = exports.parseUploadedKybDocument = exports.parseUploadedKycDocument = void 0;
4
+ /**
5
+ * Trigger actions for the KYC / KYB autofill epics.
6
+ *
7
+ * These actions don't mutate state — the epic listens for them, calls
8
+ * document-communication-agent's sync endpoint, and dispatches the appropriate
9
+ * `applyKyc/KybDocumentAutofillFor{Setup,Onboarding}` against the matching
10
+ * slice. Co-located with the rest of the commonSetup module because the entire
11
+ * autofill flow is auxiliary to the setup view; there is no separate state.
12
+ */
13
+ const toolkit_1 = require("@reduxjs/toolkit");
14
+ exports.parseUploadedKycDocument = (0, toolkit_1.createAction)('commonSetup/parseUploadedKycDocument');
15
+ exports.parseUploadedKybDocument = (0, toolkit_1.createAction)('commonSetup/parseUploadedKybDocument');
16
+ exports.parseUploadedKycDocumentFailure = (0, toolkit_1.createAction)('commonSetup/parseUploadedKycDocumentFailure');
17
+ exports.parseUploadedKybDocumentFailure = (0, toolkit_1.createAction)('commonSetup/parseUploadedKybDocumentFailure');
@@ -0,0 +1,29 @@
1
+ import { AddressUpdatableInfo } from '../../addressView/addressViewState';
2
+ import { CompanyDetailsLocalData, CompanyOfficerLocalData } from './setupViewState';
3
+ import { ExtendCertificateOfIncorporationParsed, ExtendDrivingLicenseParsed, ExtendPassportParsed, ExtendSsnCardParsed, ExtendTaxEinParsed } from './types/kycKybAutofill';
4
+ export interface AutofillResult<TLocalData> {
5
+ autoFilledFieldNames: (keyof TLocalData & string)[];
6
+ values: Partial<TLocalData>;
7
+ }
8
+ /**
9
+ * Officer mappers may additionally produce an address (driving license only).
10
+ * The officer's address lives in the `addressView` slice — not in
11
+ * `CompanyOfficerLocalData` — so it is returned separately and the consuming
12
+ * epic dispatches `newAddressInLocalStore` for it. The synthetic field name
13
+ * `'officerAddress'` is appended to `autoFilledFieldNames` so the form section
14
+ * shows the ✦ badge next to the address field.
15
+ */
16
+ export interface OfficerAutofillResult extends AutofillResult<CompanyOfficerLocalData> {
17
+ address?: AddressUpdatableInfo;
18
+ }
19
+ export declare const OFFICER_ADDRESS_AUTOFILL_FIELD = "officerAddress";
20
+ /** Passport → Company Officer. */
21
+ export declare const mapPassportToOfficer: (parsed: ExtendPassportParsed) => AutofillResult<CompanyOfficerLocalData>;
22
+ /** Driving License → Company Officer (name, DOB, and home address). */
23
+ export declare const mapDrivingLicenseToOfficer: (parsed: ExtendDrivingLicenseParsed) => OfficerAutofillResult;
24
+ /** SSN Card → Company Officer (name only — SSN value not yet returned by parser). */
25
+ export declare const mapSsnCardToOfficer: (parsed: ExtendSsnCardParsed) => AutofillResult<CompanyOfficerLocalData>;
26
+ /** Certificate of Incorporation → Company Details. */
27
+ export declare const mapCoiToCompanyDetails: (parsed: ExtendCertificateOfIncorporationParsed) => AutofillResult<CompanyDetailsLocalData>;
28
+ /** Tax EIN letter → Company Details. */
29
+ export declare const mapTaxEinToCompanyDetails: (parsed: ExtendTaxEinParsed) => AutofillResult<CompanyDetailsLocalData>;
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapTaxEinToCompanyDetails = exports.mapCoiToCompanyDetails = exports.mapSsnCardToOfficer = exports.mapDrivingLicenseToOfficer = exports.mapPassportToOfficer = exports.OFFICER_ADDRESS_AUTOFILL_FIELD = void 0;
4
+ /**
5
+ * Pure mappers from ExtendAI parser payloads to our form-side local-data shapes.
6
+ *
7
+ * Each mapper filters out fields below KYC_KYB_AUTOFILL_MIN_CONFIDENCE and returns
8
+ * both the merged values and the list of field names that were autofilled so the
9
+ * UI can show the ✦ AI badge next to each.
10
+ */
11
+ const zeniDayJS_1 = require("../../../zeniDayJS");
12
+ const zeniUrl_1 = require("../../../zeniUrl");
13
+ const kycKybAutofill_1 = require("./types/kycKybAutofill");
14
+ exports.OFFICER_ADDRESS_AUTOFILL_FIELD = 'officerAddress';
15
+ // US driving licenses carry a US state in `address_state` but no country field;
16
+ // default the composed address to the US.
17
+ const DRIVING_LICENSE_DEFAULT_COUNTRY = 'United States';
18
+ const DRIVING_LICENSE_DEFAULT_COUNTRY_CODE = 'US';
19
+ const emptyResult = () => ({
20
+ values: {},
21
+ autoFilledFieldNames: [],
22
+ });
23
+ const isConfident = (field) => {
24
+ if (field == null) {
25
+ return false;
26
+ }
27
+ if (field.value == null) {
28
+ return false;
29
+ }
30
+ return field.confidence >= kycKybAutofill_1.KYC_KYB_AUTOFILL_MIN_CONFIDENCE;
31
+ };
32
+ const assignAutofilledValue = (result, key, value) => {
33
+ if (value == null) {
34
+ return;
35
+ }
36
+ if (typeof value === 'string' && value.trim() === '') {
37
+ return;
38
+ }
39
+ result.values[key] = value;
40
+ result.autoFilledFieldNames.push(key);
41
+ };
42
+ const tryParseDate = (rawDate) => {
43
+ const parsedDate = (0, zeniDayJS_1.date)(rawDate);
44
+ if (parsedDate.isValid()) {
45
+ return parsedDate;
46
+ }
47
+ return undefined;
48
+ };
49
+ const splitFullName = (fullName) => {
50
+ const parts = fullName.trim().split(/\s+/);
51
+ if (parts.length === 1) {
52
+ return { firstName: parts[0], lastName: '' };
53
+ }
54
+ const lastName = parts[parts.length - 1];
55
+ const firstName = parts.slice(0, -1).join(' ');
56
+ return { firstName, lastName };
57
+ };
58
+ /** Passport → Company Officer. */
59
+ const mapPassportToOfficer = (parsed) => {
60
+ const result = emptyResult();
61
+ if (isConfident(parsed.first_name)) {
62
+ assignAutofilledValue(result, 'firstName', parsed.first_name.value);
63
+ }
64
+ if (isConfident(parsed.last_name)) {
65
+ assignAutofilledValue(result, 'lastName', parsed.last_name.value);
66
+ }
67
+ if (isConfident(parsed.date_of_birth)) {
68
+ const parsedDate = tryParseDate(parsed.date_of_birth.value);
69
+ if (parsedDate != null) {
70
+ assignAutofilledValue(result, 'birthday', parsedDate);
71
+ }
72
+ }
73
+ // The raw nationality string (e.g. "USA", "UNITED STATES OF AMERICA") is
74
+ // passed through unresolved; the consuming form section normalizes it to an
75
+ // ISO-2 code via the `countries-list` dataset before `setValue`. The form
76
+ // value (not this localData seed) is what gets submitted.
77
+ if (isConfident(parsed.nationality)) {
78
+ assignAutofilledValue(result, 'nationalityCountryCode', parsed.nationality.value);
79
+ }
80
+ return result;
81
+ };
82
+ exports.mapPassportToOfficer = mapPassportToOfficer;
83
+ /** Driving License → Company Officer (name, DOB, and home address). */
84
+ const mapDrivingLicenseToOfficer = (parsed) => {
85
+ const result = emptyResult();
86
+ if (isConfident(parsed.first_name)) {
87
+ assignAutofilledValue(result, 'firstName', parsed.first_name.value);
88
+ }
89
+ if (isConfident(parsed.last_name)) {
90
+ assignAutofilledValue(result, 'lastName', parsed.last_name.value);
91
+ }
92
+ if (isConfident(parsed.date_of_birth)) {
93
+ const parsedDate = tryParseDate(parsed.date_of_birth.value);
94
+ if (parsedDate != null) {
95
+ assignAutofilledValue(result, 'birthday', parsedDate);
96
+ }
97
+ }
98
+ // The officer address lives in the addressView slice rather than
99
+ // CompanyOfficerLocalData, so it's returned separately for the epic to
100
+ // dispatch via newAddressInLocalStore.
101
+ const street = isConfident(parsed.address_street)
102
+ ? parsed.address_street.value.trim()
103
+ : undefined;
104
+ const city = isConfident(parsed.address_city)
105
+ ? parsed.address_city.value.trim()
106
+ : undefined;
107
+ const state = isConfident(parsed.address_state)
108
+ ? parsed.address_state.value.trim()
109
+ : undefined;
110
+ const postalCode = isConfident(parsed.address_zip)
111
+ ? parsed.address_zip.value.trim()
112
+ : undefined;
113
+ if (street != null || city != null || state != null || postalCode != null) {
114
+ result.address = {
115
+ street: street != null ? [street] : [],
116
+ city: city ?? '',
117
+ state: state ?? '',
118
+ postalCode: postalCode ?? '',
119
+ country: DRIVING_LICENSE_DEFAULT_COUNTRY,
120
+ countryCode: DRIVING_LICENSE_DEFAULT_COUNTRY_CODE,
121
+ };
122
+ result.autoFilledFieldNames.push(exports.OFFICER_ADDRESS_AUTOFILL_FIELD);
123
+ }
124
+ return result;
125
+ };
126
+ exports.mapDrivingLicenseToOfficer = mapDrivingLicenseToOfficer;
127
+ /** SSN Card → Company Officer (name only — SSN value not yet returned by parser). */
128
+ const mapSsnCardToOfficer = (parsed) => {
129
+ const result = emptyResult();
130
+ if (isConfident(parsed.full_name)) {
131
+ const { firstName, lastName } = splitFullName(parsed.full_name.value);
132
+ if (firstName !== '') {
133
+ assignAutofilledValue(result, 'firstName', firstName);
134
+ }
135
+ if (lastName !== '') {
136
+ assignAutofilledValue(result, 'lastName', lastName);
137
+ }
138
+ }
139
+ return result;
140
+ };
141
+ exports.mapSsnCardToOfficer = mapSsnCardToOfficer;
142
+ /** Certificate of Incorporation → Company Details. */
143
+ const mapCoiToCompanyDetails = (parsed) => {
144
+ const result = emptyResult();
145
+ if (isConfident(parsed.company_legal_name)) {
146
+ assignAutofilledValue(result, 'companyLegalName', parsed.company_legal_name.value);
147
+ }
148
+ if (isConfident(parsed.ein)) {
149
+ assignAutofilledValue(result, 'taxIdOrEIN', parsed.ein.value);
150
+ }
151
+ if (isConfident(parsed.phone_number)) {
152
+ assignAutofilledValue(result, 'phone', parsed.phone_number.value);
153
+ }
154
+ if (isConfident(parsed.product_description)) {
155
+ assignAutofilledValue(result, 'companyDescription', parsed.product_description.value);
156
+ }
157
+ if (isConfident(parsed.website)) {
158
+ try {
159
+ assignAutofilledValue(result, 'website', (0, zeniUrl_1.toZeniUrl)(parsed.website.value));
160
+ }
161
+ catch {
162
+ // ignore — malformed URL string from OCR
163
+ }
164
+ }
165
+ if (isConfident(parsed.industry)) {
166
+ assignAutofilledValue(result, 'companyIndustryType', parsed.industry.value);
167
+ }
168
+ if (isConfident(parsed.sub_industry)) {
169
+ assignAutofilledValue(result, 'companySubIndustry', parsed.sub_industry.value);
170
+ }
171
+ if (isConfident(parsed.type_of_incorporation)) {
172
+ assignAutofilledValue(result, 'typeOfIncorporation', parsed.type_of_incorporation.value);
173
+ }
174
+ if (isConfident(parsed.date_of_incorporation)) {
175
+ const parsedDate = tryParseDate(parsed.date_of_incorporation.value);
176
+ if (parsedDate != null) {
177
+ assignAutofilledValue(result, 'incDate', parsedDate);
178
+ }
179
+ }
180
+ if (isConfident(parsed.state_of_incorporation)) {
181
+ assignAutofilledValue(result, 'stateOfIncorporation', parsed.state_of_incorporation.value);
182
+ }
183
+ if (isConfident(parsed.countries_of_operations)) {
184
+ assignAutofilledValue(result, 'countriesOfOperations', parsed.countries_of_operations.value);
185
+ }
186
+ if (isConfident(parsed.source_of_funds)) {
187
+ assignAutofilledValue(result, 'sourceOfFunds', parsed.source_of_funds.value);
188
+ }
189
+ if (isConfident(parsed.transaction_volume_expectations)) {
190
+ assignAutofilledValue(result, 'transactionVolume', parsed.transaction_volume_expectations.value);
191
+ }
192
+ if (isConfident(parsed.purpose_of_account)) {
193
+ assignAutofilledValue(result, 'purposeOfAccount', parsed.purpose_of_account.value);
194
+ }
195
+ if (isConfident(parsed.regulated_status)) {
196
+ assignAutofilledValue(result, 'regulatedStatus', parsed.regulated_status.value);
197
+ }
198
+ if (isConfident(parsed.us_nexus)) {
199
+ assignAutofilledValue(result, 'usNexus', parsed.us_nexus.value);
200
+ }
201
+ return result;
202
+ };
203
+ exports.mapCoiToCompanyDetails = mapCoiToCompanyDetails;
204
+ /** Tax EIN letter → Company Details. */
205
+ const mapTaxEinToCompanyDetails = (parsed) => {
206
+ const result = emptyResult();
207
+ if (isConfident(parsed.legal_business_name)) {
208
+ assignAutofilledValue(result, 'companyLegalName', parsed.legal_business_name.value);
209
+ }
210
+ if (isConfident(parsed.ein)) {
211
+ assignAutofilledValue(result, 'taxIdOrEIN', parsed.ein.value);
212
+ }
213
+ return result;
214
+ };
215
+ exports.mapTaxEinToCompanyDetails = mapTaxEinToCompanyDetails;
@@ -2,7 +2,7 @@ import { ID } from '../../../commonStateTypes/common';
2
2
  import { ZeniAPIStatus } from '../../../responsePayload';
3
3
  import { ZeniDate } from '../../../zeniDayJS';
4
4
  import { CompanyOfficerType } from '../../companyView/types/companyPassport/companyUsersLocalData';
5
- import { CompanyDetailsLocalData, SetupViewLocalData, SetupViewState } from './setupViewState';
5
+ import { CompanyDetailsLocalData, CompanyOfficerLocalData, SetupViewLocalData, SetupViewState } from './setupViewState';
6
6
  export declare const initialState: SetupViewState;
7
7
  export declare const enableSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "zeni_treasury" | "charge_cards" | "other_connection" | "billing" | "debit_cards" | "charge_cards__debit_cards"], {
8
8
  companyId: string;
@@ -29,6 +29,32 @@ export declare const enableSetup: import("@reduxjs/toolkit").ActionCreatorWithPr
29
29
  }, "setupView/sendOtpSuccess">, sendOtpFailureSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "setupView/sendOtpFailure">, verifyOtpSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/verifyOtp">, verifyOtpSuccessSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/verifyOtpSuccess">, verifyOtpFailureSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "setupView/verifyOtpFailure">, saveIndustryAndIncDateInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
30
30
  incDate: ZeniDate;
31
31
  industry: string;
32
- }, "setupView/saveIndustryAndIncDateInLocalStore">, clearSetupViewDataInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupViewDataInLocalStore">, clearSetupView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupView">;
32
+ }, "setupView/saveIndustryAndIncDateInLocalStore">, clearSetupViewDataInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupViewDataInLocalStore">, clearSetupView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupView">, applyKycDocumentAutofillForSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
33
+ autoFilledFieldNames: string[];
34
+ companyId: ID;
35
+ fileId: ID;
36
+ officerType: CompanyOfficerType;
37
+ values: Partial<CompanyOfficerLocalData>;
38
+ }], {
39
+ autoFilledFieldNames: string[];
40
+ companyId: ID;
41
+ fileId: ID;
42
+ officerType: CompanyOfficerType;
43
+ values: Partial<CompanyOfficerLocalData>;
44
+ }, "setupView/applyKycDocumentAutofillForSetup", never, never>, applyKybDocumentAutofillForSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
45
+ autoFilledFieldNames: string[];
46
+ companyId: ID;
47
+ fileId: ID;
48
+ values: Partial<CompanyDetailsLocalData>;
49
+ }], {
50
+ autoFilledFieldNames: string[];
51
+ companyId: ID;
52
+ fileId: ID;
53
+ values: Partial<CompanyDetailsLocalData>;
54
+ }, "setupView/applyKybDocumentAutofillForSetup", never, never>, clearKycKybAutofillForSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload?: {
55
+ officerType?: CompanyOfficerType;
56
+ } | undefined], {
57
+ officerType?: CompanyOfficerType;
58
+ }, "setupView/clearKycKybAutofillForSetup", never, never>;
33
59
  declare const _default: import("redux").Reducer<SetupViewState>;
34
60
  export default _default;
@@ -1,66 +1,34 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearSetupView = exports.clearSetupViewDataInLocalStore = exports.saveIndustryAndIncDateInLocalStore = exports.verifyOtpFailureSpendManagementSetUp = exports.verifyOtpSuccessSpendManagementSetUp = exports.verifyOtpSpendManagementSetUp = exports.sendOtpFailureSpendManagementSetUp = exports.sendOtpSuccessSpendManagementSetUp = exports.resendOtpSpendManagementSetUp = exports.sendOtpSpendManagementSetUp = exports.saveTreasuryAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerPhoneInLocalStore = exports.saveSetupViewDataInLocalStore = exports.updateSetupViewLocalStoreData = exports.updateSelectedCompanyOfficer = exports.updateBusinessVerificationDetailsFailure = exports.updateBusinessVerificationDetailsSuccess = exports.updateBusinessVerificationDetails = exports.enableSetupFailure = exports.enableSetupSuccess = exports.enableSetup = exports.initialState = void 0;
4
+ exports.clearKycKybAutofillForSetup = exports.applyKybDocumentAutofillForSetup = exports.applyKycDocumentAutofillForSetup = exports.clearSetupView = exports.clearSetupViewDataInLocalStore = exports.saveIndustryAndIncDateInLocalStore = exports.verifyOtpFailureSpendManagementSetUp = exports.verifyOtpSuccessSpendManagementSetUp = exports.verifyOtpSpendManagementSetUp = exports.sendOtpFailureSpendManagementSetUp = exports.sendOtpSuccessSpendManagementSetUp = exports.resendOtpSpendManagementSetUp = exports.sendOtpSpendManagementSetUp = exports.saveTreasuryAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerPhoneInLocalStore = exports.saveSetupViewDataInLocalStore = exports.updateSetupViewLocalStoreData = exports.updateSelectedCompanyOfficer = exports.updateBusinessVerificationDetailsFailure = exports.updateBusinessVerificationDetailsSuccess = exports.updateBusinessVerificationDetails = exports.enableSetupFailure = exports.enableSetupSuccess = exports.enableSetup = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
+ const kycKybAutofillActions_1 = require("./kycKybAutofillActions");
6
7
  const initialFetchStatus = {
7
8
  fetchState: 'Not-Started',
8
9
  error: undefined,
9
10
  };
11
+ const emptyOfficerSlot = {
12
+ autoFilledFields: [],
13
+ localData: undefined,
14
+ sendOtpStatus: initialFetchStatus,
15
+ otpverificationStatus: initialFetchStatus,
16
+ };
10
17
  exports.initialState = {
11
18
  updateStatus: { fetchState: 'Not-Started', error: undefined },
12
- companyDetails: {},
19
+ parsingDocumentFileIds: [],
20
+ companyDetails: { autoFilledFields: [] },
13
21
  companyOfficerUpdateStatus: {
14
- Officer_1: {
15
- localData: undefined,
16
- sendOtpStatus: initialFetchStatus,
17
- otpverificationStatus: initialFetchStatus,
18
- },
19
- Officer_2: {
20
- localData: undefined,
21
- sendOtpStatus: initialFetchStatus,
22
- otpverificationStatus: initialFetchStatus,
23
- },
24
- Officer_3: {
25
- localData: undefined,
26
- sendOtpStatus: initialFetchStatus,
27
- otpverificationStatus: initialFetchStatus,
28
- },
29
- Officer_4: {
30
- localData: undefined,
31
- sendOtpStatus: initialFetchStatus,
32
- otpverificationStatus: initialFetchStatus,
33
- },
34
- Officer_5: {
35
- localData: undefined,
36
- sendOtpStatus: initialFetchStatus,
37
- otpverificationStatus: initialFetchStatus,
38
- },
39
- Officer_6: {
40
- localData: undefined,
41
- sendOtpStatus: initialFetchStatus,
42
- otpverificationStatus: initialFetchStatus,
43
- },
44
- Officer_7: {
45
- localData: undefined,
46
- sendOtpStatus: initialFetchStatus,
47
- otpverificationStatus: initialFetchStatus,
48
- },
49
- Officer_8: {
50
- localData: undefined,
51
- sendOtpStatus: initialFetchStatus,
52
- otpverificationStatus: initialFetchStatus,
53
- },
54
- Officer_9: {
55
- localData: undefined,
56
- sendOtpStatus: initialFetchStatus,
57
- otpverificationStatus: initialFetchStatus,
58
- },
59
- Officer_10: {
60
- localData: undefined,
61
- sendOtpStatus: initialFetchStatus,
62
- otpverificationStatus: initialFetchStatus,
63
- },
22
+ Officer_1: { ...emptyOfficerSlot },
23
+ Officer_2: { ...emptyOfficerSlot },
24
+ Officer_3: { ...emptyOfficerSlot },
25
+ Officer_4: { ...emptyOfficerSlot },
26
+ Officer_5: { ...emptyOfficerSlot },
27
+ Officer_6: { ...emptyOfficerSlot },
28
+ Officer_7: { ...emptyOfficerSlot },
29
+ Officer_8: { ...emptyOfficerSlot },
30
+ Officer_9: { ...emptyOfficerSlot },
31
+ Officer_10: { ...emptyOfficerSlot },
64
32
  },
65
33
  primaryContactDetails: {},
66
34
  };
@@ -301,7 +269,93 @@ const setupView = (0, toolkit_1.createSlice)({
301
269
  clearSetupView(draft) {
302
270
  Object.assign(draft, exports.initialState);
303
271
  },
272
+ /**
273
+ * Merge AI-parsed officer fields into the selected officer's localData and
274
+ * track which field names were autofilled so the form can show the ✦ badge.
275
+ */
276
+ applyKycDocumentAutofillForSetup: {
277
+ reducer(draft, action) {
278
+ const { officerType, values, autoFilledFieldNames, fileId } = action.payload;
279
+ const slot = draft.companyOfficerUpdateStatus[officerType];
280
+ slot.localData = Object.assign({}, slot.localData, values);
281
+ slot.autoFilledFields = Array.from(new Set([...(slot.autoFilledFields ?? []), ...autoFilledFieldNames]));
282
+ draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
283
+ },
284
+ prepare(payload) {
285
+ return { payload };
286
+ },
287
+ },
288
+ /**
289
+ * Merge AI-parsed company fields into companyDetails.localData and track
290
+ * which field names were autofilled.
291
+ */
292
+ applyKybDocumentAutofillForSetup: {
293
+ reducer(draft, action) {
294
+ const { values, autoFilledFieldNames, fileId } = action.payload;
295
+ draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
296
+ draft.companyDetails.autoFilledFields = Array.from(new Set([
297
+ ...(draft.companyDetails.autoFilledFields ?? []),
298
+ ...autoFilledFieldNames,
299
+ ]));
300
+ draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
301
+ },
302
+ prepare(payload) {
303
+ return { payload };
304
+ },
305
+ },
306
+ /**
307
+ * Wipe AI-autofill badges. If `officerType` is provided, clears only that
308
+ * officer; otherwise clears company details too.
309
+ */
310
+ clearKycKybAutofillForSetup: {
311
+ reducer(draft, action) {
312
+ const { officerType } = action.payload;
313
+ if (officerType != null) {
314
+ draft.companyOfficerUpdateStatus[officerType].autoFilledFields = [];
315
+ }
316
+ else {
317
+ draft.companyDetails.autoFilledFields = [];
318
+ Object.keys(draft.companyOfficerUpdateStatus).forEach((key) => {
319
+ draft.companyOfficerUpdateStatus[key].autoFilledFields = [];
320
+ });
321
+ }
322
+ },
323
+ prepare(payload = {}) {
324
+ return { payload };
325
+ },
326
+ },
327
+ },
328
+ extraReducers: (builder) => {
329
+ const addParsingFileId = (draft, fileId) => {
330
+ draft.parsingDocumentFileIds = draft.parsingDocumentFileIds ?? [];
331
+ if (!draft.parsingDocumentFileIds.includes(fileId)) {
332
+ draft.parsingDocumentFileIds.push(fileId);
333
+ }
334
+ };
335
+ const removeParsingFileId = (draft, fileId) => {
336
+ draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
337
+ };
338
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKycDocument, (draft, action) => {
339
+ if (action.payload.target === 'setup') {
340
+ addParsingFileId(draft, action.payload.fileId);
341
+ }
342
+ });
343
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKybDocument, (draft, action) => {
344
+ if (action.payload.target === 'setup') {
345
+ addParsingFileId(draft, action.payload.fileId);
346
+ }
347
+ });
348
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKycDocumentFailure, (draft, action) => {
349
+ if (action.payload.target === 'setup') {
350
+ removeParsingFileId(draft, action.payload.fileId);
351
+ }
352
+ });
353
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKybDocumentFailure, (draft, action) => {
354
+ if (action.payload.target === 'setup') {
355
+ removeParsingFileId(draft, action.payload.fileId);
356
+ }
357
+ });
304
358
  },
305
359
  });
306
- _a = setupView.actions, exports.enableSetup = _a.enableSetup, exports.enableSetupSuccess = _a.enableSetupSuccess, exports.enableSetupFailure = _a.enableSetupFailure, exports.updateBusinessVerificationDetails = _a.updateBusinessVerificationDetails, exports.updateBusinessVerificationDetailsSuccess = _a.updateBusinessVerificationDetailsSuccess, exports.updateBusinessVerificationDetailsFailure = _a.updateBusinessVerificationDetailsFailure, exports.updateSelectedCompanyOfficer = _a.updateSelectedCompanyOfficer, exports.updateSetupViewLocalStoreData = _a.updateSetupViewLocalStoreData, exports.saveSetupViewDataInLocalStore = _a.saveSetupViewDataInLocalStore, exports.saveCompnayOfficerPhoneInLocalStore = _a.saveCompnayOfficerPhoneInLocalStore, exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = _a.saveCompnayOfficerAdditionalDocumentsInLocalStore, exports.saveTreasuryAdditionalDocumentsInLocalStore = _a.saveTreasuryAdditionalDocumentsInLocalStore, exports.sendOtpSpendManagementSetUp = _a.sendOtp, exports.resendOtpSpendManagementSetUp = _a.resendOtp, exports.sendOtpSuccessSpendManagementSetUp = _a.sendOtpSuccess, exports.sendOtpFailureSpendManagementSetUp = _a.sendOtpFailure, exports.verifyOtpSpendManagementSetUp = _a.verifyOtp, exports.verifyOtpSuccessSpendManagementSetUp = _a.verifyOtpSuccess, exports.verifyOtpFailureSpendManagementSetUp = _a.verifyOtpFailure, exports.saveIndustryAndIncDateInLocalStore = _a.saveIndustryAndIncDateInLocalStore, exports.clearSetupViewDataInLocalStore = _a.clearSetupViewDataInLocalStore, exports.clearSetupView = _a.clearSetupView;
360
+ _a = setupView.actions, exports.enableSetup = _a.enableSetup, exports.enableSetupSuccess = _a.enableSetupSuccess, exports.enableSetupFailure = _a.enableSetupFailure, exports.updateBusinessVerificationDetails = _a.updateBusinessVerificationDetails, exports.updateBusinessVerificationDetailsSuccess = _a.updateBusinessVerificationDetailsSuccess, exports.updateBusinessVerificationDetailsFailure = _a.updateBusinessVerificationDetailsFailure, exports.updateSelectedCompanyOfficer = _a.updateSelectedCompanyOfficer, exports.updateSetupViewLocalStoreData = _a.updateSetupViewLocalStoreData, exports.saveSetupViewDataInLocalStore = _a.saveSetupViewDataInLocalStore, exports.saveCompnayOfficerPhoneInLocalStore = _a.saveCompnayOfficerPhoneInLocalStore, exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = _a.saveCompnayOfficerAdditionalDocumentsInLocalStore, exports.saveTreasuryAdditionalDocumentsInLocalStore = _a.saveTreasuryAdditionalDocumentsInLocalStore, exports.sendOtpSpendManagementSetUp = _a.sendOtp, exports.resendOtpSpendManagementSetUp = _a.resendOtp, exports.sendOtpSuccessSpendManagementSetUp = _a.sendOtpSuccess, exports.sendOtpFailureSpendManagementSetUp = _a.sendOtpFailure, exports.verifyOtpSpendManagementSetUp = _a.verifyOtp, exports.verifyOtpSuccessSpendManagementSetUp = _a.verifyOtpSuccess, exports.verifyOtpFailureSpendManagementSetUp = _a.verifyOtpFailure, exports.saveIndustryAndIncDateInLocalStore = _a.saveIndustryAndIncDateInLocalStore, exports.clearSetupViewDataInLocalStore = _a.clearSetupViewDataInLocalStore, exports.clearSetupView = _a.clearSetupView, exports.applyKycDocumentAutofillForSetup = _a.applyKycDocumentAutofillForSetup, exports.applyKybDocumentAutofillForSetup = _a.applyKybDocumentAutofillForSetup, exports.clearKycKybAutofillForSetup = _a.clearKycKybAutofillForSetup;
307
361
  exports.default = setupView.reducer;
@@ -16,7 +16,7 @@ import { CompanyOfficerType } from '../../companyView/types/companyPassport/comp
16
16
  import { CompanyView } from '../../companyView/types/companyView';
17
17
  import { AccountTypeSubConfigCodeKeyType } from '../billPay/billPayConfig/billPayConfigState';
18
18
  import { PlaidAccountKeyType, PlaidConnectionDetails } from '../plaidAccount/plaidAccountViewState';
19
- import { CompanyAndIdentityDetails, CompanyOfficerLocalData, PrimaryContactLocalData, SetupViewType } from './setupViewState';
19
+ import { CompanyAndIdentityDetails, CompanyOfficerLocalData, PrimaryContactLocalData, SetupViewState, SetupViewType } from './setupViewState';
20
20
  export interface SetupView {
21
21
  accountFetchStatus: FetchStateAndError;
22
22
  accountUpdateStatus: FetchStateAndError;
@@ -54,6 +54,8 @@ export interface FundingAccount {
54
54
  }
55
55
  export interface CompanyOfficersDetails extends CompanyOfficerLocalData {
56
56
  additionalFiles: File[];
57
+ /** Field names in this officer's localData populated by AI doc autofill. */
58
+ autoFilledFields: string[];
57
59
  deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
58
60
  otpverificationStatus: FetchStateAndError;
59
61
  sendOtpStatus: FetchStateAndError;
@@ -62,6 +64,8 @@ export interface CompanyOfficersDetails extends CompanyOfficerLocalData {
62
64
  addressStatus?: NewAddressData;
63
65
  }
64
66
  export interface CompanyDetails {
67
+ /** Field names in companyDetails localData populated by AI doc autofill. */
68
+ autoFilledFields: string[];
65
69
  companyFiles: File[];
66
70
  companyId: ID;
67
71
  deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
@@ -96,6 +100,7 @@ export interface CompanyDetails {
96
100
  }
97
101
  interface CompanyAndOfficerLocalData {
98
102
  companyOfficerLocalData: Record<CompanyOfficerType, CompanyOfficersDetails | undefined>;
103
+ parsingDocumentFileIds: ID[];
99
104
  companyDetailsLocalData?: CompanyDetails;
100
105
  }
101
106
  export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData {
@@ -105,7 +110,7 @@ export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData
105
110
  }
106
111
  export declare function getCommonSetupViewDetails(state: RootState, companyId: ID, setupViewType: SetupViewType, plaidAccountKeyType: PlaidAccountKeyType): SetupView;
107
112
  export declare function getBusinessVerificationDetails(state: RootState, companyId: ID): BusinessVerificationDetails;
108
- export declare const getCompanyAndIdentityDetails: (state: RootState, companyId: ID, companyAndIdentityDetails: CompanyAndIdentityDetails) => CompanyAndOfficerLocalData;
113
+ export declare const getCompanyAndIdentityDetails: (state: RootState, companyId: ID, companyAndIdentityDetails: CompanyAndIdentityDetails & Pick<SetupViewState, "parsingDocumentFileIds">) => CompanyAndOfficerLocalData;
109
114
  export declare const getAllFundingAccounts: (depositAccounts: DepositAccount[], paymentAccounts: PaymentAccount[], paymentAccountBalanceFetchStatus: Record<ID, FetchStateAndError>, includeOnlyVerifiedAccounts?: boolean) => FundingAccount[];
110
115
  export declare const mapDepositAccToFundingAccount: (depositAcc: DepositAccount) => FundingAccount;
111
116
  export declare const mapDepositAccountWithLimitToFundingAccount: (depositAcc: DepositAccountWithLimit) => FundingAccount;