@zeniai/client-epic-state 4.15.2 → 4.15.4

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.
@@ -86,7 +86,7 @@ const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$) => act
86
86
  }
87
87
  }
88
88
  }
89
- const { allStepsData } = (0, onboardingCustomerViewSelector_1.onboardingStepsData)(isValidConnection, (_l = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _l !== void 0 ? _l : [], accountingConnectionCreationMode);
89
+ const { allStepsData } = (0, onboardingCustomerViewSelector_1.onboardingStepsData)(isValidConnection, (_l = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _l !== void 0 ? _l : [], accountingConnectionCreationMode, subscriptionPaymentAccount);
90
90
  if (allStepsData.length > 0 &&
91
91
  allStepsData.indexOf(updatedCurrentStep) === -1) {
92
92
  updatedCurrentStep = allStepsData[0];
@@ -46,7 +46,7 @@ export interface OnboardingCustomerView {
46
46
  }
47
47
  export declare function getOnboardingCustomerView(state: RootState, companyId: ID): OnboardingCustomerView;
48
48
  export declare function isOfficerDetailsCompleted(companyOfficers: User[], companyOfficerRoles: UserRole[], officerDetails: CompanyOfficerLocalData, fileState: FileState): boolean;
49
- export declare const onboardingStepsData: (isValidConnection: boolean, productSettings: TenantProductSettings, accountingConnectionCreationMode?: AccountingConnectionCreationMode) => {
49
+ export declare const onboardingStepsData: (isValidConnection: boolean, productSettings: TenantProductSettings, accountingConnectionCreationMode?: AccountingConnectionCreationMode, subscriptionPaymentAccount?: SubscriptionPaymentAccount) => {
50
50
  allStepsData: OnboardingStep[];
51
51
  requiredStepsData: OnboardingStep[];
52
52
  };
@@ -69,12 +69,11 @@ function getOnboardingCustomerView(state, companyId) {
69
69
  companyDetailsLocalData.addressStatus = subscriptionBillingAddress;
70
70
  }
71
71
  const completedSteps = [];
72
- if (((((_l = (_k = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _k === void 0 ? void 0 : _k.code) === null || _l === void 0 ? void 0 : _l.includes('verified')) ===
72
+ if ((((_l = (_k = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _k === void 0 ? void 0 : _k.code) === null || _l === void 0 ? void 0 : _l.includes('verified')) ===
73
73
  true &&
74
74
  (paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.isLoginRequired) === false) ||
75
75
  ((_o = (_m = subscriptionPaymentAccount === null || subscriptionPaymentAccount === void 0 ? void 0 : subscriptionPaymentAccount.providerVerificationStatus) === null || _m === void 0 ? void 0 : _m.code) === null || _o === void 0 ? void 0 : _o.includes('verified')) === true ||
76
- cardPaymentViewState.cardPaymentsIds.length > 0) &&
77
- (companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyOnboardingInfo.subscriptionBillingAddressId) != null) {
76
+ cardPaymentViewState.cardPaymentsIds.length > 0) {
78
77
  completedSteps.push('link_payment_account');
79
78
  }
80
79
  const isValidConnection = (_q = (_p = externalConnections === null || externalConnections === void 0 ? void 0 : externalConnections.accounting[0]) === null || _p === void 0 ? void 0 : _p.isValid) !== null && _q !== void 0 ? _q : false;
@@ -94,7 +93,7 @@ function getOnboardingCustomerView(state, companyId) {
94
93
  isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, companyOfficerLocalData[selectedOfficerType], fileState)) {
95
94
  completedSteps.push('company_officer');
96
95
  }
97
- const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, (_r = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _r !== void 0 ? _r : [], accountingConnectionCreationMode);
96
+ const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, (_r = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _r !== void 0 ? _r : [], accountingConnectionCreationMode, subscriptionPaymentAccount);
98
97
  const allRequiredStepsCompleted = requiredStepsData.every((step) => {
99
98
  return completedSteps.includes(step);
100
99
  });
@@ -190,17 +189,25 @@ function isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, officer
190
189
  Boolean(userRole === null || userRole === void 0 ? void 0 : userRole.addressId) &&
191
190
  files.length >= 2);
192
191
  }
193
- const onboardingStepsData = (isValidConnection, productSettings, accountingConnectionCreationMode) => {
192
+ const onboardingStepsData = (isValidConnection, productSettings, accountingConnectionCreationMode, subscriptionPaymentAccount) => {
194
193
  const allStepsData = accountingConnectionCreationMode === 'zeni_user' ||
195
194
  ((productSettings.isBankingEnabled || productSettings.isCardsEnabled) &&
196
195
  !productSettings.isBookkeepingEnabled)
197
- ? onboardingCustomerViewState_1.ALL_ZENI_USER_ONBOARDING_STEPS
198
- : onboardingCustomerViewState_1.ALL_ONBOARDING_STEPS;
196
+ ? subscriptionPaymentAccount != null
197
+ ? onboardingCustomerViewState_1.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT
198
+ : onboardingCustomerViewState_1.ALL_ZENI_USER_ONBOARDING_STEPS
199
+ : subscriptionPaymentAccount != null
200
+ ? onboardingCustomerViewState_1.ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO
201
+ : onboardingCustomerViewState_1.ALL_ONBOARDING_STEPS;
199
202
  const requiredStepsData = (accountingConnectionCreationMode === 'zeni_user' && isValidConnection) ||
200
203
  ((productSettings.isBankingEnabled || productSettings.isCardsEnabled) &&
201
204
  !productSettings.isBookkeepingEnabled)
202
- ? onboardingCustomerViewState_1.ZENI_USER_REQUIRED_ONBOARDING_STEPS
203
- : onboardingCustomerViewState_1.REQUIRED_ONBOARDING_STEPS;
205
+ ? subscriptionPaymentAccount != null
206
+ ? []
207
+ : onboardingCustomerViewState_1.ZENI_USER_REQUIRED_ONBOARDING_STEPS
208
+ : subscriptionPaymentAccount != null
209
+ ? onboardingCustomerViewState_1.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO
210
+ : onboardingCustomerViewState_1.REQUIRED_ONBOARDING_STEPS;
204
211
  return {
205
212
  allStepsData: allStepsData.map((step) => (0, onboardingCustomerViewState_1.toOnboardingStepType)(step)),
206
213
  requiredStepsData: requiredStepsData.map((step) => (0, onboardingCustomerViewState_1.toOnboardingStepType)(step)),
@@ -43,6 +43,7 @@ export type PaymentToOption = {
43
43
  piLabels: PiLabel[];
44
44
  minValidAmount: number;
45
45
  maxValidAmount: number | null;
46
+ createTime?: ZeniDate;
46
47
  };
47
48
  export interface LineItemRecommendationsLocalData extends Omit<TransactionWithAccountAndClassLine, 'account' | 'class'>, LineItemOnlyRecommendationsLocalData {
48
49
  class?: ClassBase;
@@ -516,7 +516,7 @@ function toPaymentToOption(paymentMode) {
516
516
  maxValidAmount: null,
517
517
  };
518
518
  if ((0, has_1.default)(paymentMode, 'bankAccountId')) {
519
- const { bankAccountId, bankAccountName, bankAccountNumber, bankName, bankRoutingNumberAch, bankRoutingNumberWireTransfer, bankSwiftCode, bankAccountIban, } = paymentMode;
519
+ const { bankAccountId, bankAccountName, bankAccountNumber, bankName, bankRoutingNumberAch, bankRoutingNumberWireTransfer, bankSwiftCode, bankAccountIban, createTime, } = paymentMode;
520
520
  paymentToOption.id = bankAccountId;
521
521
  paymentToOption.type = 'BankAccount';
522
522
  paymentToOption.bankAccountName = bankAccountName;
@@ -527,6 +527,7 @@ function toPaymentToOption(paymentMode) {
527
527
  bankRoutingNumberWireTransfer;
528
528
  paymentToOption.bankSwiftCode = bankSwiftCode !== null && bankSwiftCode !== void 0 ? bankSwiftCode : '';
529
529
  paymentToOption.bankAccountIban = bankAccountIban !== null && bankAccountIban !== void 0 ? bankAccountIban : '';
530
+ paymentToOption.createTime = createTime;
530
531
  }
531
532
  else if ((0, has_1.default)(paymentMode, 'paymentInstrumentId')) {
532
533
  paymentToOption.type = 'PaymentInstrument';
@@ -535,6 +536,7 @@ function toPaymentToOption(paymentMode) {
535
536
  paymentToOption.piLabels = paymentMode.piLabels;
536
537
  paymentToOption.minValidAmount = paymentMode.minValidAmount;
537
538
  paymentToOption.maxValidAmount = paymentMode.maxValidAmount;
539
+ paymentToOption.createTime = paymentMode.createTime;
538
540
  }
539
541
  else {
540
542
  const { id, email } = paymentMode;
@@ -185,7 +185,6 @@ const toBusinessVerificationPrimaryContactDataPayload = (primaryContact, isNewPr
185
185
  };
186
186
  exports.toBusinessVerificationPrimaryContactDataPayload = toBusinessVerificationPrimaryContactDataPayload;
187
187
  const toBusinessVerificationOfficerDataPayload = (companyOfficer, isSubmittingAdditionalDocuments, companyOfficerAddressData) => {
188
- var _a;
189
188
  const { firstName, lastName, userId, email, syncToken: userSyncToken, ssn, birthday, nationalityCountryCode, phone: userPhone, otpChallenge, isPhoneVerified, titleAtCompany, ownershipInCompany, documentTypeSelectedForVerification, fileIds: userFileIds, additionalSubmittedDocumentsForVerificationFileIds, } = companyOfficer;
190
189
  const company_officer = {
191
190
  first_name: firstName,
@@ -214,15 +213,25 @@ const toBusinessVerificationOfficerDataPayload = (companyOfficer, isSubmittingAd
214
213
  if (ssn != null) {
215
214
  company_officer['ssn'] = ssn;
216
215
  }
217
- company_officer['birthday'] = (_a = birthday === null || birthday === void 0 ? void 0 : birthday.format('YYYY-MM-DD')) !== null && _a !== void 0 ? _a : null;
216
+ if (birthday != null) {
217
+ company_officer['birthday'] = birthday.format('YYYY-MM-DD');
218
+ }
219
+ if (nationalityCountryCode != null) {
220
+ company_officer['nationality_country_code'] = nationalityCountryCode;
221
+ }
218
222
  if (userPhone != null) {
219
223
  company_officer['phone'] = userPhone;
220
224
  }
221
- company_officer['title_at_company'] = titleAtCompany !== null && titleAtCompany !== void 0 ? titleAtCompany : '';
222
- company_officer['company_ownership'] = ownershipInCompany !== null && ownershipInCompany !== void 0 ? ownershipInCompany : null;
223
- company_officer['document_type_for_verification'] =
224
- documentTypeSelectedForVerification !== null && documentTypeSelectedForVerification !== void 0 ? documentTypeSelectedForVerification : '';
225
- company_officer['nationality_country_code'] = nationalityCountryCode !== null && nationalityCountryCode !== void 0 ? nationalityCountryCode : '';
225
+ if (titleAtCompany != null) {
226
+ company_officer['title_at_company'] = titleAtCompany;
227
+ }
228
+ if (ownershipInCompany != null) {
229
+ company_officer['company_ownership'] = ownershipInCompany;
230
+ }
231
+ if (documentTypeSelectedForVerification != null) {
232
+ company_officer['document_type_for_verification'] =
233
+ documentTypeSelectedForVerification;
234
+ }
226
235
  if (companyOfficerAddressPayload != null) {
227
236
  company_officer['address'] = companyOfficerAddressPayload;
228
237
  }
@@ -49,6 +49,7 @@ export interface FundingAccount {
49
49
  providerVerificationStatus?: AllowedValueWithCode;
50
50
  isVerified?: boolean;
51
51
  isLoginRequired?: boolean;
52
+ createTime?: ZeniDate;
52
53
  }
53
54
  export interface CompanyOfficersDetails extends CompanyOfficerLocalData {
54
55
  userFiles: File[];
@@ -218,6 +218,7 @@ const mapDepositAccToFundingAccount = (depositAcc) => ({
218
218
  fetchState: 'Completed',
219
219
  error: undefined,
220
220
  },
221
+ createTime: depositAcc.createTime,
221
222
  });
222
223
  exports.mapDepositAccToFundingAccount = mapDepositAccToFundingAccount;
223
224
  const mapPaymentAccToFundingAccount = (paymentAcc, paymentAccountBalanceFetchStatus) => {
@@ -241,6 +242,7 @@ const mapPaymentAccToFundingAccount = (paymentAcc, paymentAccountBalanceFetchSta
241
242
  fetchState: 'Not-Started',
242
243
  error: undefined,
243
244
  },
245
+ createTime: paymentAcc.createTime,
244
246
  });
245
247
  };
246
248
  exports.mapPaymentAccToFundingAccount = mapPaymentAccToFundingAccount;
@@ -7,10 +7,10 @@ export interface CompanyOfficerVerificationPayload {
7
7
  phone: string;
8
8
  sync_token: string;
9
9
  ssn: string;
10
- birthday: string | null;
10
+ birthday: string;
11
11
  nationality_country_code: string;
12
12
  title_at_company: string;
13
- company_ownership: number | null;
13
+ company_ownership: number;
14
14
  document_type_for_verification: string;
15
15
  are_additional_documents_submitted_for_verification: boolean;
16
16
  additional_submitted_documents_for_verification_file_ids: {
@@ -36,9 +36,9 @@ const getExpressPayView = (state) => {
36
36
  const paymentToOptions = [
37
37
  ...vendorBankAccounts.map((acc) => (0, editBillViewSelector_1.toPaymentToOption)(acc)),
38
38
  ...vendorPaymentInstruments.map((pi) => (0, editBillViewSelector_1.toPaymentToOption)(pi)),
39
- ];
39
+ ].sort((a, b) => { var _a; return (((_a = b.createTime) === null || _a === void 0 ? void 0 : _a.isAfter(a.createTime)) === true ? 1 : -1); });
40
40
  const allDepositAccounts = (0, depositAccountListSelector_1.getAllDepostAccounts)(depositAccountState, depositAccountListState).depositAccounts;
41
- const withdrawFromList = (0, setupViewSelector_1.getAllFundingAccounts)(allDepositAccounts, [], paymentAccountListState.paymentAccountBalanceFetchStatus);
41
+ const withdrawFromList = (0, setupViewSelector_1.getAllFundingAccounts)(allDepositAccounts, [], paymentAccountListState.paymentAccountBalanceFetchStatus).sort((a, b) => { var _a; return (((_a = a.createTime) === null || _a === void 0 ? void 0 : _a.isAfter(b.createTime)) === true ? 1 : -1); });
42
42
  const internationalWireOnboardingStatus = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyBillPayInfo.internationalWireOnboardingStatus;
43
43
  const fileId = (_k = expressPayState.formLocalData) === null || _k === void 0 ? void 0 : _k.receiptFileId;
44
44
  let receiptFile;
@@ -62,6 +62,7 @@ const transferDetail = (0, toolkit_1.createSlice)({
62
62
  fetchState: 'Completed',
63
63
  error: undefined,
64
64
  },
65
+ createTime: action.payload.createTime,
65
66
  };
66
67
  draft.localData = Object.assign(Object.assign({}, draft.localData), { transferTo: transferMoneyParty });
67
68
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.15.2",
3
+ "version": "4.15.4",
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
  "types": "lib/index.d.ts",