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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +1 -0
  2. package/lib/entity/paymentAccount/paymentAccountSelector.js +4 -0
  3. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  4. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +21 -0
  5. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +54 -0
  6. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  7. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  8. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  9. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  10. package/lib/entity/tenant/tenantReducer.d.ts +38 -25
  11. package/lib/entity/tenant/tenantReducer.js +65 -5
  12. package/lib/entity/tenant/tenantState.d.ts +1 -0
  13. package/lib/epic.d.ts +3 -1
  14. package/lib/epic.js +4 -1
  15. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +3 -0
  16. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +50 -0
  17. package/lib/esm/entity/tenant/tenantReducer.js +63 -3
  18. package/lib/esm/epic.js +4 -1
  19. package/lib/esm/index.js +7 -4
  20. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +61 -50
  21. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +49 -0
  22. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +58 -0
  23. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +12 -0
  24. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +205 -0
  25. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +71 -52
  26. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
  27. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +28 -0
  28. package/lib/index.d.ts +8 -4
  29. package/lib/index.js +29 -16
  30. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +25 -2
  31. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +62 -51
  32. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +10 -0
  33. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +8 -0
  34. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +53 -0
  35. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +8 -0
  36. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +62 -0
  37. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +27 -0
  38. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +15 -0
  39. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +24 -0
  40. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +213 -0
  41. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +24 -2
  42. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +72 -53
  43. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +4 -0
  44. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
  45. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +12 -0
  46. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +125 -0
  47. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +32 -0
  48. package/package.json +2 -1
