@zeniai/client-epic-state 4.15.1 → 4.15.3
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.
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +4 -1
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +1 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +9 -16
- package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +7 -16
- package/lib/view/spendManagement/commonSetup/types/businessVerification.d.ts +2 -2
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ const addressViewPayload_1 = require("../../../../addressView/addressViewPayload
|
|
|
17
17
|
const getCompanyView_1 = require("../../../../companyView/selectorHelpers/getCompanyView");
|
|
18
18
|
const updateBusinessVerificationDetailsEpic_1 = require("../../../../spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic");
|
|
19
19
|
const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
|
|
20
|
+
const onboardingCustomerViewSelector_1 = require("../../onboardingCustomerViewSelector");
|
|
20
21
|
const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.updateOnboardingCustomerView.match), (0, operators_1.mergeMap)((action) => {
|
|
21
22
|
var _a, _b, _c, _d;
|
|
22
23
|
const { companyId, officerType, sendForVerification, reCalculateCurrentStep = false, isBillingAddressUpdate, } = action.payload;
|
|
@@ -115,8 +116,10 @@ const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
115
116
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
|
|
116
117
|
const externalConnections = currentTenant.externalConnections;
|
|
117
118
|
const isQBOConnection = (_b = (_a = externalConnections === null || externalConnections === void 0 ? void 0 : externalConnections.accounting) === null || _a === void 0 ? void 0 : _a.some((connection) => connection.connectionName.match(/quickbooks/i))) !== null && _b !== void 0 ? _b : false;
|
|
119
|
+
const { allSteps } = (0, onboardingCustomerViewSelector_1.getOnboardingCustomerView)(state$.value, companyId);
|
|
118
120
|
if (currentStep === 'link_payment_account') {
|
|
119
|
-
if (isQBOConnection === true
|
|
121
|
+
if (isQBOConnection === true &&
|
|
122
|
+
allSteps.includes('qbo_connection')) {
|
|
120
123
|
actions.push((0, onboardingCustomerViewReducer_1.updateCurrentStep)({ step: 'qbo_connection' }));
|
|
121
124
|
}
|
|
122
125
|
else {
|
|
@@ -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);
|
|
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) => {
|
|
50
50
|
allStepsData: OnboardingStep[];
|
|
51
51
|
requiredStepsData: OnboardingStep[];
|
|
52
52
|
};
|
|
@@ -69,11 +69,12 @@ 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)
|
|
76
|
+
cardPaymentViewState.cardPaymentsIds.length > 0) &&
|
|
77
|
+
(companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyOnboardingInfo.subscriptionBillingAddressId) != null) {
|
|
77
78
|
completedSteps.push('link_payment_account');
|
|
78
79
|
}
|
|
79
80
|
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;
|
|
@@ -93,7 +94,7 @@ function getOnboardingCustomerView(state, companyId) {
|
|
|
93
94
|
isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, companyOfficerLocalData[selectedOfficerType], fileState)) {
|
|
94
95
|
completedSteps.push('company_officer');
|
|
95
96
|
}
|
|
96
|
-
const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, (_r = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _r !== void 0 ? _r : [], accountingConnectionCreationMode
|
|
97
|
+
const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, (_r = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _r !== void 0 ? _r : [], accountingConnectionCreationMode);
|
|
97
98
|
const allRequiredStepsCompleted = requiredStepsData.every((step) => {
|
|
98
99
|
return completedSteps.includes(step);
|
|
99
100
|
});
|
|
@@ -189,25 +190,17 @@ function isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, officer
|
|
|
189
190
|
Boolean(userRole === null || userRole === void 0 ? void 0 : userRole.addressId) &&
|
|
190
191
|
files.length >= 2);
|
|
191
192
|
}
|
|
192
|
-
const onboardingStepsData = (isValidConnection, productSettings, accountingConnectionCreationMode
|
|
193
|
+
const onboardingStepsData = (isValidConnection, productSettings, accountingConnectionCreationMode) => {
|
|
193
194
|
const allStepsData = accountingConnectionCreationMode === 'zeni_user' ||
|
|
194
195
|
((productSettings.isBankingEnabled || productSettings.isCardsEnabled) &&
|
|
195
196
|
!productSettings.isBookkeepingEnabled)
|
|
196
|
-
?
|
|
197
|
-
|
|
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;
|
|
197
|
+
? onboardingCustomerViewState_1.ALL_ZENI_USER_ONBOARDING_STEPS
|
|
198
|
+
: onboardingCustomerViewState_1.ALL_ONBOARDING_STEPS;
|
|
202
199
|
const requiredStepsData = (accountingConnectionCreationMode === 'zeni_user' && isValidConnection) ||
|
|
203
200
|
((productSettings.isBankingEnabled || productSettings.isCardsEnabled) &&
|
|
204
201
|
!productSettings.isBookkeepingEnabled)
|
|
205
|
-
?
|
|
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;
|
|
202
|
+
? onboardingCustomerViewState_1.ZENI_USER_REQUIRED_ONBOARDING_STEPS
|
|
203
|
+
: onboardingCustomerViewState_1.REQUIRED_ONBOARDING_STEPS;
|
|
211
204
|
return {
|
|
212
205
|
allStepsData: allStepsData.map((step) => (0, onboardingCustomerViewState_1.toOnboardingStepType)(step)),
|
|
213
206
|
requiredStepsData: requiredStepsData.map((step) => (0, onboardingCustomerViewState_1.toOnboardingStepType)(step)),
|
package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js
CHANGED
|
@@ -185,6 +185,7 @@ const toBusinessVerificationPrimaryContactDataPayload = (primaryContact, isNewPr
|
|
|
185
185
|
};
|
|
186
186
|
exports.toBusinessVerificationPrimaryContactDataPayload = toBusinessVerificationPrimaryContactDataPayload;
|
|
187
187
|
const toBusinessVerificationOfficerDataPayload = (companyOfficer, isSubmittingAdditionalDocuments, companyOfficerAddressData) => {
|
|
188
|
+
var _a;
|
|
188
189
|
const { firstName, lastName, userId, email, syncToken: userSyncToken, ssn, birthday, nationalityCountryCode, phone: userPhone, otpChallenge, isPhoneVerified, titleAtCompany, ownershipInCompany, documentTypeSelectedForVerification, fileIds: userFileIds, additionalSubmittedDocumentsForVerificationFileIds, } = companyOfficer;
|
|
189
190
|
const company_officer = {
|
|
190
191
|
first_name: firstName,
|
|
@@ -213,25 +214,15 @@ const toBusinessVerificationOfficerDataPayload = (companyOfficer, isSubmittingAd
|
|
|
213
214
|
if (ssn != null) {
|
|
214
215
|
company_officer['ssn'] = ssn;
|
|
215
216
|
}
|
|
216
|
-
|
|
217
|
-
company_officer['birthday'] = birthday.format('YYYY-MM-DD');
|
|
218
|
-
}
|
|
219
|
-
if (nationalityCountryCode != null) {
|
|
220
|
-
company_officer['nationality_country_code'] = nationalityCountryCode;
|
|
221
|
-
}
|
|
217
|
+
company_officer['birthday'] = (_a = birthday === null || birthday === void 0 ? void 0 : birthday.format('YYYY-MM-DD')) !== null && _a !== void 0 ? _a : null;
|
|
222
218
|
if (userPhone != null) {
|
|
223
219
|
company_officer['phone'] = userPhone;
|
|
224
220
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
if (documentTypeSelectedForVerification != null) {
|
|
232
|
-
company_officer['document_type_for_verification'] =
|
|
233
|
-
documentTypeSelectedForVerification;
|
|
234
|
-
}
|
|
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 : '';
|
|
235
226
|
if (companyOfficerAddressPayload != null) {
|
|
236
227
|
company_officer['address'] = companyOfficerAddressPayload;
|
|
237
228
|
}
|
|
@@ -7,10 +7,10 @@ export interface CompanyOfficerVerificationPayload {
|
|
|
7
7
|
phone: string;
|
|
8
8
|
sync_token: string;
|
|
9
9
|
ssn: string;
|
|
10
|
-
birthday: string;
|
|
10
|
+
birthday: string | null;
|
|
11
11
|
nationality_country_code: string;
|
|
12
12
|
title_at_company: string;
|
|
13
|
-
company_ownership: number;
|
|
13
|
+
company_ownership: number | null;
|
|
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: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.3",
|
|
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",
|