@zeniai/client-epic-state 5.1.1-beta0ND → 5.1.1

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 (73) hide show
  1. package/lib/entity/company/companyPayload.d.ts +0 -4
  2. package/lib/entity/company/companyPayload.js +0 -4
  3. package/lib/entity/company/companyStateTypes.d.ts +0 -4
  4. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +0 -1
  5. package/lib/entity/paymentAccount/paymentAccountSelector.js +0 -9
  6. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  7. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  8. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  9. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  10. package/lib/entity/tenant/tenantPayload.d.ts +0 -1
  11. package/lib/entity/tenant/tenantReducer.d.ts +25 -38
  12. package/lib/entity/tenant/tenantReducer.js +5 -65
  13. package/lib/entity/tenant/tenantState.d.ts +0 -1
  14. package/lib/epic.d.ts +1 -6
  15. package/lib/epic.js +1 -7
  16. package/lib/esm/entity/company/companyPayload.js +0 -4
  17. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +0 -8
  18. package/lib/esm/entity/tenant/tenantReducer.js +3 -63
  19. package/lib/esm/epic.js +1 -7
  20. package/lib/esm/index.js +6 -9
  21. package/lib/esm/view/fileView/epic/deleteFileEpic.js +2 -2
  22. package/lib/esm/view/fileView/epic/deleteFileListEpic.js +2 -2
  23. package/lib/esm/view/fileView/epic/updateFileNameEpic.js +2 -2
  24. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +50 -218
  25. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +2 -12
  26. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +0 -12
  27. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +52 -106
  28. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +1 -6
  29. package/lib/index.d.ts +7 -11
  30. package/lib/index.js +35 -55
  31. package/lib/view/fileView/epic/deleteFileEpic.js +1 -1
  32. package/lib/view/fileView/epic/deleteFileListEpic.js +1 -1
  33. package/lib/view/fileView/epic/updateFileNameEpic.js +1 -1
  34. package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +0 -3
  35. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +4 -41
  36. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +51 -220
  37. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -5
  38. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +2 -15
  39. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +0 -40
  40. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +1 -13
  41. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +2 -28
  42. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +53 -107
  43. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +2 -7
  44. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +1 -6
  45. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +0 -19
  46. package/package.json +1 -1
  47. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +0 -21
  48. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +0 -54
  49. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +0 -50
  50. package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +0 -40
  51. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +0 -29
  52. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +0 -40
  53. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -58
  54. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -77
  55. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -14
  56. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -207
  57. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -41
  58. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +0 -7
  59. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +0 -44
  60. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.d.ts +0 -8
  61. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +0 -33
  62. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +0 -9
  63. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +0 -44
  64. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +0 -28
  65. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -62
  66. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +0 -9
  67. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -81
  68. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +0 -24
  69. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -17
  70. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +0 -29
  71. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -215
  72. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +0 -154
  73. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -46
@@ -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, CompanyOfficerLocalData, SetupViewLocalData, SetupViewState } from './setupViewState';
5
+ import { CompanyDetailsLocalData, 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,32 +29,6 @@ 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">, 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>;
32
+ }, "setupView/saveIndustryAndIncDateInLocalStore">, clearSetupViewDataInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupViewDataInLocalStore">, clearSetupView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupView">;
59
33
  declare const _default: import("redux").Reducer<SetupViewState>;
60
34
  export default _default;
@@ -1,34 +1,66 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
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;
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;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
- const kycKybAutofillActions_1 = require("./kycKybAutofillActions");
7
6
  const initialFetchStatus = {
8
7
  fetchState: 'Not-Started',
9
8
  error: undefined,
10
9
  };
11
- const emptyOfficerSlot = {
12
- autoFilledFields: [],
13
- localData: undefined,
14
- sendOtpStatus: initialFetchStatus,
15
- otpverificationStatus: initialFetchStatus,
16
- };
17
10
  exports.initialState = {
18
11
  updateStatus: { fetchState: 'Not-Started', error: undefined },
19
- parsingDocumentFileIds: [],
20
- companyDetails: { autoFilledFields: [] },
12
+ companyDetails: {},
21
13
  companyOfficerUpdateStatus: {
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 },
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
+ },
32
64
  },
33
65
  primaryContactDetails: {},
34
66
  };
@@ -269,93 +301,7 @@ const setupView = (0, toolkit_1.createSlice)({
269
301
  clearSetupView(draft) {
270
302
  Object.assign(draft, exports.initialState);
271
303
  },
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
- });
358
304
  },
359
305
  });
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;
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;
361
307
  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, SetupViewState, SetupViewType } from './setupViewState';
