@zeniai/client-epic-state 5.0.85-beta1ND → 5.0.85-betaAR2

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 (69) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/commonStateTypes/animations.js +0 -1
  3. package/lib/entity/company/companyPayload.d.ts +0 -2
  4. package/lib/entity/company/companyPayload.js +0 -2
  5. package/lib/entity/company/companyStateTypes.d.ts +0 -2
  6. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +0 -1
  7. package/lib/entity/paymentAccount/paymentAccountSelector.js +0 -4
  8. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  9. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  10. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  11. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  12. package/lib/entity/tenant/tenantPayload.d.ts +0 -1
  13. package/lib/entity/tenant/tenantReducer.d.ts +25 -38
  14. package/lib/entity/tenant/tenantReducer.js +5 -65
  15. package/lib/entity/tenant/tenantState.d.ts +0 -1
  16. package/lib/epic.d.ts +3 -7
  17. package/lib/epic.js +3 -8
  18. package/lib/esm/commonStateTypes/animations.js +0 -1
  19. package/lib/esm/entity/company/companyPayload.js +0 -2
  20. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +0 -3
  21. package/lib/esm/entity/tenant/tenantReducer.js +3 -63
  22. package/lib/esm/epic.js +3 -8
  23. package/lib/esm/index.js +8 -11
  24. package/lib/esm/view/createTransferEntry/epics/createTransferEntryEpic.js +1 -7
  25. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +50 -202
  26. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +1 -17
  27. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +0 -13
  28. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +52 -105
  29. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +1 -6
  30. package/lib/index.d.ts +9 -13
  31. package/lib/index.js +35 -55
  32. package/lib/view/createTransferEntry/epics/createTransferEntryEpic.js +1 -7
  33. package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +0 -3
  34. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +4 -45
  35. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +51 -204
  36. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -8
  37. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +2 -24
  38. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +0 -42
  39. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +1 -14
  40. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +2 -28
  41. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +53 -106
  42. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +2 -7
  43. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +1 -6
  44. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +0 -19
  45. package/package.json +1 -1
  46. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +0 -21
  47. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +0 -54
  48. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +0 -50
  49. package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +0 -45
  50. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +0 -40
  51. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -52
  52. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -59
  53. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -14
  54. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -205
  55. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -28
  56. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +0 -7
  57. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +0 -49
  58. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +0 -9
  59. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +0 -44
  60. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +0 -28
  61. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -56
  62. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +0 -30
  63. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -63
  64. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +0 -33
  65. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -17
  66. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +0 -24
  67. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -213
  68. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +0 -125
  69. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -32
