@zeniai/client-epic-state 4.12.92 → 4.12.93

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 (80) hide show
  1. package/lib/commonPayloadTypes/commonPayload.d.ts +7 -0
  2. package/lib/entity/company/companyPayload.d.ts +4 -0
  3. package/lib/entity/company/companyPayload.js +8 -3
  4. package/lib/entity/company/companyReducer.d.ts +4 -1
  5. package/lib/entity/company/companyReducer.js +6 -2
  6. package/lib/entity/company/companyStateTypes.d.ts +4 -0
  7. package/lib/entity/file/fileState.d.ts +3 -3
  8. package/lib/entity/file/fileState.js +2 -0
  9. package/lib/entity/tenant/clearAllEpic.d.ts +3 -1
  10. package/lib/entity/tenant/clearAllEpic.js +4 -0
  11. package/lib/entity/user/userPayload.d.ts +1 -0
  12. package/lib/entity/user/userReducer.js +9 -8
  13. package/lib/entity/user/userState.d.ts +1 -0
  14. package/lib/epic.d.ts +6 -1
  15. package/lib/epic.js +6 -1
  16. package/lib/index.d.ts +12 -5
  17. package/lib/index.js +15 -6
  18. package/lib/reducer.d.ts +6 -0
  19. package/lib/reducer.js +6 -0
  20. package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +7 -1
  21. package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +7 -1
  22. package/lib/view/addressView/addressViewState.d.ts +1 -1
  23. package/lib/view/addressView/toAddressViewLocalData.js +5 -0
  24. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +1 -1
  25. package/lib/view/companyView/epic/companyPassport/updateCompanyPassportLocalStoreDataEpic.js +1 -6
  26. package/lib/view/companyView/selectorHelpers/getCompanyView.js +4 -0
  27. package/lib/view/companyView/types/companyPassport/companyUsersLocalData.d.ts +2 -0
  28. package/lib/view/companyView/types/companyPassport/companyUsersLocalData.js +7 -1
  29. package/lib/view/companyView/types/companyView.d.ts +1 -0
  30. package/lib/view/countryList/countryListReducer.d.ts +17 -0
  31. package/lib/view/countryList/countryListReducer.js +58 -0
  32. package/lib/view/countryList/countryListSelector.d.ts +7 -0
  33. package/lib/view/countryList/countryListSelector.js +13 -0
  34. package/lib/view/countryList/countryListState.d.ts +12 -0
  35. package/lib/view/countryList/countryListState.js +2 -0
  36. package/lib/view/countryList/epics/fetchCountryListEpic.d.ts +6 -0
  37. package/lib/view/countryList/epics/fetchCountryListEpic.js +19 -0
  38. package/lib/view/countryList/epics/fetchNationalityCountryListEpic.d.ts +7 -0
  39. package/lib/view/countryList/epics/fetchNationalityCountryListEpic.js +38 -0
  40. package/lib/view/countryList/payloads/countryListPayload.d.ts +6 -0
  41. package/lib/view/countryList/payloads/countryListPayload.js +10 -0
  42. package/lib/view/countryList/payloads/nationalityCountryListPayload.d.ts +11 -0
  43. package/lib/view/countryList/payloads/nationalityCountryListPayload.js +2 -0
  44. package/lib/view/onboardingView/customerView/epic/customerDetails/fetchOnboardingCustomerViewEpic.d.ts +8 -1
  45. package/lib/view/onboardingView/customerView/epic/customerDetails/fetchOnboardingCustomerViewEpic.js +3 -1
  46. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +5 -4
  47. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +2 -0
  48. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +6 -3
  49. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  50. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.d.ts +1 -4
  51. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +2 -0
  52. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +3 -0
  53. package/lib/view/spendManagement/billPay/internationalWire/internationalWireSelector.d.ts +2 -1
  54. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.d.ts +7 -0
  55. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +36 -0
  56. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.d.ts +6 -0
  57. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +28 -0
  58. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.d.ts +9 -0
  59. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +67 -0
  60. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.d.ts +26 -0
  61. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +22 -0
  62. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.d.ts +22 -0
  63. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +89 -0
  64. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.d.ts +15 -0
  65. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +30 -0
  66. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +20 -0
  67. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.js +2 -0
  68. package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.d.ts +1 -1
  69. package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +31 -6
  70. package/lib/view/spendManagement/commonSetup/epic/setup/updateSetupViewLocalStoreDataEpic.d.ts +2 -2
  71. package/lib/view/spendManagement/commonSetup/epic/setup/updateSetupViewLocalStoreDataEpic.js +5 -2
  72. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +4 -1
  73. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +6 -2
  74. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +1 -0
  75. package/lib/view/spendManagement/commonSetup/types/businessVerification.d.ts +4 -0
  76. package/package.json +1 -1
  77. package/lib/commonPayloadTypes/v2/getSumOfBalancesGroupedByPeriod.d.ts +0 -0
  78. package/lib/commonPayloadTypes/v2/getSumOfBalancesGroupedByPeriod.js +0 -1
  79. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSectionWithAcOnly.d.ts +0 -0
  80. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSectionWithAcOnly.js +0 -1
