@zeniai/client-epic-state 5.0.92-beta0ND → 5.0.92-betaNB2

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 (107) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/commonStateTypes/animations.js +0 -1
  3. package/lib/commonStateTypes/viewAndReport/agingReportStateTypes.d.ts +1 -1
  4. package/lib/entity/accountRecon/accountReconPayload.d.ts +20 -1
  5. package/lib/entity/accountRecon/accountReconPayload.js +23 -1
  6. package/lib/entity/accountRecon/accountReconSelector.d.ts +6 -1
  7. package/lib/entity/accountRecon/accountReconSelector.js +5 -0
  8. package/lib/entity/accountRecon/accountReconState.d.ts +19 -0
  9. package/lib/entity/company/companyPayload.d.ts +0 -4
  10. package/lib/entity/company/companyPayload.js +0 -4
  11. package/lib/entity/company/companyStateTypes.d.ts +0 -4
  12. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.d.ts +7 -0
  13. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +9 -0
  14. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +7 -0
  15. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +0 -1
  16. package/lib/entity/paymentAccount/paymentAccountSelector.js +0 -4
  17. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  18. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  19. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  20. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  21. package/lib/entity/tenant/tenantPayload.d.ts +0 -1
  22. package/lib/entity/tenant/tenantReducer.d.ts +25 -38
  23. package/lib/entity/tenant/tenantReducer.js +5 -65
  24. package/lib/entity/tenant/tenantState.d.ts +0 -1
  25. package/lib/epic.d.ts +3 -6
  26. package/lib/epic.js +3 -7
  27. package/lib/esm/commonStateTypes/animations.js +0 -1
  28. package/lib/esm/entity/accountRecon/accountReconPayload.js +23 -1
  29. package/lib/esm/entity/accountRecon/accountReconSelector.js +5 -0
  30. package/lib/esm/entity/company/companyPayload.js +0 -4
  31. package/lib/esm/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +9 -0
  32. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +0 -3
  33. package/lib/esm/entity/tenant/tenantReducer.js +3 -63
  34. package/lib/esm/epic.js +3 -7
  35. package/lib/esm/index.js +8 -11
  36. package/lib/esm/view/expenseAutomationView/epics/accountRecon/parseStatementEpic.js +34 -0
  37. package/lib/esm/view/expenseAutomationView/epics/accountRecon/updateStatementInfoEpic.js +42 -0
  38. package/lib/esm/view/expenseAutomationView/payload/reconciliationPayload.js +73 -0
  39. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +98 -4
  40. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +20 -0
  41. package/lib/esm/view/expenseAutomationView/types/reconciliationViewState.js +20 -0
  42. package/lib/esm/view/fileView/epic/deleteFileEpic.js +2 -2
  43. package/lib/esm/view/fileView/epic/deleteFileListEpic.js +2 -2
  44. package/lib/esm/view/fileView/epic/updateFileNameEpic.js +2 -2
  45. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +50 -217
  46. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +1 -7
  47. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +0 -12
  48. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +52 -105
  49. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +1 -6
  50. package/lib/index.d.ts +12 -16
  51. package/lib/index.js +37 -49
  52. package/lib/view/expenseAutomationView/epics/accountRecon/parseStatementEpic.d.ts +6 -0
  53. package/lib/view/expenseAutomationView/epics/accountRecon/parseStatementEpic.js +38 -0
  54. package/lib/view/expenseAutomationView/epics/accountRecon/updateStatementInfoEpic.d.ts +19 -0
  55. package/lib/view/expenseAutomationView/epics/accountRecon/updateStatementInfoEpic.js +46 -0
  56. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +83 -1
  57. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +75 -0
  58. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +35 -3
  59. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +99 -5
  60. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +5 -1
  61. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +20 -0
  62. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +128 -0
  63. package/lib/view/expenseAutomationView/types/reconciliationViewState.js +21 -0
  64. package/lib/view/fileView/epic/deleteFileEpic.js +1 -1
  65. package/lib/view/fileView/epic/deleteFileListEpic.js +1 -1
  66. package/lib/view/fileView/epic/updateFileNameEpic.js +1 -1
  67. package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +0 -3
  68. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +4 -41
  69. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +51 -219
  70. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -5
  71. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +2 -11
  72. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +0 -40
  73. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +1 -13
  74. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +2 -28
  75. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +53 -106
  76. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +2 -7
  77. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +1 -6
  78. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +0 -19
  79. package/lib/view/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListState.d.ts +1 -1
  80. package/package.json +1 -1
  81. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +0 -21
  82. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +0 -54
  83. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +0 -50
  84. package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +0 -42
  85. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +0 -29
  86. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +0 -40
  87. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -52
  88. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -59
  89. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -14
  90. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -205
  91. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -28
  92. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +0 -7
  93. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +0 -46
  94. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.d.ts +0 -8
  95. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +0 -33
  96. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +0 -9
  97. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +0 -44
  98. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +0 -28
  99. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -56
  100. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +0 -30
  101. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -63
  102. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +0 -33
  103. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -17
  104. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +0 -24
  105. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -213
  106. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +0 -125
  107. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -32