19
+ import { CompanyAndIdentityDetails, CompanyOfficerLocalData, PrimaryContactLocalData, SetupViewType } from './setupViewState';
20
20
  export interface SetupView {
21
21
  accountFetchStatus: FetchStateAndError;
22
22
  accountUpdateStatus: FetchStateAndError;
@@ -54,8 +54,6 @@ 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[];
59
57
  deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
60
58
  otpverificationStatus: FetchStateAndError;
61
59
  sendOtpStatus: FetchStateAndError;
@@ -64,8 +62,6 @@ export interface CompanyOfficersDetails extends CompanyOfficerLocalData {
64
62
  addressStatus?: NewAddressData;
65
63
  }
66
64
  export interface CompanyDetails {
67
- /** Field names in companyDetails localData populated by AI doc autofill. */
68
- autoFilledFields: string[];
69
65
  companyFiles: File[];
70
66
  companyId: ID;
71
67
  deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
@@ -100,7 +96,6 @@ export interface CompanyDetails {
100
96
  }
101
97
  interface CompanyAndOfficerLocalData {
102
98
  companyOfficerLocalData: Record<CompanyOfficerType, CompanyOfficersDetails | undefined>;
103
- parsingDocumentFileIds: ID[];
104
99
  companyDetailsLocalData?: CompanyDetails;
105
100
  }
106
101
  export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData {
@@ -110,7 +105,7 @@ export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData
110
105
  }
111
106
  export declare function getCommonSetupViewDetails(state: RootState, companyId: ID, setupViewType: SetupViewType, plaidAccountKeyType: PlaidAccountKeyType): SetupView;
112
107
  export declare function getBusinessVerificationDetails(state: RootState, companyId: ID): BusinessVerificationDetails;
113
- export declare const getCompanyAndIdentityDetails: (state: RootState, companyId: ID, companyAndIdentityDetails: CompanyAndIdentityDetails & Pick<SetupViewState, "parsingDocumentFileIds">) => CompanyAndOfficerLocalData;
108
+ export declare const getCompanyAndIdentityDetails: (state: RootState, companyId: ID, companyAndIdentityDetails: CompanyAndIdentityDetails) => CompanyAndOfficerLocalData;
114
109
  export declare const getAllFundingAccounts: (depositAccounts: DepositAccount[], paymentAccounts: PaymentAccount[], paymentAccountBalanceFetchStatus: Record<ID, FetchStateAndError>, includeOnlyVerifiedAccounts?: boolean) => FundingAccount[];
115
110
  export declare const mapDepositAccToFundingAccount: (depositAcc: DepositAccount) => FundingAccount;
116
111
  export declare const mapDepositAccountWithLimitToFundingAccount: (depositAcc: DepositAccountWithLimit) => FundingAccount;
@@ -92,17 +92,15 @@ function getBusinessVerificationDetails(state, companyId) {
92
92
  const { setupViewState, countryListState } = state;
93
93
  const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, updateStatus, } = setupViewState;
94
94
  const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
95
- const { companyDetailsLocalData, companyOfficerLocalData, parsingDocumentFileIds, } = (0, exports.getCompanyAndIdentityDetails)(state, companyId, {
95
+ const { companyDetailsLocalData, companyOfficerLocalData } = (0, exports.getCompanyAndIdentityDetails)(state, companyId, {
96
96
  companyDetails,
97
97
  companyOfficerUpdateStatus,
98
98
  primaryContactDetails,
99
- parsingDocumentFileIds: setupViewState.parsingDocumentFileIds,
100
99
  });
101
100
  const allNationalityCountries = countryListState.byCountryListCode.nationalityCountryList.countries;
102
101
  return {
103
102
  companyDetailsLocalData,
104
103
  companyOfficerLocalData,
105
- parsingDocumentFileIds,
106
104
  companyView,
107
105
  updateStatus,
108
106
  allNationalityCountries,
@@ -126,7 +124,6 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
126
124
  const companyAddress = addressViewState.newAddressState?.company_address;
127
125
  const registeredCompanyAddress = addressViewState.newAddressState?.company_registered_address;
128
126
  companyDetailsLocalData = {
129
- autoFilledFields: companyDetails.autoFilledFields,
130
127
  companyId,
131
128
  companyDescription,
132
129
  companyLegalName,
@@ -199,7 +196,6 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
199
196
  const companyOfficerAddress = addressViewState.newAddressState?.[addressType];
200
197
  companyOfficerLocalData[officerType] = {
201
198
  ...companyOfficer.localData,
202
- autoFilledFields: companyOfficer.autoFilledFields,
203
199
  userFiles: (0, fileSelector_1.getFilesByFileIds)(fileState, fileIds),
204
200
  additionalFiles: (0, fileSelector_1.getFilesByFileIds)(fileState, additionalSubmittedDocumentsForVerificationFileIds),
205
201
  deleteFileStatusById,
@@ -213,7 +209,6 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
213
209
  return {
214
210
  companyDetailsLocalData,
215
211
  companyOfficerLocalData,
216
- parsingDocumentFileIds: companyAndIdentityDetails.parsingDocumentFileIds,
217
212
  };
218
213
  };
219
214
  exports.getCompanyAndIdentityDetails = getCompanyAndIdentityDetails;
@@ -81,21 +81,9 @@ 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[];
90
84
  localData?: CompanyDetailsLocalData;
91
85
  };
92
86
  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[];
99
87
  otpverificationStatus: FetchStateAndError;
100
88
  sendOtpStatus: FetchStateAndError;
101
89
  localData?: CompanyOfficerLocalData;
@@ -105,13 +93,6 @@ export interface CompanyAndIdentityDetails {
105
93
  };
106
94
  }
107
95
  export interface SetupViewState extends CompanyAndIdentityDetails {
108
- /**
109
- * File IDs currently being parsed by the AI autofill epic. Populated when
110
- * `parseUploadedKyc/KybDocument` dispatches and cleared when the
111
- * corresponding apply / failure action fires. Drives the "AI is reading
112
- * your document" overlay on the document upload field.
113
- */
114
- parsingDocumentFileIds: ID[];
115
96
  updateStatus: FetchStateAndError;
116
97
  }
117
98
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.1-beta0ND",
3
+ "version": "5.1.1",
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",
@@ -1,21 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { RootState } from '../../../reducer';
3
- import { ZeniAPI } from '../../../zeniAPI';
4
- import { initEmailConnectOAuth, initEmailConnectOAuthFailure, initEmailConnectOAuthSuccess } from '../tenantReducer';
5
- export type ActionType = ReturnType<typeof initEmailConnectOAuth> | ReturnType<typeof initEmailConnectOAuthSuccess> | ReturnType<typeof initEmailConnectOAuthFailure>;
6
- export type NavigateFn = (url: string) => void;
7
- export declare const initEmailConnectOAuthEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI, navigate?: NavigateFn) => import("rxjs").Observable<{
8
- payload: {
9
- tenantId: string;
10
- provider: "gmail" | "outlook";
11
- authorizationUrl: string;
12
- };
13
- type: "tenant/initEmailConnectOAuthSuccess";
14
- } | {
15
- payload: {
16
- tenantId: string;
17
- provider: "gmail" | "outlook";
18
- status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
19
- };
20
- type: "tenant/initEmailConnectOAuthFailure";
21
- }>;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initEmailConnectOAuthEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../responsePayload");
7
- const tenantReducer_1 = require("../tenantReducer");
8
- const defaultNavigate = (url) => {
9
- // Production path: full-page redirect. The user's session continues on the
10
- // provider's consent screen and lands back on this app via auth's HTML
11
- // callback page (which itself redirects to redirect_after_url with the
12
- // result encoded as a query param).
13
- if (typeof window !== 'undefined') {
14
- window.location.href = url;
15
- }
16
- };
17
- // Backs the new POST /1.0/connectors/email/<provider>/init endpoint on the
18
- // auth service. The endpoint creates a CSRF state token in the auth NDB
19
- // store and returns the provider's authorization_url; this epic then drives
20
- // a full-page redirect so the user lands on Google's / Microsoft's consent
21
- // screen. After consent the user lands on auth's callback, which writes the
22
- // resulting tokens through to tenant and redirects the browser back to
23
- // ``redirectAfterUrl`` with ``?email_connect_result=<json>`` for the
24
- // integrations page to consume on mount.
25
- const initEmailConnectOAuthEpic = (actions$, _state$, zeniAPI,
26
- // Test seam: callers can override to assert intended URL without actually
27
- // navigating. Default is full-page redirect via window.location.
28
- navigate = defaultNavigate) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.initEmailConnectOAuth.match), (0, operators_1.switchMap)((action) => zeniAPI
29
- .postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/connectors/email/${action.payload.provider}/init`, { redirect_after_url: action.payload.redirectAfterUrl }, { 'zeni-tenant-id': action.payload.tenantId })
30
- .pipe((0, operators_1.mergeMap)((response) => {
31
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
32
- // Fire-and-forget side effect — once the browser navigates,
33
- // any further state we'd dispatch here is irrelevant. We still
34
- // emit the success action so subscribers (tests, analytics)
35
- // can observe the URL the epic decided to navigate to.
36
- navigate(response.data.authorization_url);
37
- return (0, rxjs_1.from)([
38
- (0, tenantReducer_1.initEmailConnectOAuthSuccess)(action.payload.tenantId, action.payload.provider, response.data.authorization_url),
39
- ]);
40
- }
41
- const status = response.status ??
42
- (0, responsePayload_1.createZeniAPIStatus)(`Failed to start ${action.payload.provider} connection. Please try again.`);
43
- return (0, rxjs_1.from)([
44
- (0, tenantReducer_1.initEmailConnectOAuthFailure)(action.payload.tenantId, action.payload.provider, status),
45
- ]);
46
- }), (0, operators_1.catchError)((error) => {
47
- const message = error instanceof Error
48
- ? error.message
49
- : `Unexpected error starting ${action.payload.provider} connection.`;
50
- return (0, rxjs_1.from)([
51
- (0, tenantReducer_1.initEmailConnectOAuthFailure)(action.payload.tenantId, action.payload.provider, (0, responsePayload_1.createZeniAPIStatus)(message)),
52
- ]);
53
- }))));
54
- exports.initEmailConnectOAuthEpic = initEmailConnectOAuthEpic;
@@ -1,50 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
4
- import { initEmailConnectOAuth, initEmailConnectOAuthFailure, initEmailConnectOAuthSuccess, } from '../tenantReducer';
5
- const defaultNavigate = (url) => {
6
- // Production path: full-page redirect. The user's session continues on the
7
- // provider's consent screen and lands back on this app via auth's HTML
8
- // callback page (which itself redirects to redirect_after_url with the
9
- // result encoded as a query param).
10
- if (typeof window !== 'undefined') {
11
- window.location.href = url;
12
- }
13
- };
14
- // Backs the new POST /1.0/connectors/email/<provider>/init endpoint on the
15
- // auth service. The endpoint creates a CSRF state token in the auth NDB
16
- // store and returns the provider's authorization_url; this epic then drives
17
- // a full-page redirect so the user lands on Google's / Microsoft's consent
18
- // screen. After consent the user lands on auth's callback, which writes the
19
- // resulting tokens through to tenant and redirects the browser back to
20
- // ``redirectAfterUrl`` with ``?email_connect_result=<json>`` for the
21
- // integrations page to consume on mount.
22
- export const initEmailConnectOAuthEpic = (actions$, _state$, zeniAPI,
23
- // Test seam: callers can override to assert intended URL without actually
24
- // navigating. Default is full-page redirect via window.location.
25
- navigate = defaultNavigate) => actions$.pipe(filter(initEmailConnectOAuth.match), switchMap((action) => zeniAPI
26
- .postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/connectors/email/${action.payload.provider}/init`, { redirect_after_url: action.payload.redirectAfterUrl }, { 'zeni-tenant-id': action.payload.tenantId })
27
- .pipe(mergeMap((response) => {
28
- if (isSuccessResponse(response) && response.data != null) {
29
- // Fire-and-forget side effect — once the browser navigates,
30
- // any further state we'd dispatch here is irrelevant. We still
31
- // emit the success action so subscribers (tests, analytics)
32
- // can observe the URL the epic decided to navigate to.
33
- navigate(response.data.authorization_url);
34
- return from([
35
- initEmailConnectOAuthSuccess(action.payload.tenantId, action.payload.provider, response.data.authorization_url),
36
- ]);
37
- }
38
- const status = response.status ??
39
- createZeniAPIStatus(`Failed to start ${action.payload.provider} connection. Please try again.`);
40
- return from([
41
- initEmailConnectOAuthFailure(action.payload.tenantId, action.payload.provider, status),
42
- ]);
43
- }), catchError((error) => {
44
- const message = error instanceof Error
45
- ? error.message
46
- : `Unexpected error starting ${action.payload.provider} connection.`;
47
- return from([
48
- initEmailConnectOAuthFailure(action.payload.tenantId, action.payload.provider, createZeniAPIStatus(message)),
49
- ]);
50
- }))));
@@ -1,40 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
4
- import { fetchAiAgentsActivationStatus, fetchAiAgentsActivationStatusFailure, fetchAiAgentsActivationStatusSuccess, } from '../../onboardingCustomerViewReducer';
5
- const toPhaseStatus = (raw) => {
6
- if (raw === 'idle' ||
7
- raw === 'starting' ||
8
- raw === 'building' ||
9
- raw === 'ready') {
10
- return raw;
11
- }
12
- return 'idle';
13
- };
14
- const toPhase = (row) => ({
15
- key: row.key,
16
- status: toPhaseStatus(row.status),
17
- startedAt: row.started_at,
18
- completedAt: row.completed_at,
19
- });
20
- const toCounts = (payload) => ({
21
- customerCount: payload?.customer_count ?? 0,
22
- glAccountCount: payload?.gl_account_count ?? 0,
23
- targetTransactionCount: payload?.target_transaction_count ?? 0,
24
- transactionCount: payload?.transaction_count ?? 0,
25
- vendorCount: payload?.vendor_count ?? 0,
26
- });
27
- export const fetchAiAgentsActivationStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchAiAgentsActivationStatus.match), mergeMap(() => {
28
- const url = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/ai-agents-activation/status`;
29
- return zeniAPI.getJSON(url).pipe(mergeMap((response) => {
30
- if (isSuccessResponse(response) && response.data != null) {
31
- const phases = (response.data.phases ?? []).map(toPhase);
32
- return of(fetchAiAgentsActivationStatusSuccess({
33
- phases,
34
- counts: toCounts(response.data.counts),
35
- }));
36
- }
37
- return of(fetchAiAgentsActivationStatusFailure(response.status));
38
- }), catchError((error) => of(fetchAiAgentsActivationStatusFailure(createZeniAPIStatus('Unexpected Error', 'fetchAiAgentsActivationStatus errored out ' +
39
- JSON.stringify(error))))));
40
- }));
@@ -1,29 +0,0 @@
1
- import { from, of } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { updateCompanies } from '../../../../../entity/company/companyReducer';
4
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
5
- import { acknowledgeOnboardingAiActivationViewed, acknowledgeOnboardingAiActivationViewedFailure, acknowledgeOnboardingAiActivationViewedSuccess, } from '../../onboardingCustomerViewReducer';
6
- export const acknowledgeOnboardingAiActivationViewedEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(acknowledgeOnboardingAiActivationViewed.match), mergeMap((action) => {
7
- const { companyId } = action.payload;
8
- const payload = {
9
- is_onboarding_ai_activation_viewed: true,
10
- };
11
- return zeniAPI
12
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, payload)
13
- .pipe(mergeMap((response) => {
14
- if (isSuccessResponse(response) && response.data != null) {
15
- const actions = [
16
- updateCompanies({
17
- payload: response.data.companies,
18
- schema: {},
19
- }),
20
- acknowledgeOnboardingAiActivationViewedSuccess(),
21
- ];
22
- return from(actions);
23
- }
24
- return of(acknowledgeOnboardingAiActivationViewedFailure(response.status));
25
- }),
26
- // Best-effort — failure is silent; cascade just runs again next visit.
27
- catchError((error) => of(acknowledgeOnboardingAiActivationViewedFailure(createZeniAPIStatus('Unexpected Error', 'Acknowledge - Onboarding AI Activation Viewed errored out' +
28
- JSON.stringify(error))))));
29
- }));
@@ -1,40 +0,0 @@
1
- import { from, of } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { updateCompanies } from '../../../../../entity/company/companyReducer';
4
- import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
5
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
6
- import { acknowledgeOnboardingAiFinanceTeam, acknowledgeOnboardingAiFinanceTeamFailure, acknowledgeOnboardingAiFinanceTeamSuccess, } from '../../onboardingCustomerViewReducer';
7
- export const acknowledgeOnboardingAiFinanceTeamEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(acknowledgeOnboardingAiFinanceTeam.match), mergeMap((action) => {
8
- const { companyId } = action.payload;
9
- const payload = {
10
- is_onboarding_ai_finance_team_acknowledged: true,
11
- };
12
- return zeniAPI
13
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, payload)
14
- .pipe(mergeMap((response) => {
15
- if (isSuccessResponse(response) && response.data != null) {
16
- const actions = [
17
- updateCompanies({
18
- payload: response.data.companies,
19
- schema: {},
20
- }),
21
- acknowledgeOnboardingAiFinanceTeamSuccess(),
22
- ];
23
- return from(actions);
24
- }
25
- else {
26
- return of(openSnackbar({
27
- messageSection: 'onboarding_customer_view_complete',
28
- messageText: 'failed',
29
- type: 'error',
30
- variables: [
31
- {
32
- variableName: '_api-error_',
33
- variableValue: response.status.message,
34
- },
35
- ],
36
- }), acknowledgeOnboardingAiFinanceTeamFailure(response.status));
37
- }
38
- }), catchError((error) => of(acknowledgeOnboardingAiFinanceTeamFailure(createZeniAPIStatus('Unexpected Error', 'Acknowledge - Onboarding AI Finance Team errored out' +
39
- JSON.stringify(error))))));
40
- }));