@@ -1,14 +0,0 @@
1
- /**
2
- * Trigger actions for the KYC / KYB autofill epics.
3
- *
4
- * These actions don't mutate state — the epic listens for them, calls
5
- * document-communication-agent's sync endpoint, and dispatches the appropriate
6
- * `applyKyc/KybDocumentAutofillFor{Setup,Onboarding}` against the matching
7
- * slice. Co-located with the rest of the commonSetup module because the entire
8
- * autofill flow is auxiliary to the setup view; there is no separate state.
9
- */
10
- import { createAction } from '@reduxjs/toolkit';
11
- export const parseUploadedKycDocument = createAction('commonSetup/parseUploadedKycDocument');
12
- export const parseUploadedKybDocument = createAction('commonSetup/parseUploadedKybDocument');
13
- export const parseUploadedKycDocumentFailure = createAction('commonSetup/parseUploadedKycDocumentFailure');
14
- export const parseUploadedKybDocumentFailure = createAction('commonSetup/parseUploadedKybDocumentFailure');
@@ -1,205 +0,0 @@
1
- /**
2
- * Pure mappers from ExtendAI parser payloads to our form-side local-data shapes.
3
- *
4
- * Each mapper filters out fields below KYC_KYB_AUTOFILL_MIN_CONFIDENCE and returns
5
- * both the merged values and the list of field names that were autofilled so the
6
- * UI can show the ✦ AI badge next to each.
7
- */
8
- import { date } from '../../../zeniDayJS';
9
- import { toZeniUrl } from '../../../zeniUrl';
10
- import { KYC_KYB_AUTOFILL_MIN_CONFIDENCE, } from './types/kycKybAutofill';
11
- const emptyResult = () => ({
12
- values: {},
13
- autoFilledFieldNames: [],
14
- });
15
- const isConfident = (field) => {
16
- if (field == null) {
17
- return false;
18
- }
19
- if (field.value == null) {
20
- return false;
21
- }
22
- return field.confidence >= KYC_KYB_AUTOFILL_MIN_CONFIDENCE;
23
- };
24
- const assignAutofilledValue = (result, key, value) => {
25
- if (value == null) {
26
- return;
27
- }
28
- if (typeof value === 'string' && value.trim() === '') {
29
- return;
30
- }
31
- result.values[key] = value;
32
- result.autoFilledFieldNames.push(key);
33
- };
34
- const tryParseDate = (rawDate) => {
35
- const parsedDate = date(rawDate);
36
- if (parsedDate.isValid()) {
37
- return parsedDate;
38
- }
39
- return undefined;
40
- };
41
- const normalizeNationality = (rawNationality, countries) => {
42
- const needle = rawNationality.trim().toLowerCase();
43
- if (needle === '') {
44
- return undefined;
45
- }
46
- // Exact ISO-2 / ISO-3 match.
47
- const isoMatch = countries.find((country) => country.countryCode.toLowerCase() === needle);
48
- if (isoMatch != null) {
49
- return isoMatch.countryCode;
50
- }
51
- // Common nationality adjectives map to country names (e.g. "American" → "United States").
52
- const adjectiveToCountry = {
53
- american: 'united states',
54
- british: 'united kingdom',
55
- indian: 'india',
56
- canadian: 'canada',
57
- australian: 'australia',
58
- german: 'germany',
59
- french: 'france',
60
- chinese: 'china',
61
- japanese: 'japan',
62
- mexican: 'mexico',
63
- brazilian: 'brazil',
64
- };
65
- const resolvedName = adjectiveToCountry[needle] ?? needle;
66
- const nameMatch = countries.find((country) => country.countryName.toLowerCase() === resolvedName);
67
- return nameMatch?.countryCode;
68
- };
69
- const splitFullName = (fullName) => {
70
- const parts = fullName.trim().split(/\s+/);
71
- if (parts.length === 1) {
72
- return { firstName: parts[0], lastName: '' };
73
- }
74
- const lastName = parts[parts.length - 1];
75
- const firstName = parts.slice(0, -1).join(' ');
76
- return { firstName, lastName };
77
- };
78
- /** Passport → Company Officer. */
79
- export const mapPassportToOfficer = (parsed, allNationalityCountries) => {
80
- const result = emptyResult();
81
- if (isConfident(parsed.first_name)) {
82
- assignAutofilledValue(result, 'firstName', parsed.first_name.value);
83
- }
84
- if (isConfident(parsed.last_name)) {
85
- assignAutofilledValue(result, 'lastName', parsed.last_name.value);
86
- }
87
- if (isConfident(parsed.date_of_birth)) {
88
- const parsedDate = tryParseDate(parsed.date_of_birth.value);
89
- if (parsedDate != null) {
90
- assignAutofilledValue(result, 'birthday', parsedDate);
91
- }
92
- }
93
- if (isConfident(parsed.nationality)) {
94
- const isoCode = normalizeNationality(parsed.nationality.value, allNationalityCountries);
95
- if (isoCode != null) {
96
- assignAutofilledValue(result, 'nationalityCountryCode', isoCode);
97
- }
98
- }
99
- return result;
100
- };
101
- /** Driving License → Company Officer. */
102
- export const mapDrivingLicenseToOfficer = (parsed) => {
103
- const result = emptyResult();
104
- if (isConfident(parsed.first_name)) {
105
- assignAutofilledValue(result, 'firstName', parsed.first_name.value);
106
- }
107
- if (isConfident(parsed.last_name)) {
108
- assignAutofilledValue(result, 'lastName', parsed.last_name.value);
109
- }
110
- if (isConfident(parsed.date_of_birth)) {
111
- const parsedDate = tryParseDate(parsed.date_of_birth.value);
112
- if (parsedDate != null) {
113
- assignAutofilledValue(result, 'birthday', parsedDate);
114
- }
115
- }
116
- // address_* fields are mapped at a higher layer (addressView reducer) — kept here as values
117
- // only, the consuming epic dispatches the address payload separately.
118
- return result;
119
- };
120
- /** SSN Card → Company Officer (name only — SSN value not yet returned by parser). */
121
- export const mapSsnCardToOfficer = (parsed) => {
122
- const result = emptyResult();
123
- if (isConfident(parsed.full_name)) {
124
- const { firstName, lastName } = splitFullName(parsed.full_name.value);
125
- if (firstName !== '') {
126
- assignAutofilledValue(result, 'firstName', firstName);
127
- }
128
- if (lastName !== '') {
129
- assignAutofilledValue(result, 'lastName', lastName);
130
- }
131
- }
132
- return result;
133
- };
134
- /** Certificate of Incorporation → Company Details. */
135
- export const mapCoiToCompanyDetails = (parsed) => {
136
- const result = emptyResult();
137
- if (isConfident(parsed.company_legal_name)) {
138
- assignAutofilledValue(result, 'companyLegalName', parsed.company_legal_name.value);
139
- }
140
- if (isConfident(parsed.ein)) {
141
- assignAutofilledValue(result, 'taxIdOrEIN', parsed.ein.value);
142
- }
143
- if (isConfident(parsed.phone_number)) {
144
- assignAutofilledValue(result, 'phone', parsed.phone_number.value);
145
- }
146
- if (isConfident(parsed.product_description)) {
147
- assignAutofilledValue(result, 'companyDescription', parsed.product_description.value);
148
- }
149
- if (isConfident(parsed.website)) {
150
- try {
151
- assignAutofilledValue(result, 'website', toZeniUrl(parsed.website.value));
152
- }
153
- catch {
154
- // ignore — malformed URL string from OCR
155
- }
156
- }
157
- if (isConfident(parsed.industry)) {
158
- assignAutofilledValue(result, 'companyIndustryType', parsed.industry.value);
159
- }
160
- if (isConfident(parsed.sub_industry)) {
161
- assignAutofilledValue(result, 'companySubIndustry', parsed.sub_industry.value);
162
- }
163
- if (isConfident(parsed.type_of_incorporation)) {
164
- assignAutofilledValue(result, 'typeOfIncorporation', parsed.type_of_incorporation.value);
165
- }
166
- if (isConfident(parsed.date_of_incorporation)) {
167
- const parsedDate = tryParseDate(parsed.date_of_incorporation.value);
168
- if (parsedDate != null) {
169
- assignAutofilledValue(result, 'incDate', parsedDate);
170
- }
171
- }
172
- if (isConfident(parsed.state_of_incorporation)) {
173
- assignAutofilledValue(result, 'stateOfIncorporation', parsed.state_of_incorporation.value);
174
- }
175
- if (isConfident(parsed.countries_of_operations)) {
176
- assignAutofilledValue(result, 'countriesOfOperations', parsed.countries_of_operations.value);
177
- }
178
- if (isConfident(parsed.source_of_funds)) {
179
- assignAutofilledValue(result, 'sourceOfFunds', parsed.source_of_funds.value);
180
- }
181
- if (isConfident(parsed.transaction_volume_expectations)) {
182
- assignAutofilledValue(result, 'transactionVolume', parsed.transaction_volume_expectations.value);
183
- }
184
- if (isConfident(parsed.purpose_of_account)) {
185
- assignAutofilledValue(result, 'purposeOfAccount', parsed.purpose_of_account.value);
186
- }
187
- if (isConfident(parsed.regulated_status)) {
188
- assignAutofilledValue(result, 'regulatedStatus', parsed.regulated_status.value);
189
- }
190
- if (isConfident(parsed.us_nexus)) {
191
- assignAutofilledValue(result, 'usNexus', parsed.us_nexus.value);
192
- }
193
- return result;
194
- };
195
- /** Tax EIN letter → Company Details. */
196
- export const mapTaxEinToCompanyDetails = (parsed) => {
197
- const result = emptyResult();
198
- if (isConfident(parsed.legal_business_name)) {
199
- assignAutofilledValue(result, 'companyLegalName', parsed.legal_business_name.value);
200
- }
201
- if (isConfident(parsed.ein)) {
202
- assignAutofilledValue(result, 'taxIdOrEIN', parsed.ein.value);
203
- }
204
- return result;
205
- };
@@ -1,28 +0,0 @@
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
- /** Confidence floor below which we drop an autofill candidate. */
11
- export const KYC_KYB_AUTOFILL_MIN_CONFIDENCE = 0.5;
12
- /**
13
- * Maps the form-side {@link KycSelectDocumentType} (camelCase) to the
14
- * parser-side {@link KycProvidedDocumentType} (snake_case). Returns `null` for
15
- * `stateId`, which has no parser today.
16
- */
17
- export const toKycProvidedDocumentType = (selectType) => {
18
- switch (selectType) {
19
- case 'driverLicense':
20
- return 'driving_license';
21
- case 'passport':
22
- return 'passport';
23
- case 'ssnCard':
24
- return 'social_security_card';
25
- case 'stateId':
26
- return null;
27
- }
28
- };
@@ -1,7 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../../reducer';
4
- import { ZeniAPI } from '../../../../../zeniAPI';
5
- import { fetchAiAgentsActivationStatus, fetchAiAgentsActivationStatusFailure, fetchAiAgentsActivationStatusSuccess } from '../../onboardingCustomerViewReducer';
6
- export type ActionType = ReturnType<typeof fetchAiAgentsActivationStatus> | ReturnType<typeof fetchAiAgentsActivationStatusSuccess> | ReturnType<typeof fetchAiAgentsActivationStatusFailure>;
7
- export declare const fetchAiAgentsActivationStatusEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchAiAgentsActivationStatusEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../../responsePayload");
7
- const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
8
- const toPhaseStatus = (raw) => {
9
- if (raw === 'idle' ||
10
- raw === 'starting' ||
11
- raw === 'building' ||
12
- raw === 'ready') {
13
- return raw;
14
- }
15
- return 'idle';
16
- };
17
- const toPhase = (section, row) => ({
18
- key: row.key,
19
- section,
20
- status: toPhaseStatus(row.status),
21
- startedAt: row.started_at,
22
- completedAt: row.completed_at,
23
- });
24
- const toCounts = (payload) => ({
25
- customerCount: payload?.customer_count ?? 0,
26
- glAccountCount: payload?.gl_account_count ?? 0,
27
- targetTransactionCount: payload?.target_transaction_count ?? 0,
28
- transactionCount: payload?.transaction_count ?? 0,
29
- vendorCount: payload?.vendor_count ?? 0,
30
- });
31
- const fetchAiAgentsActivationStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.fetchAiAgentsActivationStatus.match), (0, operators_1.mergeMap)(() => {
32
- const url = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/ai-agents-activation/status`;
33
- return zeniAPI
34
- .getJSON(url)
35
- .pipe((0, operators_1.mergeMap)((response) => {
36
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
37
- const ledgerPhases = (response.data.ledger_section ?? []).map((row) => toPhase('ledger', row));
38
- const backgroundPhases = (response.data.background_section ?? []).map((row) => toPhase('background', row));
39
- return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.fetchAiAgentsActivationStatusSuccess)({
40
- ledgerPhases,
41
- backgroundPhases,
42
- counts: toCounts(response.data.counts),
43
- }));
44
- }
45
- return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.fetchAiAgentsActivationStatusFailure)(response.status));
46
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.fetchAiAgentsActivationStatusFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'fetchAiAgentsActivationStatus errored out ' +
47
- JSON.stringify(error))))));
48
- }));
49
- exports.fetchAiAgentsActivationStatusEpic = fetchAiAgentsActivationStatusEpic;
@@ -1,9 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { updateCompanies } from '../../../../../entity/company/companyReducer';
4
- import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
5
- import { RootState } from '../../../../../reducer';
6
- import { ZeniAPI } from '../../../../../zeniAPI';
7
- import { acknowledgeOnboardingAiFinanceTeam, acknowledgeOnboardingAiFinanceTeamFailure, acknowledgeOnboardingAiFinanceTeamSuccess } from '../../onboardingCustomerViewReducer';
8
- export type ActionType = ReturnType<typeof acknowledgeOnboardingAiFinanceTeam> | ReturnType<typeof updateCompanies> | ReturnType<typeof openSnackbar> | ReturnType<typeof acknowledgeOnboardingAiFinanceTeamSuccess> | ReturnType<typeof acknowledgeOnboardingAiFinanceTeamFailure>;
9
- export declare const acknowledgeOnboardingAiFinanceTeamEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.acknowledgeOnboardingAiFinanceTeamEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const companyReducer_1 = require("../../../../../entity/company/companyReducer");
7
- const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
8
- const responsePayload_1 = require("../../../../../responsePayload");
9
- const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
10
- const acknowledgeOnboardingAiFinanceTeamEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.acknowledgeOnboardingAiFinanceTeam.match), (0, operators_1.mergeMap)((action) => {
11
- const { companyId } = action.payload;
12
- const payload = {
13
- is_onboarding_ai_finance_team_acknowledged: true,
14
- };
15
- return zeniAPI
16
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, payload)
17
- .pipe((0, operators_1.mergeMap)((response) => {
18
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
19
- const actions = [
20
- (0, companyReducer_1.updateCompanies)({
21
- payload: response.data.companies,
22
- schema: {},
23
- }),
24
- (0, onboardingCustomerViewReducer_1.acknowledgeOnboardingAiFinanceTeamSuccess)(),
25
- ];
26
- return (0, rxjs_1.from)(actions);
27
- }
28
- else {
29
- return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
30
- messageSection: 'onboarding_customer_view_complete',
31
- messageText: 'failed',
32
- type: 'error',
33
- variables: [
34
- {
35
- variableName: '_api-error_',
36
- variableValue: response.status.message,
37
- },
38
- ],
39
- }), (0, onboardingCustomerViewReducer_1.acknowledgeOnboardingAiFinanceTeamFailure)(response.status));
40
- }
41
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.acknowledgeOnboardingAiFinanceTeamFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Acknowledge - Onboarding AI Finance Team errored out' +
42
- JSON.stringify(error))))));
43
- }));
44
- exports.acknowledgeOnboardingAiFinanceTeamEpic = acknowledgeOnboardingAiFinanceTeamEpic;
@@ -1,28 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { RootState } from '../../../../../reducer';
3
- import { ZeniAPI } from '../../../../../zeniAPI';
4
- import { applyKybDocumentAutofillForOnboarding } from '../../../../onboardingView/customerView/onboardingCustomerViewReducer';
5
- import { parseUploadedKybDocument, parseUploadedKybDocumentFailure } from '../../kycKybAutofillActions';
6
- import { applyKybDocumentAutofillForSetup } from '../../setupViewReducer';
7
- import { CompanyDetailsLocalData } from '../../setupViewState';
8
- export type ActionType = ReturnType<typeof parseUploadedKybDocument | typeof parseUploadedKybDocumentFailure | typeof applyKybDocumentAutofillForSetup | typeof applyKybDocumentAutofillForOnboarding>;
9
- export declare const parseUploadedKybDocumentEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
10
- payload: import("../../kycKybAutofillActions").ParseUploadedDocumentFailurePayload;
11
- type: string;
12
- } | {
13
- payload: {
14
- autoFilledFieldNames: string[];
15
- companyId: import("../../../../..").ID;
16
- fileId: import("../../../../..").ID;
17
- values: Partial<CompanyDetailsLocalData>;
18
- };
19
- type: "onboardingCustomerView/applyKybDocumentAutofillForOnboarding";
20
- } | {
21
- payload: {
22
- autoFilledFieldNames: string[];
23
- companyId: import("../../../../..").ID;
24
- fileId: import("../../../../..").ID;
25
- values: Partial<CompanyDetailsLocalData>;
26
- };
27
- type: "setupView/applyKybDocumentAutofillForSetup";
28
- }>;
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseUploadedKybDocumentEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../../responsePayload");
7
- const onboardingCustomerViewReducer_1 = require("../../../../onboardingView/customerView/onboardingCustomerViewReducer");
8
- const kycKybAutofillActions_1 = require("../../kycKybAutofillActions");
9
- const kycKybParseMapper_1 = require("../../kycKybParseMapper");
10
- const setupViewReducer_1 = require("../../setupViewReducer");
11
- const PROCESS_DOCUMENT_SYNC_PATH = '/1.0/documents/process/sync';
12
- const parseUploadedKybDocumentEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(kycKybAutofillActions_1.parseUploadedKybDocument.match), (0, operators_1.mergeMap)((action) => {
13
- const { target, companyId, fileId, documentType } = action.payload;
14
- const url = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}${PROCESS_DOCUMENT_SYNC_PATH}`;
15
- const requestPayload = {
16
- provided_document_type: documentType,
17
- files: [{ file_id: fileId }],
18
- processing_priority: 10,
19
- metadata: { source: 'kyc_kyb_autofill' },
20
- };
21
- const failureAction = (0, kycKybAutofillActions_1.parseUploadedKybDocumentFailure)({ target, fileId });
22
- return zeniAPI
23
- .postAndGetJSON(url, requestPayload)
24
- .pipe((0, operators_1.mergeMap)((response) => {
25
- if (!(0, responsePayload_1.isSuccessResponse)(response) || response.data == null) {
26
- return (0, rxjs_1.of)(failureAction);
27
- }
28
- let result;
29
- switch (documentType) {
30
- case 'certificate_of_incorporation':
31
- result = (0, kycKybParseMapper_1.mapCoiToCompanyDetails)(response.data);
32
- break;
33
- case 'tax_ein':
34
- result = (0, kycKybParseMapper_1.mapTaxEinToCompanyDetails)(response.data);
35
- break;
36
- }
37
- if (result.autoFilledFieldNames.length === 0) {
38
- return (0, rxjs_1.of)(failureAction);
39
- }
40
- const applyAction = target === 'setup'
41
- ? (0, setupViewReducer_1.applyKybDocumentAutofillForSetup)({
42
- companyId,
43
- fileId,
44
- values: result.values,
45
- autoFilledFieldNames: result.autoFilledFieldNames,
46
- })
47
- : (0, onboardingCustomerViewReducer_1.applyKybDocumentAutofillForOnboarding)({
48
- companyId,
49
- fileId,
50
- values: result.values,
51
- autoFilledFieldNames: result.autoFilledFieldNames,
52
- });
53
- return (0, rxjs_1.of)(applyAction);
54
- }), (0, operators_1.catchError)(() => (0, rxjs_1.of)(failureAction)));
55
- }));
56
- exports.parseUploadedKybDocumentEpic = parseUploadedKybDocumentEpic;
@@ -1,30 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { RootState } from '../../../../../reducer';
3
- import { ZeniAPI } from '../../../../../zeniAPI';
4
- import { applyKycDocumentAutofillForOnboarding } from '../../../../onboardingView/customerView/onboardingCustomerViewReducer';
5
- import { parseUploadedKycDocument, parseUploadedKycDocumentFailure } from '../../kycKybAutofillActions';
6
- import { applyKycDocumentAutofillForSetup } from '../../setupViewReducer';
7
- import { CompanyOfficerLocalData } from '../../setupViewState';
8
- export type ActionType = ReturnType<typeof parseUploadedKycDocument | typeof parseUploadedKycDocumentFailure | typeof applyKycDocumentAutofillForSetup | typeof applyKycDocumentAutofillForOnboarding>;
9
- export declare const parseUploadedKycDocumentEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
10
- payload: import("../../kycKybAutofillActions").ParseUploadedDocumentFailurePayload;
11
- type: string;
12
- } | {
13
- payload: {
14
- autoFilledFieldNames: string[];
15
- companyId: import("../../../../..").ID;
16
- fileId: import("../../../../..").ID;
17
- officerType: import("../../../../..").CompanyOfficerType;
18
- values: Partial<CompanyOfficerLocalData>;
19
- };
20
- type: "onboardingCustomerView/applyKycDocumentAutofillForOnboarding";
21
- } | {
22
- payload: {
23
- autoFilledFieldNames: string[];
24
- companyId: import("../../../../..").ID;
25
- fileId: import("../../../../..").ID;
26
- officerType: import("../../../../..").CompanyOfficerType;
27
- values: Partial<CompanyOfficerLocalData>;
28
- };
29
- type: "setupView/applyKycDocumentAutofillForSetup";
30
- }>;
@@ -1,63 +0,0 @@
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 countryListSelector_1 = require("../../../../../entity/countryList/countryListSelector");
7
- const responsePayload_1 = require("../../../../../responsePayload");
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
- const allCountries = (0, countryListSelector_1.getCountryList)(state$.value.countryListState, 'nationalityCountryList').countries;
30
- let result;
31
- switch (documentType) {
32
- case 'passport':
33
- result = (0, kycKybParseMapper_1.mapPassportToOfficer)(response.data, allCountries);
34
- break;
35
- case 'driving_license':
36
- result = (0, kycKybParseMapper_1.mapDrivingLicenseToOfficer)(response.data);
37
- break;
38
- case 'social_security_card':
39
- result = (0, kycKybParseMapper_1.mapSsnCardToOfficer)(response.data);
40
- break;
41
- }
42
- if (result.autoFilledFieldNames.length === 0) {
43
- return (0, rxjs_1.of)(failureAction);
44
- }
45
- const applyAction = target === 'setup'
46
- ? (0, setupViewReducer_1.applyKycDocumentAutofillForSetup)({
47
- companyId,
48
- officerType,
49
- fileId,
50
- values: result.values,
51
- autoFilledFieldNames: result.autoFilledFieldNames,
52
- })
53
- : (0, onboardingCustomerViewReducer_1.applyKycDocumentAutofillForOnboarding)({
54
- companyId,
55
- officerType,
56
- fileId,
57
- values: result.values,
58
- autoFilledFieldNames: result.autoFilledFieldNames,
59
- });
60
- return (0, rxjs_1.of)(applyAction);
61
- }), (0, operators_1.catchError)(() => (0, rxjs_1.of)(failureAction)));
62
- }));
63
- exports.parseUploadedKycDocumentEpic = parseUploadedKycDocumentEpic;
@@ -1,33 +0,0 @@
1
- /**
2
- * Trigger actions for the KYC / KYB autofill epics.
3
- *
4
- * These actions don't mutate state — the epic listens for them, calls
5
- * document-communication-agent's sync endpoint, and dispatches the appropriate
6
- * `applyKyc/KybDocumentAutofillFor{Setup,Onboarding}` against the matching
7
- * slice. Co-located with the rest of the commonSetup module because the entire
8
- * autofill flow is auxiliary to the setup view; there is no separate state.
9
- */
10
- import { ID } from '../../../commonStateTypes/common';
11
- import { CompanyOfficerType } from '../../companyView/types/companyPassport/companyUsersLocalData';
12
- import { KybProvidedDocumentType, KycKybAutofillTarget, KycProvidedDocumentType } from './types/kycKybAutofill';
13
- export interface ParseUploadedKycDocumentPayload {
14
- companyId: ID;
15
- documentType: KycProvidedDocumentType;
16
- fileId: ID;
17
- officerType: CompanyOfficerType;
18
- target: KycKybAutofillTarget;
19
- }
20
- export interface ParseUploadedKybDocumentPayload {
21
- companyId: ID;
22
- documentType: KybProvidedDocumentType;
23
- fileId: ID;
24
- target: KycKybAutofillTarget;
25
- }
26
- export declare const parseUploadedKycDocument: import("@reduxjs/toolkit").ActionCreatorWithPayload<ParseUploadedKycDocumentPayload, string>;
27
- export declare const parseUploadedKybDocument: import("@reduxjs/toolkit").ActionCreatorWithPayload<ParseUploadedKybDocumentPayload, string>;
28
- export interface ParseUploadedDocumentFailurePayload {
29
- fileId: ID;
30
- target: KycKybAutofillTarget;
31
- }
32
- export declare const parseUploadedKycDocumentFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ParseUploadedDocumentFailurePayload, string>;
33
- export declare const parseUploadedKybDocumentFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ParseUploadedDocumentFailurePayload, string>;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- /**
3
- * Trigger actions for the KYC / KYB autofill epics.
4
- *
5
- * These actions don't mutate state — the epic listens for them, calls
6
- * document-communication-agent's sync endpoint, and dispatches the appropriate
7
- * `applyKyc/KybDocumentAutofillFor{Setup,Onboarding}` against the matching
8
- * slice. Co-located with the rest of the commonSetup module because the entire
9
- * autofill flow is auxiliary to the setup view; there is no separate state.
10
- */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.parseUploadedKybDocumentFailure = exports.parseUploadedKycDocumentFailure = exports.parseUploadedKybDocument = exports.parseUploadedKycDocument = void 0;
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');
@@ -1,24 +0,0 @@
1
- /**
2
- * Pure mappers from ExtendAI parser payloads to our form-side local-data shapes.
3
- *
4
- * Each mapper filters out fields below KYC_KYB_AUTOFILL_MIN_CONFIDENCE and returns
5
- * both the merged values and the list of field names that were autofilled so the
6
- * UI can show the ✦ AI badge next to each.
7
- */
8
- import { Country } from '../../../entity/countryList/countryListState';
9
- import { CompanyDetailsLocalData, CompanyOfficerLocalData } from './setupViewState';
10
- import { ExtendCertificateOfIncorporationParsed, ExtendDrivingLicenseParsed, ExtendPassportParsed, ExtendSsnCardParsed, ExtendTaxEinParsed } from './types/kycKybAutofill';
11
- export interface AutofillResult<TLocalData> {
12
- autoFilledFieldNames: (keyof TLocalData & string)[];
13
- values: Partial<TLocalData>;
14
- }
15
- /** Passport → Company Officer. */
16
- export declare const mapPassportToOfficer: (parsed: ExtendPassportParsed, allNationalityCountries: Country[]) => AutofillResult<CompanyOfficerLocalData>;
17
- /** Driving License → Company Officer. */
18
- export declare const mapDrivingLicenseToOfficer: (parsed: ExtendDrivingLicenseParsed) => AutofillResult<CompanyOfficerLocalData>;
19
- /** SSN Card → Company Officer (name only — SSN value not yet returned by parser). */
20
- export declare const mapSsnCardToOfficer: (parsed: ExtendSsnCardParsed) => AutofillResult<CompanyOfficerLocalData>;
21
- /** Certificate of Incorporation → Company Details. */
22
- export declare const mapCoiToCompanyDetails: (parsed: ExtendCertificateOfIncorporationParsed) => AutofillResult<CompanyDetailsLocalData>;
23
- /** Tax EIN letter → Company Details. */
24
- export declare const mapTaxEinToCompanyDetails: (parsed: ExtendTaxEinParsed) => AutofillResult<CompanyDetailsLocalData>;