@@ -0,0 +1,6 @@
1
+ import { Country } from '../countryListState';
2
+ export interface CountryListPayload {
3
+ code: string;
4
+ description: string;
5
+ }
6
+ export declare function toCountry(payload: CountryListPayload): Country;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toCountry = void 0;
4
+ function toCountry(payload) {
5
+ return {
6
+ countryCode: payload.code,
7
+ countryName: payload.description,
8
+ };
9
+ }
10
+ exports.toCountry = toCountry;
@@ -0,0 +1,11 @@
1
+ import { ZeniAPIResponse } from '../../../responsePayload';
2
+ import { CountryListPayload } from './countryListPayload';
3
+ export interface NationalityCountryPayload {
4
+ labels: {
5
+ nationality: {
6
+ field_hint_text: string;
7
+ field_values: CountryListPayload[];
8
+ };
9
+ };
10
+ }
11
+ export declare type NationalityCountryPayloadResponse = ZeniAPIResponse<NationalityCountryPayload>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,10 +2,17 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { RootState } from '../../../../../reducer';
3
3
  import { fetchOnboardingCustomerSetupView } from '../../onboardingCustomerViewReducer';
4
4
  import { fetchCompanyConfig } from '../../../../companyConfigView/companyConfigReducer';
5
- export declare type ActionType = ReturnType<typeof fetchOnboardingCustomerSetupView> | ReturnType<typeof fetchCompanyConfig>;
5
+ import { fetchCountryList } from '../../../../countryList/countryListReducer';
6
+ export declare type ActionType = ReturnType<typeof fetchOnboardingCustomerSetupView> | ReturnType<typeof fetchCountryList> | ReturnType<typeof fetchCompanyConfig>;
6
7
  export declare const fetchOnboardingCustomerViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => import("rxjs").Observable<{
7
8
  payload: undefined;
8
9
  type: string;
10
+ } | {
11
+ payload: {
12
+ countryListKey: "nationalityCountryList";
13
+ cacheOverride: any;
14
+ };
15
+ type: string;
9
16
  } | {
10
17
  payload: {
11
18
  companyId: string;
@@ -5,14 +5,16 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
7
7
  const companyConfigReducer_1 = require("../../../../companyConfigView/companyConfigReducer");
8
+ const countryListReducer_1 = require("../../../../countryList/countryListReducer");
8
9
  const fetchOnboardingCustomerViewEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.fetchOnboardingCustomerView.match), (0, operators_1.switchMap)((action) => {
9
10
  const { companyId, cacheOverride, reCalculateCurrentStep } = action.payload;
10
11
  if (cacheOverride === true) {
11
- return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.fetchOnboardingCustomerSetupView)(companyId, cacheOverride, reCalculateCurrentStep), (0, companyConfigReducer_1.fetchCompanyConfig)());
12
+ return (0, rxjs_1.of)((0, countryListReducer_1.fetchCountryList)('nationalityCountryList', true), (0, onboardingCustomerViewReducer_1.fetchOnboardingCustomerSetupView)(companyId, cacheOverride, reCalculateCurrentStep), (0, companyConfigReducer_1.fetchCompanyConfig)());
12
13
  }
13
14
  else {
14
15
  const state = state$.value;
15
16
  const fetchActions = [];
17
+ fetchActions.push((0, countryListReducer_1.fetchCountryList)('nationalityCountryList'));
16
18
  if (state.onboardingCustomerViewState.fetchState !== 'In-Progress' &&
17
19
  !state.onboardingCustomerViewState.hasValidState()) {
18
20
  fetchActions.push((0, onboardingCustomerViewReducer_1.fetchOnboardingCustomerSetupView)(companyId, cacheOverride, reCalculateCurrentStep));
@@ -16,7 +16,7 @@ const getCompanyView_1 = require("../../../../companyView/selectorHelpers/getCom
16
16
  const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
17
17
  const updateBusinessVerificationDetailsEpic_1 = require("../../../../spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic");
18
18
  const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.updateOnboardingCustomerView.match), (0, operators_1.mergeMap)((action) => {
19
- var _a, _b, _c;
19
+ var _a, _b, _c, _d;
20
20
  const { companyId, officerType, sendForVerification, reCalculateCurrentStep = false, } = action.payload;
21
21
  const { onboardingCustomerViewState } = state$.value;
22
22
  const { companyDetails, primaryContactDetails, companyOfficerUpdateStatus, currentStep, } = onboardingCustomerViewState;
@@ -27,14 +27,15 @@ const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => actions$
27
27
  const companyView = (0, getCompanyView_1.getCompanyView)(state$.value, companyId, []);
28
28
  const { newAddressState } = state$.value.addressViewState;
29
29
  const companyAddressToCreate = (_a = newAddressState === null || newAddressState === void 0 ? void 0 : newAddressState.company_address) === null || _a === void 0 ? void 0 : _a.addressToCreate;
30
+ const registeredAddressToCreate = (_b = newAddressState === null || newAddressState === void 0 ? void 0 : newAddressState.company_registered_address) === null || _b === void 0 ? void 0 : _b.addressToCreate;
30
31
  const addressType = officerType
31
32
  .toLowerCase()
32
33
  .concat('_address');
33
- const companyOfficerAddressToCreate = (_b = newAddressState === null || newAddressState === void 0 ? void 0 : newAddressState[addressType]) === null || _b === void 0 ? void 0 : _b.addressToCreate;
34
+ const companyOfficerAddressToCreate = (_c = newAddressState === null || newAddressState === void 0 ? void 0 : newAddressState[addressType]) === null || _c === void 0 ? void 0 : _c.addressToCreate;
34
35
  const isNewPrimaryContactUser = (primaryContactLocalData === null || primaryContactLocalData === void 0 ? void 0 : primaryContactLocalData.userId) == null ||
35
36
  (primaryContactLocalData === null || primaryContactLocalData === void 0 ? void 0 : primaryContactLocalData.email) !==
36
- ((_c = companyView === null || companyView === void 0 ? void 0 : companyView.primaryContact) === null || _c === void 0 ? void 0 : _c.user.email);
37
- const company = (0, updateBusinessVerificationDetailsEpic_1.toBusinessVerificationCompanyDataPayload)(companyLocalData, sendForVerification, companyAddressToCreate);
37
+ ((_d = companyView === null || companyView === void 0 ? void 0 : companyView.primaryContact) === null || _d === void 0 ? void 0 : _d.user.email);
38
+ const company = (0, updateBusinessVerificationDetailsEpic_1.toBusinessVerificationCompanyDataPayload)(companyLocalData, sendForVerification, companyAddressToCreate, registeredAddressToCreate);
38
39
  const primary_contact_user = primaryContactLocalData != null &&
39
40
  Boolean(primaryContactLocalData.email) === true // Don't save Empty Primary Contact details
40
41
  ? (0, updateBusinessVerificationDetailsEpic_1.toBusinessVerificationPrimaryContactDataPayload)(primaryContactLocalData, isNewPrimaryContactUser)
@@ -14,6 +14,7 @@ import { TenantExternalConnections, TenantProductSettings } from '../../../entit
14
14
  import { AccountingConnectionCreationMode } from '../../../entity/company/companyStateTypes';
15
15
  import { FileState } from '../../../entity/file/fileState';
16
16
  import { PlaidConnectionDetails } from '../../spendManagement/plaidAccount/plaidAccountViewState';
17
+ import { Country } from '../../countryList/countryListState';
17
18
  export interface OnboardingCustomerView {
18
19
  companyDetailsLocalData?: CompanyDetails;
19
20
  companyOfficerLocalData: Record<CompanyOfficerType, CompanyOfficersDetails | undefined>;
@@ -34,6 +35,7 @@ export interface OnboardingCustomerView {
34
35
  allStepsCompleted: boolean;
35
36
  allSteps: OnboardingStep[];
36
37
  companyIndustries: AllowedValueWithCode[];
38
+ allNationalityCountries: Country[];
37
39
  updateStatus: FetchStateAndError;
38
40
  fetchStatus: FetchStateAndError;
39
41
  saveStatus: FetchStateAndError;
@@ -14,7 +14,7 @@ const userRoleSelector_1 = require("../../../entity/userRole/userRoleSelector");
14
14
  const fileSelector_1 = require("../../../entity/file/fileSelector");
15
15
  function getOnboardingCustomerView(state, companyId) {
16
16
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
17
- const { fileState, paymentAccountState, onboardingCustomerViewState, userState, userRoleState, subscriptionPaymentAccountState, companyConfigState, cardPaymentViewState, } = state;
17
+ const { fileState, paymentAccountState, onboardingCustomerViewState, userState, userRoleState, subscriptionPaymentAccountState, companyConfigState, cardPaymentViewState, countryListState, } = state;
18
18
  const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, subscriptionPaymentAccountIds, paymentAccountDetails, plaidConnectionDetails, updateStatus, saveStatus, currentStep, uiState, fetchState, error, } = onboardingCustomerViewState;
19
19
  const { paymentAccountIds } = paymentAccountDetails;
20
20
  let subscriptionPaymentAccount;
@@ -94,10 +94,12 @@ function getOnboardingCustomerView(state, companyId) {
94
94
  { fetchState: configFetchState, error: configError },
95
95
  { fetchState, error },
96
96
  ]);
97
+ const allNationalityCountries = countryListState.byCountryListCode.nationalityCountryList.countries;
97
98
  return {
98
99
  companyDetailsLocalData,
99
100
  companyOfficerLocalData,
100
101
  companyView,
102
+ allNationalityCountries,
101
103
  pendingSaveDetails: {
102
104
  companyDetails: isCompanyDetailsSavePending(fileState, companyView, primaryContact, companyDetailsLocalData),
103
105
  officer: isOfficerDetailsSavePending(companyOfficers, companyOfficerRoles, fileState, companyOfficerLocalData[selectedOfficerType]),
@@ -244,8 +246,8 @@ function isOfficerDetailsSavePending(companyOfficers, companyOfficerRoles, fileS
244
246
  if (selectedOfficerIndex < 0) {
245
247
  selectedOfficerIndex = 0;
246
248
  }
247
- const { userId, firstName, lastName, birthday, email, phone: userPhone, ssn, } = companyOfficers[selectedOfficerIndex];
248
- const { firstName: firstNameLocalData, lastName: lastNameLocalData, birthday: birthdayLocalData, email: emailLocalData, phone, ssn: ssnLocalData, fileIds: officerFileIds, documentTypeSelectedForVerification, ownershipInCompany, titleAtCompany, } = officerDetails;
249
+ const { userId, firstName, lastName, birthday, email, phone: userPhone, ssn, nationalityCountryCode, } = companyOfficers[selectedOfficerIndex];
250
+ const { firstName: firstNameLocalData, lastName: lastNameLocalData, birthday: birthdayLocalData, email: emailLocalData, phone, ssn: ssnLocalData, nationalityCountryCode: nccLocalData, fileIds: officerFileIds, documentTypeSelectedForVerification, ownershipInCompany, titleAtCompany, } = officerDetails;
249
251
  const fileIdsLocalData = (0, fileSelector_1.getFilesByFileIds)(fileState, officerFileIds).map((file) => file.fileId);
250
252
  const userRole = companyOfficerRoles.find((userRole) => userRole.userId === userId);
251
253
  const fileIds = (0, fileSelector_1.getFilesByFileIds)(fileState, (_a = userRole === null || userRole === void 0 ? void 0 : userRole.fileIds) !== null && _a !== void 0 ? _a : []).map((file) => file.fileId);
@@ -255,6 +257,7 @@ function isOfficerDetailsSavePending(companyOfficers, companyOfficerRoles, fileS
255
257
  email != emailLocalData ||
256
258
  userPhone != phone ||
257
259
  ssn != ssnLocalData ||
260
+ nationalityCountryCode != nccLocalData ||
258
261
  (userRole === null || userRole === void 0 ? void 0 : userRole.documentTypeSelectedForVerification) !=
259
262
  documentTypeSelectedForVerification ||
260
263
  (userRole === null || userRole === void 0 ? void 0 : userRole.titleAtCompany) != titleAtCompany ||
@@ -7,7 +7,7 @@ export declare const getScheduleListKey: (selectedCategory: ID, selectedTimefram
7
7
  export declare type ScheduleListKey = ReturnType<typeof getScheduleListKey>;
8
8
  export declare const toScheduleSubTabType: (v: string) => "all" | "new" | "completed" | "ongoing";
9
9
  export declare type ScheduleSubTabType = ReturnType<typeof toScheduleSubTabType>;
10
- declare const toScheduleSortKeyType: (v: string) => "status" | "user" | "months" | "amount" | "vendor" | "class" | "balanceAsOfToday" | "createTime" | "memo" | "transactionDate" | "transactionType" | "accruedExpenseCategory" | "scheduleCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "startMonth" | "endMonth" | "assetId";
10
+ declare const toScheduleSortKeyType: (v: string) => "status" | "user" | "months" | "amount" | "vendor" | "class" | "createTime" | "balanceAsOfToday" | "memo" | "transactionDate" | "transactionType" | "accruedExpenseCategory" | "scheduleCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "startMonth" | "endMonth" | "assetId";
11
11
  export declare type ScheduleListSortKey = ReturnType<typeof toScheduleSortKeyType>;
12
12
  export interface DownloadJEScheduleTabOptions {
13
13
  timezone: string;
@@ -2,6 +2,7 @@ import { Amount, Currency } from '../../../../commonStateTypes/amount';
2
2
  import { FetchedState, ID } from '../../../../commonStateTypes/common';
3
3
  import { AccountBase } from '../../../../entity/account/accountState';
4
4
  import { ClassBase } from '../../../../entity/class/classState';
5
+ import { Country } from '../../../countryList/countryListState';
5
6
  export declare const getBillPayConfigKey: (method: string, subMethod: string) => string;
6
7
  declare type BillPayConfigKey = ReturnType<typeof getBillPayConfigKey>;
7
8
  export declare const getBillPayConfigMethodKey: (method: BillPaymentConfigCodeType, subMethod: BillPaymentSubConfigCodeKeyType, accType?: "depositAccount" | "paymentAccount" | undefined, internationalMethod?: "usdToLocalCurrency" | "usdToUsd" | undefined, internationalSubMethod?: "swiftOur" | "swiftSha" | undefined) => string;
@@ -27,10 +28,6 @@ export interface VendorCurrency extends Currency {
27
28
  currencyName: string;
28
29
  countryCode: string;
29
30
  }
30
- export interface Country {
31
- countryCode: string;
32
- countryName: string;
33
- }
34
31
  export interface BillPayConfig {
35
32
  minPeriod: ConfigPeriod;
36
33
  maxPeriod: ConfigPeriod;
@@ -26,6 +26,7 @@ import { AccountBase, RecommendedAccountBase } from '../../../../entity/account/
26
26
  import { ClassBase, RecommendedClassBase } from '../../../../entity/class/classState';
27
27
  import { RecurringBillState } from '../../../../entity/billPay/recurringBills/recurringBillsState';
28
28
  import { FundingAccount } from '../../commonSetup/setupViewSelector';
29
+ import { AllowedValueWithCode } from '../../../../commonStateTypes/allowedValue';
29
30
  export declare type PaymentToOption = {
30
31
  id: ID;
31
32
  type: PaymentModeType;
@@ -107,6 +108,7 @@ export interface EditBillDetailSelectorView extends SelectorView {
107
108
  recurringConfig?: RecurringBillConfigLocalData;
108
109
  recurringBillInstances?: RecurringBillInstance[];
109
110
  isBillMarkedForRetry?: boolean;
111
+ internationalWireOnboardingStatus?: AllowedValueWithCode;
110
112
  }
111
113
  export interface EditBillInitialDetails {
112
114
  vendor?: Vendor;
@@ -315,6 +315,8 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
315
315
  const classHierarchyList = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
316
316
  const duplicateBills = (0, billPayReviewSelector_1.getDuplicateBills)(state, billId);
317
317
  const isProcessing = (0, helpers_1.isBulkProcessing)((_1 = transaction === null || transaction === void 0 ? void 0 : transaction.bulkProcessingDetail) === null || _1 === void 0 ? void 0 : _1.type);
318
+ const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId !== null && companyId !== void 0 ? companyId : '', []);
319
+ const internationalWireOnboardingStatus = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyBillPayInfo.internationalWireOnboardingStatus;
318
320
  return {
319
321
  showVendorGptRecommendationText,
320
322
  recommendedVendor,
@@ -364,6 +366,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
364
366
  recurringConfig,
365
367
  isProcessing,
366
368
  isBillMarkedForRetry,
369
+ internationalWireOnboardingStatus,
367
370
  };
368
371
  };
369
372
  exports.getEditBillDetail = getEditBillDetail;
@@ -1,6 +1,7 @@
1
1
  import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
2
2
  import { RootState } from '../../../../reducer';
3
- import { Country, VendorCurrency } from '../billPayConfig/billPayConfigState';
3
+ import { Country } from '../../../countryList/countryListState';
4
+ import { VendorCurrency } from '../billPayConfig/billPayConfigState';
4
5
  import { CreateInternationalWireDetails, DynamicFormField, SupportedAccountType } from './internationalWire';
5
6
  export interface InternationalWireSelectorView extends SelectorView {
6
7
  dynamicForm: DynamicFormField[];
@@ -0,0 +1,7 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { ZeniAPI } from '../../../../../zeniAPI';
4
+ import { RootState } from '../../../../../reducer';
5
+ import { fetchInternationalVerificationForm, updateInternationalVerificationForm, updateVerificationFormFailure, initializeIntlVerificationForm } from '../internationalWireVerificationReducer';
6
+ export declare type ActionType = ReturnType<typeof fetchInternationalVerificationForm> | ReturnType<typeof updateInternationalVerificationForm> | ReturnType<typeof updateVerificationFormFailure> | ReturnType<typeof initializeIntlVerificationForm>;
7
+ export declare const fetchIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchIntlVerificationFormEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../../responsePayload");
7
+ const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
8
+ const fetchIntlVerificationFormEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.fetchInternationalVerificationForm.match), (0, operators_1.switchMap)((action) => {
9
+ const query = {
10
+ region: 'US',
11
+ legal_type: 'BUSINESS',
12
+ };
13
+ return zeniAPI
14
+ .getJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding-fields?query=${encodeURIComponent(JSON.stringify(query))}`)
15
+ .pipe((0, operators_1.mergeMap)((response) => {
16
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
17
+ return (0, rxjs_1.from)([
18
+ (0, internationalWireVerificationReducer_1.updateInternationalVerificationForm)({
19
+ internationalWireFormPayload: response.data.labels,
20
+ }),
21
+ (0, internationalWireVerificationReducer_1.initializeIntlVerificationForm)(action.payload.companyId, response.data.labels),
22
+ ]);
23
+ }
24
+ else {
25
+ return (0, rxjs_1.of)((0, internationalWireVerificationReducer_1.updateVerificationFormFailure)({
26
+ error: response.status,
27
+ }));
28
+ }
29
+ }), (0, operators_1.catchError)((error) => {
30
+ return (0, rxjs_1.of)((0, internationalWireVerificationReducer_1.updateVerificationFormFailure)({
31
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch international verification form REST API call errored out' +
32
+ JSON.stringify(error)),
33
+ }));
34
+ }));
35
+ }));
36
+ exports.fetchIntlVerificationFormEpic = fetchIntlVerificationFormEpic;
@@ -0,0 +1,6 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateVerificationFormLocalData, initializeIntlVerificationForm } from '../internationalWireVerificationReducer';
4
+ import { RootState } from '../../../../../reducer';
5
+ export declare type ActionType = ReturnType<typeof updateVerificationFormLocalData> | ReturnType<typeof initializeIntlVerificationForm>;
6
+ export declare const initializeIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initializeIntlVerificationFormEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
7
+ const initializeIntlVerificationFormEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.initializeIntlVerificationForm.match), (0, operators_1.mergeMap)((action) => {
8
+ const { companyId, internationalWireFormPayload } = action.payload;
9
+ const actions = [];
10
+ const state = state$.value;
11
+ const onboardingDataFromCompanyInfo = state.companyState.companiesById[companyId].companyBillPayInfo
12
+ .internationalWireOnboardingDetails;
13
+ const localData = {};
14
+ Object.keys(internationalWireFormPayload).forEach((formFieldKey) => {
15
+ const values = onboardingDataFromCompanyInfo[formFieldKey].values;
16
+ localData[formFieldKey] =
17
+ internationalWireFormPayload[formFieldKey].type === 'enum'
18
+ ? values.length === 1
19
+ ? typeof values[0] === 'object' && 'code' in values[0]
20
+ ? values[0].code
21
+ : ''
22
+ : values.map((value) => typeof value === 'object' && 'code' in value ? value.code : '')
23
+ : values[0];
24
+ });
25
+ actions.push((0, internationalWireVerificationReducer_1.updateVerificationFormLocalData)(localData));
26
+ return (0, rxjs_1.from)(actions);
27
+ }));
28
+ exports.initializeIntlVerificationFormEpic = initializeIntlVerificationFormEpic;
@@ -0,0 +1,9 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { ZeniAPI } from '../../../../../zeniAPI';
4
+ import { RootState } from '../../../../../reducer';
5
+ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
6
+ import { submitInternationalVerificationForm, updateVerificationFormSubmissionStatus } from '../internationalWireVerificationReducer';
7
+ import { updateInternationalWireOnboardingStatus } from '../../../../../entity/company/companyReducer';
8
+ export declare type ActionType = ReturnType<typeof submitInternationalVerificationForm> | ReturnType<typeof updateVerificationFormSubmissionStatus> | ReturnType<typeof updateInternationalWireOnboardingStatus> | ReturnType<typeof openSnackbar>;
9
+ export declare const submitIntlVerificationEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.submitIntlVerificationEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../../responsePayload");
7
+ const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
8
+ const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
9
+ const companyReducer_1 = require("../../../../../entity/company/companyReducer");
10
+ const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.submitInternationalVerificationForm.match), (0, operators_1.switchMap)((action) => {
11
+ const { internationalWireVerificationState } = state$.value;
12
+ const { companyId } = action.payload;
13
+ const localData = internationalWireVerificationState.verificationFormLocalData;
14
+ if (localData != null) {
15
+ return zeniAPI
16
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`, toIntlWireVerificationPayload(localData))
17
+ .pipe((0, operators_1.mergeMap)((response) => {
18
+ var _a;
19
+ const actions = [];
20
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
21
+ actions.push((0, internationalWireVerificationReducer_1.updateVerificationFormSubmissionStatus)({
22
+ fetchState: 'Completed',
23
+ error: undefined,
24
+ }));
25
+ actions.push((0, snackbarReducer_1.openSnackbar)({
26
+ messageSection: 'business_verification_submit',
27
+ messageText: 'success',
28
+ type: 'success',
29
+ }));
30
+ if (response.data != null) {
31
+ actions.push((0, companyReducer_1.updateInternationalWireOnboardingStatus)({
32
+ companyId: companyId,
33
+ status: (_a = response.data) === null || _a === void 0 ? void 0 : _a.international_wire_onboarding_status,
34
+ }));
35
+ }
36
+ }
37
+ else {
38
+ actions.push((0, internationalWireVerificationReducer_1.updateVerificationFormSubmissionStatus)({
39
+ fetchState: 'Error',
40
+ error: response.status,
41
+ }));
42
+ actions.push((0, snackbarReducer_1.openSnackbar)({
43
+ messageSection: 'business_verification_submit',
44
+ messageText: 'failed',
45
+ type: 'error',
46
+ }));
47
+ }
48
+ return (0, rxjs_1.from)(actions);
49
+ }), (0, operators_1.catchError)((error) => {
50
+ return (0, rxjs_1.of)((0, internationalWireVerificationReducer_1.updateVerificationFormSubmissionStatus)({
51
+ fetchState: 'Error',
52
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Submit international wire verification REST API call errored out' +
53
+ JSON.stringify(error)),
54
+ }));
55
+ }));
56
+ }
57
+ else {
58
+ return (0, rxjs_1.from)([]);
59
+ }
60
+ }));
61
+ exports.submitIntlVerificationEpic = submitIntlVerificationEpic;
62
+ const toIntlWireVerificationPayload = (localData) => {
63
+ return {
64
+ is_applicant_declaration: true,
65
+ form_details: localData,
66
+ };
67
+ };
@@ -0,0 +1,26 @@
1
+ import { AllowedValueWithCode } from '../../../../commonStateTypes/allowedValue';
2
+ import { ZeniAPIResponse } from '../../../../responsePayload';
3
+ import { VerificationFormField } from './internationalWireVerificationState';
4
+ export interface FieldPayload {
5
+ label: string;
6
+ type: string;
7
+ field_hint_text?: string;
8
+ field_values?: {
9
+ code: string;
10
+ description: string;
11
+ }[];
12
+ is_multiple_values_allowed?: boolean;
13
+ }
14
+ export declare const toDynamicFormField: (key: string, payload: FieldPayload) => VerificationFormField;
15
+ export declare type IntlVerificationFormResponse = ZeniAPIResponse<IntlVerificationFormPayload>;
16
+ export interface IntlVerificationFormPayload {
17
+ labels: Record<string, FieldPayload>;
18
+ create_time: string;
19
+ update_time: string;
20
+ }
21
+ interface SubmitIntlVerificationFormPayload {
22
+ international_wire_onboarding_status: AllowedValueWithCode;
23
+ status_remarks: string | null;
24
+ }
25
+ export declare type SubmitIntlVerificationFormResponse = ZeniAPIResponse<SubmitIntlVerificationFormPayload>;
26
+ export {};
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toDynamicFormField = void 0;
4
+ const toDynamicFormField = (key, payload) => {
5
+ var _a, _b;
6
+ return ({
7
+ name: key,
8
+ label: payload.label,
9
+ placeholder: (_a = payload.field_hint_text) !== null && _a !== void 0 ? _a : '',
10
+ isMultipleValuesAllowed: (_b = payload.is_multiple_values_allowed) !== null && _b !== void 0 ? _b : false,
11
+ type: payload.type,
12
+ fieldValues: payload.field_values != null && payload.field_values.length > 0
13
+ ? payload.field_values.map((fieldValue) => {
14
+ return {
15
+ code: fieldValue.code,
16
+ description: fieldValue.description,
17
+ };
18
+ })
19
+ : [],
20
+ });
21
+ };
22
+ exports.toDynamicFormField = toDynamicFormField;
@@ -0,0 +1,22 @@
1
+ import { FieldPayload } from './internationalWireVerificationPayload';
2
+ import { VerificationFormLocalData, InternationalWireVerificationState } from './internationalWireVerificationState';
3
+ import { FetchState } from '../../../../commonStateTypes/common';
4
+ import { ZeniAPIStatus } from '../../../../responsePayload';
5
+ export declare const initialState: InternationalWireVerificationState;
6
+ export declare const fetchInternationalVerificationForm: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string], {
7
+ companyId: string;
8
+ }, string, never, never>, updateInternationalVerificationForm: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
9
+ internationalWireFormPayload: Record<string, FieldPayload>;
10
+ }, string>, updateVerificationFormFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
11
+ error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
12
+ }, string>, updateVerificationFormLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<VerificationFormLocalData, string>, submitInternationalVerificationForm: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string], {
13
+ companyId: string;
14
+ }, string, never, never>, updateVerificationFormSubmissionStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
15
+ fetchState: FetchState;
16
+ error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
17
+ }, string>, initializeIntlVerificationForm: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, internationalWireFormPayload: Record<string, FieldPayload>], {
18
+ companyId: string;
19
+ internationalWireFormPayload: Record<string, FieldPayload>;
20
+ }, string, never, never>, clearInternationalVerificationView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
21
+ declare const _default: import("@reduxjs/toolkit").Reducer<InternationalWireVerificationState, import("@reduxjs/toolkit").AnyAction>;
22
+ export default _default;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.clearInternationalVerificationView = exports.initializeIntlVerificationForm = exports.updateVerificationFormSubmissionStatus = exports.submitInternationalVerificationForm = exports.updateVerificationFormLocalData = exports.updateVerificationFormFailure = exports.updateInternationalVerificationForm = exports.fetchInternationalVerificationForm = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const internationalWireVerificationPayload_1 = require("./internationalWireVerificationPayload");
7
+ exports.initialState = {
8
+ verificationFormFetchState: {
9
+ fetchState: 'Not-Started',
10
+ },
11
+ verificationFormFields: [],
12
+ verificationFormLocalData: {},
13
+ verificationFormSubmitState: {
14
+ fetchState: 'Not-Started',
15
+ },
16
+ };
17
+ const internationalWireVerification = (0, toolkit_1.createSlice)({
18
+ name: 'internationalWireVerification',
19
+ initialState: exports.initialState,
20
+ reducers: {
21
+ fetchInternationalVerificationForm: {
22
+ reducer(draft) {
23
+ draft.verificationFormFetchState = {
24
+ fetchState: 'In-Progress',
25
+ error: undefined,
26
+ };
27
+ },
28
+ prepare(companyId) {
29
+ return {
30
+ payload: {
31
+ companyId,
32
+ },
33
+ };
34
+ },
35
+ },
36
+ updateInternationalVerificationForm(draft, action) {
37
+ const { internationalWireFormPayload } = action.payload;
38
+ const verificationFormFields = [];
39
+ Object.keys(internationalWireFormPayload).forEach((key) => {
40
+ verificationFormFields.push((0, internationalWireVerificationPayload_1.toDynamicFormField)(key, internationalWireFormPayload[key]));
41
+ });
42
+ draft.verificationFormFields = verificationFormFields;
43
+ draft.verificationFormFetchState.fetchState = 'Completed';
44
+ },
45
+ updateVerificationFormFailure(draft, action) {
46
+ const { error } = action.payload;
47
+ draft.verificationFormFetchState.fetchState = 'Error';
48
+ draft.verificationFormFetchState.error = error;
49
+ },
50
+ updateVerificationFormLocalData(draft, action) {
51
+ draft.verificationFormLocalData = Object.assign({}, action.payload);
52
+ },
53
+ submitInternationalVerificationForm: {
54
+ reducer(draft) {
55
+ draft.verificationFormSubmitState.fetchState = 'In-Progress';
56
+ draft.verificationFormSubmitState.error = undefined;
57
+ },
58
+ prepare(companyId) {
59
+ return {
60
+ payload: { companyId },
61
+ };
62
+ },
63
+ },
64
+ updateVerificationFormSubmissionStatus(draft, action) {
65
+ const { fetchState, error } = action.payload;
66
+ draft.verificationFormSubmitState.fetchState = fetchState;
67
+ draft.verificationFormSubmitState.error = error;
68
+ },
69
+ initializeIntlVerificationForm: {
70
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
71
+ reducer(_draft) {
72
+ // do nothing
73
+ },
74
+ prepare(companyId, internationalWireFormPayload) {
75
+ return {
76
+ payload: {
77
+ companyId,
78
+ internationalWireFormPayload,
79
+ },
80
+ };
81
+ },
82
+ },
83
+ clearInternationalVerificationView(draft) {
84
+ Object.assign(draft, exports.initialState);
85
+ },
86
+ },
87
+ });
88
+ _a = internationalWireVerification.actions, exports.fetchInternationalVerificationForm = _a.fetchInternationalVerificationForm, exports.updateInternationalVerificationForm = _a.updateInternationalVerificationForm, exports.updateVerificationFormFailure = _a.updateVerificationFormFailure, exports.updateVerificationFormLocalData = _a.updateVerificationFormLocalData, exports.submitInternationalVerificationForm = _a.submitInternationalVerificationForm, exports.updateVerificationFormSubmissionStatus = _a.updateVerificationFormSubmissionStatus, exports.initializeIntlVerificationForm = _a.initializeIntlVerificationForm, exports.clearInternationalVerificationView = _a.clearInternationalVerificationView;
89
+ exports.default = internationalWireVerification.reducer;
@@ -0,0 +1,15 @@
1
+ import { ID, FetchStateAndError } from '../../../../commonStateTypes/common';
2
+ import { RootState } from '../../../../reducer';
3
+ import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
4
+ import { VerificationFormField, VerificationFormLocalData } from './internationalWireVerificationState';
5
+ import { File } from '../../../../entity/file/fileState';
6
+ export interface InternationalWireVerificationView extends SelectorView {
7
+ verificationFormFetchState: FetchStateAndError;
8
+ verificationFormFields: VerificationFormField[];
9
+ verificationFormLocalData: VerificationFormLocalData;
10
+ verificationFormSubmitState: FetchStateAndError;
11
+ userFiles: File[];
12
+ deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
13
+ updateFileStatusById: Record<ID, FetchStateAndError | undefined>;
14
+ }
15
+ export declare const getIntlWireVerificationView: (state: RootState) => InternationalWireVerificationView;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIntlWireVerificationView = void 0;
4
+ const fileSelector_1 = require("../../../../entity/file/fileSelector");
5
+ const fileViewSelector_1 = require("../../../fileView/fileViewSelector");
6
+ const getIntlWireVerificationView = (state) => {
7
+ const deleteFileStatusById = {};
8
+ const updateFileStatusById = {};
9
+ // field with type = file
10
+ const fileField = state.internationalWireVerificationState.verificationFormFields.find((field) => field.type === 'file');
11
+ let fileId;
12
+ if (fileField != null) {
13
+ fileId = state.internationalWireVerificationState.verificationFormLocalData[fileField.name];
14
+ }
15
+ if (fileId != null) {
16
+ deleteFileStatusById[fileId] = (0, fileViewSelector_1.getFileDeleteStatusById)(state, fileId);
17
+ updateFileStatusById[fileId] = (0, fileViewSelector_1.getFileUpdateNameStatusById)(state, fileId);
18
+ }
19
+ let userFiles = [];
20
+ if (fileId != null) {
21
+ userFiles = (0, fileSelector_1.getFilesByFileIds)(state.fileState, [fileId]);
22
+ }
23
+ const fetchState = state.internationalWireVerificationState.verificationFormFetchState
24
+ .fetchState;
25
+ return Object.assign(Object.assign({}, state.internationalWireVerificationState), { deleteFileStatusById,
26
+ updateFileStatusById,
27
+ userFiles,
28
+ fetchState });
29
+ };
30
+ exports.getIntlWireVerificationView = getIntlWireVerificationView;