@@ -15,7 +15,7 @@ import { CompanyView } from '../../companyView/types/companyView';
15
15
  import { CompanyDetails, CompanyOfficersDetails } from '../../spendManagement/commonSetup/setupViewSelector';
16
16
  import { CompanyOfficerLocalData } from '../../spendManagement/commonSetup/setupViewState';
17
17
  import { PlaidConnectionDetails } from '../../spendManagement/plaidAccount/plaidAccountViewState';
18
- import { AiAgentsActivationCounts, AiAgentsActivationPhase, AiAgentsActivationSubview, OnboardingCustomerViewUIState, OnboardingStep } from './onboardingCustomerViewState';
18
+ import { OnboardingCustomerViewUIState, OnboardingStep } from './onboardingCustomerViewState';
19
19
  export interface OnboardingCustomerView {
20
20
  allNationalityCountries: Country[];
21
21
  allRequiredStepsCompleted: boolean;
@@ -28,7 +28,6 @@ export interface OnboardingCustomerView {
28
28
  fetchStatus: FetchStateAndError;
29
29
  halfCompletedSteps: OnboardingStep[];
30
30
  isInterimEmailSent: boolean;
31
- parsingDocumentFileIds: ID[];
32
31
  paymentAccountFetchStatus: FetchStateAndError;
33
32
  paymentAccountUpdateStatus: FetchStateAndError;
34
33
  pendingSaveDetails: {
@@ -56,6 +55,3 @@ export declare const onboardingStepsData: (isValidConnection: boolean, productSe
56
55
  };
57
56
  export declare function isCompanyDetailsSavePending(fileState: FileState, company?: CompanyView, primaryContact?: User, companyDetailsLocalData?: CompanyDetails): boolean;
58
57
  export declare const getProductSettingsString: (productSettings: TenantProductSettings | undefined) => string;
59
- export declare const getAiAgentsActivationSubview: (state: RootState) => AiAgentsActivationSubview;
60
- export declare const getAiAgentsActivationPhases: (state: RootState) => AiAgentsActivationPhase[];
61
- export declare const getAiAgentsActivationCounts: (state: RootState) => AiAgentsActivationCounts;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAiAgentsActivationCounts = exports.getAiAgentsActivationPhases = exports.getAiAgentsActivationSubview = exports.getProductSettingsString = exports.onboardingStepsData = void 0;
3
+ exports.getProductSettingsString = exports.onboardingStepsData = void 0;
4
4
  exports.getOnboardingCustomerView = getOnboardingCustomerView;
5
5
  exports.isOfficerDetailsCompleted = isOfficerDetailsCompleted;
6
6
  exports.isCompanyDetailsSavePending = isCompanyDetailsSavePending;
@@ -17,7 +17,7 @@ const setupViewSelector_1 = require("../../spendManagement/commonSetup/setupView
17
17
  const onboardingCustomerViewState_1 = require("./onboardingCustomerViewState");
18
18
  function getOnboardingCustomerView(state, companyId) {
19
19
  const { fileState, paymentAccountState, onboardingCustomerViewState, userState, userRoleState, subscriptionPaymentAccountState, companyConfigState, cardPaymentViewState, countryListState, addressViewState, } = state;
20
- const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, subscriptionPaymentAccountIds, paymentAccountDetails, plaidConnectionDetails, parsingDocumentFileIds, updateStatus, saveStatus, currentStep, uiState, fetchState, error, } = onboardingCustomerViewState;
20
+ const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, subscriptionPaymentAccountIds, paymentAccountDetails, plaidConnectionDetails, updateStatus, saveStatus, currentStep, uiState, fetchState, error, } = onboardingCustomerViewState;
21
21
  const { paymentAccountIds } = paymentAccountDetails;
22
22
  let subscriptionPaymentAccount;
23
23
  let paymentAccount;
@@ -60,7 +60,6 @@ function getOnboardingCustomerView(state, companyId) {
60
60
  companyDetails,
61
61
  companyOfficerUpdateStatus,
62
62
  primaryContactDetails,
63
- parsingDocumentFileIds,
64
63
  });
65
64
  const companyAddress = addressViewState.newAddressState?.company_address;
66
65
  if (companyAddress == null &&
@@ -126,7 +125,6 @@ function getOnboardingCustomerView(state, companyId) {
126
125
  return {
127
126
  companyDetailsLocalData,
128
127
  companyOfficerLocalData,
129
- parsingDocumentFileIds,
130
128
  subscriptionBillingAddress: subscriptionBillingAddress?.addressToCreate,
131
129
  companyView,
132
130
  allNationalityCountries,
@@ -333,10 +331,3 @@ const getProductSettingsString = (productSettings) => {
333
331
  .join(',');
334
332
  };
335
333
  exports.getProductSettingsString = getProductSettingsString;
336
- const fromActivationView = (state) => state.onboardingCustomerViewState.aiAgentsActivation;
337
- const getAiAgentsActivationSubview = (state) => fromActivationView(state);
338
- exports.getAiAgentsActivationSubview = getAiAgentsActivationSubview;
339
- const getAiAgentsActivationPhases = (state) => fromActivationView(state).phases;
340
- exports.getAiAgentsActivationPhases = getAiAgentsActivationPhases;
341
- const getAiAgentsActivationCounts = (state) => fromActivationView(state).counts;
342
- exports.getAiAgentsActivationCounts = getAiAgentsActivationCounts;
@@ -21,32 +21,16 @@ export interface OnboardingCustomerViewUIState {
21
21
  isQBOPopupOpen: boolean;
22
22
  }
23
23
  export interface OnboardingCustomerViewState extends FetchedState {
24
- aiAgentsActivation: AiAgentsActivationSubview;
25
24
  companyDetails: {
26
- /**
27
- * Field names from {@link CompanyDetailsLocalData} populated by AI autofill
28
- * from an uploaded KYB document during onboarding. Drives the ✦ sparkle.
29
- */
30
- autoFilledFields: string[];
31
25
  localData?: CompanyDetailsLocalData;
32
26
  };
33
27
  companyOfficerUpdateStatus: Record<CompanyOfficerType, {
34
- /**
35
- * Field names from {@link CompanyOfficerLocalData} populated by AI autofill
36
- * from an uploaded KYC identity document during onboarding.
37
- */
38
- autoFilledFields: string[];
39
28
  otpverificationStatus: FetchStateAndError;
40
29
  sendOtpStatus: FetchStateAndError;
41
30
  localData?: CompanyOfficerLocalData;
42
31
  }>;
43
32
  currentStep: OnboardingStep;
44
33
  dashboardLoadedStatus: FetchStateAndError;
45
- /**
46
- * File IDs currently being parsed by the AI autofill epic for onboarding.
47
- * Drives the "AI is reading your document" overlay on the upload field.
48
- */
49
- parsingDocumentFileIds: ID[];
50
34
  paymentAccountDetails: {
51
35
  fetchStatus: FetchStateAndError;
52
36
  paymentAccountIds: ID[];
@@ -60,29 +44,5 @@ export interface OnboardingCustomerViewState extends FetchedState {
60
44
  subscriptionPaymentAccountIds: ID[];
61
45
  uiState: OnboardingCustomerViewUIState;
62
46
  updateStatus: FetchStateAndError;
63
- aiActivationViewedAcknowledgementStatus?: FetchStateAndError;
64
- aiFinanceTeamAcknowledgementStatus?: FetchStateAndError;
65
47
  subscriptionBillingAddress?: Address;
66
48
  }
67
- export type AiAgentsActivationPhaseStatus = 'idle' | 'starting' | 'building' | 'ready';
68
- export interface AiAgentsActivationPhase {
69
- key: string;
70
- status: AiAgentsActivationPhaseStatus;
71
- completedAt?: string;
72
- startedAt?: string;
73
- }
74
- export interface AiAgentsActivationCounts {
75
- customerCount: number;
76
- glAccountCount: number;
77
- targetTransactionCount: number;
78
- transactionCount: number;
79
- vendorCount: number;
80
- asOf?: string;
81
- }
82
- export interface AiAgentsActivationSubview {
83
- counts: AiAgentsActivationCounts;
84
- fetchStatus: FetchStateAndError;
85
- phases: AiAgentsActivationPhase[];
86
- }
87
- export declare const emptyAiAgentsActivationCounts: AiAgentsActivationCounts;
88
- export declare const emptyAiAgentsActivationSubview: AiAgentsActivationSubview;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emptyAiAgentsActivationSubview = exports.emptyAiAgentsActivationCounts = exports.toOnboardingStepType = exports.ALL_ONBOARDING_STEPS = exports.ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO = exports.ALL_ZENI_USER_ONBOARDING_STEPS = exports.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT = exports.REQUIRED_ONBOARDING_STEPS = exports.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO = exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS = void 0;
3
+ exports.toOnboardingStepType = exports.ALL_ONBOARDING_STEPS = exports.ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO = exports.ALL_ZENI_USER_ONBOARDING_STEPS = exports.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT = exports.REQUIRED_ONBOARDING_STEPS = exports.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO = exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS = void 0;
4
4
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
5
  exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS = [
6
6
  'link_payment_account',
@@ -30,15 +30,3 @@ exports.ALL_ONBOARDING_STEPS = [
30
30
  ];
31
31
  const toOnboardingStepType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_ONBOARDING_STEPS);
32
32
  exports.toOnboardingStepType = toOnboardingStepType;
33
- exports.emptyAiAgentsActivationCounts = {
34
- customerCount: 0,
35
- glAccountCount: 0,
36
- targetTransactionCount: 0,
37
- transactionCount: 0,
38
- vendorCount: 0,
39
- };
40
- exports.emptyAiAgentsActivationSubview = {
41
- counts: exports.emptyAiAgentsActivationCounts,
42
- fetchStatus: { fetchState: 'Not-Started', error: undefined },
43
- phases: [],
44
- };
@@ -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,92 +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
- if (!draft.parsingDocumentFileIds.includes(fileId)) {
331
- draft.parsingDocumentFileIds.push(fileId);
332
- }
333
- };
334
- const removeParsingFileId = (draft, fileId) => {
335
- draft.parsingDocumentFileIds = draft.parsingDocumentFileIds.filter((id) => id !== fileId);
336
- };
337
- builder.addCase(kycKybAutofillActions_1.parseUploadedKycDocument, (draft, action) => {
338
- if (action.payload.target === 'setup') {
339
- addParsingFileId(draft, action.payload.fileId);
340
- }
341
- });
342
- builder.addCase(kycKybAutofillActions_1.parseUploadedKybDocument, (draft, action) => {
343
- if (action.payload.target === 'setup') {
344
- addParsingFileId(draft, action.payload.fileId);
345
- }
346
- });
347
- builder.addCase(kycKybAutofillActions_1.parseUploadedKycDocumentFailure, (draft, action) => {
348
- if (action.payload.target === 'setup') {
349
- removeParsingFileId(draft, action.payload.fileId);
350
- }
351
- });
352
- builder.addCase(kycKybAutofillActions_1.parseUploadedKybDocumentFailure, (draft, action) => {
353
- if (action.payload.target === 'setup') {
354
- removeParsingFileId(draft, action.payload.fileId);
355
- }
356
- });
357
304
  },
358
305
  });
359
- _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;
360
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 {};
@@ -20,7 +20,7 @@ export interface VendorFiling1099ListQuery {
20
20
  sortKey: VendorFiling1099ListViewSortKey;
21
21
  sortOrder: SortOrder;
22
22
  }
23
- declare const toVendorFiling1099ListViewSortKey: (v: string) => "status" | "w9" | "legal_name" | "total" | "tax_classification" | "filing1099type";
23
+ declare const toVendorFiling1099ListViewSortKey: (v: string) => "status" | "w9" | "total" | "legal_name" | "tax_classification" | "filing1099type";
24
24
  export type VendorFiling1099ListViewSortKey = ReturnType<typeof toVendorFiling1099ListViewSortKey>;
25
25
  export type Type1099Download = 'nec' | 'misc' | 'int';
26
26
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.92-beta0ND",
3
+ "version": "5.0.92-betaNB2",
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;