@@ -81,9 +81,21 @@ export interface SetupViewLocalData {
81
81
  */
82
82
  export interface CompanyAndIdentityDetails {
83
83
  companyDetails: {
84
+ /**
85
+ * Field names from {@link CompanyDetailsLocalData} that were populated by AI
86
+ * autofill from an uploaded KYB document. Drives the ✦ sparkle in the form.
87
+ * Always present (empty when no autofill has run yet).
88
+ */
89
+ autoFilledFields: string[];
84
90
  localData?: CompanyDetailsLocalData;
85
91
  };
86
92
  companyOfficerUpdateStatus: Record<CompanyOfficerType, {
93
+ /**
94
+ * Field names from {@link CompanyOfficerLocalData} populated by AI autofill
95
+ * from an uploaded KYC identity document. Drives the ✦ sparkle in the form.
96
+ * Always present (empty when no autofill has run yet).
97
+ */
98
+ autoFilledFields: string[];
87
99
  otpverificationStatus: FetchStateAndError;
88
100
  sendOtpStatus: FetchStateAndError;
89
101
  localData?: CompanyOfficerLocalData;
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Shared types for the KYC / KYB document autofill flow that lives inside the
3
+ * commonSetup feature (Setup pages + Onboarding both consume it via the same
4
+ * selector view; there is no separate state slice).
5
+ *
6
+ * Backed by document-communication-agent `POST /1.0/documents/process/sync`,
7
+ * which proxies document-service ExtendAI parsers and returns one of the
8
+ * parser payloads below — each value shaped as `{value, confidence}` per field.
9
+ */
10
+ import { ID } from '../../../../commonStateTypes/common';
11
+ /**
12
+ * Form-side identity document types as picked in `SelectDocumentField`.
13
+ * These are camelCase per the web-components convention.
14
+ */
15
+ export type KycSelectDocumentType = 'driverLicense' | 'passport' | 'ssnCard' | 'stateId';
16
+ /**
17
+ * KYC document types accepted by the document-service parsers (snake_case).
18
+ * Subset of {@link KycKybProvidedDocumentType}. `stateId` from the form maps
19
+ * to no parser today and is skipped at dispatch time.
20
+ */
21
+ export type KycProvidedDocumentType = 'passport' | 'driving_license' | 'social_security_card';
22
+ /** KYB document types accepted by the document-service parsers. */
23
+ export type KybProvidedDocumentType = 'certificate_of_incorporation' | 'tax_ein';
24
+ /** All KYC / KYB document types accepted by document-communication-agent. */
25
+ export type KycKybProvidedDocumentType = KycProvidedDocumentType | KybProvidedDocumentType;
26
+ /** Field value with model confidence (0..1) as returned by ExtendAI parsers. */
27
+ export interface FieldWithConfidence<T = string | null> {
28
+ confidence: number;
29
+ value: T | null;
30
+ }
31
+ /**
32
+ * Parser payloads — keep in sync with document-service
33
+ * `processors/parsers/extend_*_parser.py`.
34
+ */
35
+ export interface ExtendPassportParsed {
36
+ date_of_birth?: FieldWithConfidence;
37
+ date_of_expiry?: FieldWithConfidence;
38
+ date_of_issue?: FieldWithConfidence;
39
+ first_name?: FieldWithConfidence;
40
+ gender?: FieldWithConfidence;
41
+ issuing_authority?: FieldWithConfidence;
42
+ last_name?: FieldWithConfidence;
43
+ mrz_line_1?: FieldWithConfidence;
44
+ mrz_line_2?: FieldWithConfidence;
45
+ nationality?: FieldWithConfidence;
46
+ passport_number?: FieldWithConfidence;
47
+ place_of_birth?: FieldWithConfidence;
48
+ }
49
+ export interface ExtendDrivingLicenseParsed {
50
+ address_city?: FieldWithConfidence;
51
+ address_state?: FieldWithConfidence;
52
+ address_street?: FieldWithConfidence;
53
+ address_zip?: FieldWithConfidence;
54
+ date_of_birth?: FieldWithConfidence;
55
+ date_of_expiry?: FieldWithConfidence;
56
+ date_of_issue?: FieldWithConfidence;
57
+ first_name?: FieldWithConfidence;
58
+ issuing_state?: FieldWithConfidence;
59
+ last_name?: FieldWithConfidence;
60
+ license_number?: FieldWithConfidence;
61
+ middle_name?: FieldWithConfidence;
62
+ }
63
+ export interface ExtendSsnCardParsed {
64
+ full_name?: FieldWithConfidence;
65
+ }
66
+ export interface ExtendCertificateOfIncorporationParsed {
67
+ company_address?: FieldWithConfidence;
68
+ company_legal_name?: FieldWithConfidence;
69
+ countries_of_operations?: FieldWithConfidence<string[]>;
70
+ date_of_incorporation?: FieldWithConfidence;
71
+ ein?: FieldWithConfidence;
72
+ industry?: FieldWithConfidence;
73
+ phone_number?: FieldWithConfidence;
74
+ product_description?: FieldWithConfidence;
75
+ purpose_of_account?: FieldWithConfidence;
76
+ registered_address?: FieldWithConfidence;
77
+ regulated_status?: FieldWithConfidence;
78
+ source_of_funds?: FieldWithConfidence;
79
+ state_of_incorporation?: FieldWithConfidence;
80
+ sub_industry?: FieldWithConfidence;
81
+ sub_us_nexus?: FieldWithConfidence;
82
+ transaction_volume_expectations?: FieldWithConfidence;
83
+ type_of_incorporation?: FieldWithConfidence;
84
+ us_nexus?: FieldWithConfidence;
85
+ website?: FieldWithConfidence;
86
+ }
87
+ export interface ExtendTaxEinParsed {
88
+ ein?: FieldWithConfidence;
89
+ irs_address?: FieldWithConfidence;
90
+ legal_business_name?: FieldWithConfidence;
91
+ trade_name?: FieldWithConfidence;
92
+ }
93
+ /** POST /1.0/documents/process/sync request body. */
94
+ export interface SyncDocumentsProcessRequest {
95
+ files: Array<{
96
+ file_id: ID;
97
+ }>;
98
+ provided_document_type: KycKybProvidedDocumentType;
99
+ metadata?: {
100
+ source?: string;
101
+ } & Record<string, unknown>;
102
+ processing_priority?: number;
103
+ }
104
+ /** POST /1.0/documents/process/sync response body. */
105
+ export interface SyncDocumentsProcessResponse {
106
+ data: ExtendPassportParsed | ExtendDrivingLicenseParsed | ExtendSsnCardParsed | ExtendCertificateOfIncorporationParsed | ExtendTaxEinParsed | null;
107
+ status: {
108
+ code: number;
109
+ message: string;
110
+ };
111
+ }
112
+ /**
113
+ * Discriminator for which Redux slice to apply the autofill to — setup pages
114
+ * (`spendManagement/commonSetup`) and onboarding (`onboardingView/customerView`)
115
+ * share the same field shapes but live in separate slices.
116
+ */
117
+ export type KycKybAutofillTarget = 'setup' | 'onboarding';
118
+ /** Confidence floor below which we drop an autofill candidate. */
119
+ export declare const KYC_KYB_AUTOFILL_MIN_CONFIDENCE = 0.5;
120
+ /**
121
+ * Maps the form-side {@link KycSelectDocumentType} (camelCase) to the
122
+ * parser-side {@link KycProvidedDocumentType} (snake_case). Returns `null` for
123
+ * `stateId`, which has no parser today.
124
+ */
125
+ export declare const toKycProvidedDocumentType: (selectType: KycSelectDocumentType) => KycProvidedDocumentType | null;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /**
3
+ * Shared types for the KYC / KYB document autofill flow that lives inside the
4
+ * commonSetup feature (Setup pages + Onboarding both consume it via the same
5
+ * selector view; there is no separate state slice).
6
+ *
7
+ * Backed by document-communication-agent `POST /1.0/documents/process/sync`,
8
+ * which proxies document-service ExtendAI parsers and returns one of the
9
+ * parser payloads below — each value shaped as `{value, confidence}` per field.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.toKycProvidedDocumentType = exports.KYC_KYB_AUTOFILL_MIN_CONFIDENCE = void 0;
13
+ /** Confidence floor below which we drop an autofill candidate. */
14
+ exports.KYC_KYB_AUTOFILL_MIN_CONFIDENCE = 0.5;
15
+ /**
16
+ * Maps the form-side {@link KycSelectDocumentType} (camelCase) to the
17
+ * parser-side {@link KycProvidedDocumentType} (snake_case). Returns `null` for
18
+ * `stateId`, which has no parser today.
19
+ */
20
+ const toKycProvidedDocumentType = (selectType) => {
21
+ switch (selectType) {
22
+ case 'driverLicense':
23
+ return 'driving_license';
24
+ case 'passport':
25
+ return 'passport';
26
+ case 'ssnCard':
27
+ return 'social_security_card';
28
+ case 'stateId':
29
+ return null;
30
+ }
31
+ };
32
+ exports.toKycProvidedDocumentType = toKycProvidedDocumentType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.79",
3
+ "version": "5.0.81-beta0ND",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -108,6 +108,7 @@
108
108
  "test:typecheck": "echo 'Typechecking test files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.typecheck.json",
109
109
  "test:typecheck-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh master tsconfig.typecheck.json",
110
110
  "test": "pnpm lint-modified-files && pnpm test:typecheck-modified-files && vitest run --typecheck",
111
+ "test:full": "vitest run --typecheck",
111
112
  "lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0 --fix",
112
113
  "lint-modified-files": "chmod +x ./scripts/lint-modified-files.sh && ./scripts/lint-modified-files.sh",
113
114
  "lint:fix-modified-files": "chmod +x ./scripts/lint-modified-files.sh && LINT_FIX=true ./scripts/lint-modified-files.sh",