@zeniai/client-epic-state 4.15.6 → 4.15.8
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/entity/company/companyPayload.d.ts +1 -0
- package/lib/entity/company/companyPayload.js +12 -11
- package/lib/entity/company/companyStateTypes.d.ts +1 -0
- package/lib/view/bankAccountView/bankAccountViewPayload.d.ts +1 -0
- package/lib/view/bankAccountView/bankAccountViewPayload.js +6 -1
- package/lib/view/bankAccountView/epic/createInternationalBankAccountEpic.js +6 -2
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +2 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +13 -10
- package/lib/view/spendManagement/billPay/internationalWire/internationalWirePayload.js +3 -0
- package/package.json +2 -2
|
@@ -242,6 +242,7 @@ export interface OnboardingInfoPayload {
|
|
|
242
242
|
onboarding_customer_creation_done_by: ID[];
|
|
243
243
|
zeni_subscriptions_payment_account_linked_by: ID[];
|
|
244
244
|
zeni_subscriptions_payment_account_linked_status_code: string;
|
|
245
|
+
is_interim_email_sent: boolean;
|
|
245
246
|
zeni_subscriptions_payment_account_method_type_code: string;
|
|
246
247
|
is_zeni_subscriptions_payment_account_linked: boolean;
|
|
247
248
|
zeni_subscriptions_payment_account_creation_error_message: OnboardingStepErrorDetails | null;
|
|
@@ -237,29 +237,30 @@ const toPayNowCutOffByMethod = (payload) => {
|
|
|
237
237
|
};
|
|
238
238
|
};
|
|
239
239
|
const toOnboardingInfo = (onboardingInfoPayload) => {
|
|
240
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
240
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
241
241
|
if (onboardingInfoPayload == null) {
|
|
242
242
|
return undefined;
|
|
243
243
|
}
|
|
244
244
|
return {
|
|
245
|
+
isInterimEmailSent: (_a = onboardingInfoPayload.is_interim_email_sent) !== null && _a !== void 0 ? _a : false,
|
|
245
246
|
bankAccountLinked: {
|
|
246
|
-
completed: (
|
|
247
|
+
completed: (_b = onboardingInfoPayload.is_zeni_subscriptions_payment_account_linked) !== null && _b !== void 0 ? _b : false,
|
|
247
248
|
userIds: onboardingInfoPayload.zeni_subscriptions_payment_account_linked_by,
|
|
248
|
-
error: ((
|
|
249
|
-
.zeni_subscriptions_payment_account_creation_error_message) === null || _b === void 0 ? void 0 : _b.summary) !=
|
|
250
|
-
null,
|
|
251
|
-
errorDetails: ((_c = onboardingInfoPayload
|
|
249
|
+
error: ((_c = onboardingInfoPayload
|
|
252
250
|
.zeni_subscriptions_payment_account_creation_error_message) === null || _c === void 0 ? void 0 : _c.summary) !=
|
|
251
|
+
null,
|
|
252
|
+
errorDetails: ((_d = onboardingInfoPayload
|
|
253
|
+
.zeni_subscriptions_payment_account_creation_error_message) === null || _d === void 0 ? void 0 : _d.summary) !=
|
|
253
254
|
null
|
|
254
255
|
? onboardingInfoPayload.zeni_subscriptions_payment_account_creation_error_message
|
|
255
256
|
: undefined,
|
|
256
|
-
pendingVerification: (
|
|
257
|
+
pendingVerification: (_e = (onboardingInfoPayload.zeni_subscriptions_payment_account_linked_status_code ===
|
|
257
258
|
'pending_automatic_verification' ||
|
|
258
259
|
onboardingInfoPayload.zeni_subscriptions_payment_account_linked_status_code ===
|
|
259
|
-
'pending_manual_verification')) !== null &&
|
|
260
|
+
'pending_manual_verification')) !== null && _e !== void 0 ? _e : false,
|
|
260
261
|
},
|
|
261
262
|
qboLinked: {
|
|
262
|
-
completed: (
|
|
263
|
+
completed: (_f = onboardingInfoPayload.is_onboarding_qbo_linked) !== null && _f !== void 0 ? _f : false,
|
|
263
264
|
userIds: onboardingInfoPayload.onboarding_qbo_linked_by,
|
|
264
265
|
error: false,
|
|
265
266
|
},
|
|
@@ -272,12 +273,12 @@ const toOnboardingInfo = (onboardingInfoPayload) => {
|
|
|
272
273
|
userIds: onboardingInfoPayload.onboarding_business_identity_verified_by,
|
|
273
274
|
},
|
|
274
275
|
groupCreated: {
|
|
275
|
-
completed: (
|
|
276
|
+
completed: (_g = onboardingInfoPayload.is_onboarding_email_group_created) !== null && _g !== void 0 ? _g : false,
|
|
276
277
|
userIds: onboardingInfoPayload.onboarding_email_group_creation_done_by,
|
|
277
278
|
error: false,
|
|
278
279
|
},
|
|
279
280
|
customerCreated: {
|
|
280
|
-
completed: (
|
|
281
|
+
completed: (_h = onboardingInfoPayload.is_onboarding_customer_created) !== null && _h !== void 0 ? _h : false,
|
|
281
282
|
userIds: onboardingInfoPayload.onboarding_customer_creation_done_by,
|
|
282
283
|
error: false,
|
|
283
284
|
},
|
|
@@ -267,6 +267,7 @@ export interface OnboardingInfo extends OnboardingStepsInfo {
|
|
|
267
267
|
onboardingCustomerUserIds: ID[];
|
|
268
268
|
identityVerified: IdentityVerificationStatus;
|
|
269
269
|
businessVerified: IdentityVerificationStatus;
|
|
270
|
+
isInterimEmailSent: boolean;
|
|
270
271
|
}
|
|
271
272
|
export interface CompanyOnboardingInfo {
|
|
272
273
|
onboardingUserIds: ID[];
|
|
@@ -36,4 +36,5 @@ export type FetchBankNameBySwiftResponse = ZeniAPIResponse<BanksBySwiftPayload>;
|
|
|
36
36
|
export type FetchBankCountryNameByIbanResponse = ZeniAPIResponse<BankCountriesPayload>;
|
|
37
37
|
export declare const toBankAccountPayload: (bankAccount: CreateBankAccountLocalData, paymentMethodType: BillPaymentConfigCodeType) => Partial<BankAccountPayload>;
|
|
38
38
|
export declare const toInternationalBankAccountPayload: (bankAccount: CreateInternationalBankAccountLocalData) => Record<string, string>;
|
|
39
|
+
export declare const toInternationalBankAccountWithCountryPayload: (bankAccount: CreateInternationalBankAccountLocalData, countryCode?: string) => Record<string, string>;
|
|
39
40
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toInternationalBankAccountPayload = exports.toBankAccountPayload = void 0;
|
|
3
|
+
exports.toInternationalBankAccountWithCountryPayload = exports.toInternationalBankAccountPayload = exports.toBankAccountPayload = void 0;
|
|
4
4
|
const toBankAccountPayload = (bankAccount, paymentMethodType) => ({
|
|
5
5
|
bank_account_name: bankAccount.bankAccountName,
|
|
6
6
|
bank_account_number: bankAccount.bankAccountNumber,
|
|
@@ -19,3 +19,8 @@ const toInternationalBankAccountPayload = (bankAccount) => ({
|
|
|
19
19
|
account_source: '',
|
|
20
20
|
});
|
|
21
21
|
exports.toInternationalBankAccountPayload = toInternationalBankAccountPayload;
|
|
22
|
+
const toInternationalBankAccountWithCountryPayload = (bankAccount, countryCode) => {
|
|
23
|
+
const bankAccountData = (0, exports.toInternationalBankAccountPayload)(bankAccount);
|
|
24
|
+
return Object.assign(Object.assign({}, bankAccountData), { country_code: countryCode !== null && countryCode !== void 0 ? countryCode : '' });
|
|
25
|
+
};
|
|
26
|
+
exports.toInternationalBankAccountWithCountryPayload = toInternationalBankAccountWithCountryPayload;
|
|
@@ -10,12 +10,16 @@ const vendorViewReducer_1 = require("../../commonVendorView/vendorView/vendorVie
|
|
|
10
10
|
const bankAccountViewPayload_1 = require("../bankAccountViewPayload");
|
|
11
11
|
const bankAccountViewReducer_1 = require("../bankAccountViewReducer");
|
|
12
12
|
const createInternationalBankAccountEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(bankAccountViewReducer_1.createInternationalBankAccount.match), (0, operators_1.switchMap)((action) => {
|
|
13
|
-
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
const { bankAccountViewState, vendorViewState } = state$.value;
|
|
14
15
|
const { bankAccountContext, vendorId } = action.payload;
|
|
15
16
|
const bankAccountLocalData = bankAccountViewState.createInternationalBankAccountDetails.localData;
|
|
17
|
+
const countryCode = vendorId != null
|
|
18
|
+
? (_b = (_a = vendorViewState === null || vendorViewState === void 0 ? void 0 : vendorViewState.editVendorStateById[vendorId]) === null || _a === void 0 ? void 0 : _a.vendorDetailLocalData) === null || _b === void 0 ? void 0 : _b.countryCode
|
|
19
|
+
: (_c = vendorViewState.newVendorState.vendorDetailLocalData) === null || _c === void 0 ? void 0 : _c.countryCode;
|
|
16
20
|
if (bankAccountLocalData != null) {
|
|
17
21
|
return zeniAPI
|
|
18
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/payment-instruments`, (0, bankAccountViewPayload_1.
|
|
22
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/payment-instruments`, (0, bankAccountViewPayload_1.toInternationalBankAccountWithCountryPayload)(bankAccountLocalData, countryCode))
|
|
19
23
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
20
24
|
var _a, _b, _c, _d, _e, _f;
|
|
21
25
|
const bankAccountActions = [];
|
|
@@ -42,6 +42,8 @@ export interface OnboardingCustomerView {
|
|
|
42
42
|
fetchStatus: FetchStateAndError;
|
|
43
43
|
saveStatus: FetchStateAndError;
|
|
44
44
|
uiState: OnboardingCustomerViewUIState;
|
|
45
|
+
isInterimEmailSent: boolean;
|
|
46
|
+
qboConnected: boolean;
|
|
45
47
|
externalConnections?: TenantExternalConnections;
|
|
46
48
|
}
|
|
47
49
|
export declare function getOnboardingCustomerView(state: RootState, companyId: ID): OnboardingCustomerView;
|
|
@@ -15,7 +15,7 @@ const getCompanyView_1 = require("../../companyView/selectorHelpers/getCompanyVi
|
|
|
15
15
|
const setupViewSelector_1 = require("../../spendManagement/commonSetup/setupViewSelector");
|
|
16
16
|
const onboardingCustomerViewState_1 = require("./onboardingCustomerViewState");
|
|
17
17
|
function getOnboardingCustomerView(state, companyId) {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
19
19
|
const { fileState, paymentAccountState, onboardingCustomerViewState, userState, userRoleState, subscriptionPaymentAccountState, companyConfigState, cardPaymentViewState, countryListState, addressViewState, } = state;
|
|
20
20
|
const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, subscriptionPaymentAccountIds, paymentAccountDetails, plaidConnectionDetails, updateStatus, saveStatus, currentStep, uiState, fetchState, error, } = onboardingCustomerViewState;
|
|
21
21
|
const { paymentAccountIds } = paymentAccountDetails;
|
|
@@ -47,20 +47,21 @@ function getOnboardingCustomerView(state, companyId) {
|
|
|
47
47
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
48
48
|
const externalConnections = currentTenant.externalConnections;
|
|
49
49
|
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
50
|
-
const
|
|
50
|
+
const onboardingInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyOnboardingInfo.onboardingInfo;
|
|
51
|
+
const accountingConnectionCreationMode = onboardingInfo === null || onboardingInfo === void 0 ? void 0 : onboardingInfo.accountingConnectionCreationMode;
|
|
51
52
|
const companyOfficerIds = companyView === null || companyView === void 0 ? void 0 : companyView.companyOfficers.map((officer) => officer.user.userId);
|
|
52
|
-
const subscriptionBillingAddress = (
|
|
53
|
+
const subscriptionBillingAddress = (_e = addressViewState.newAddressState) === null || _e === void 0 ? void 0 : _e.subscription_billing_address;
|
|
53
54
|
const companyOfficers = (0, userSelector_1.getUsersByUserIds)(userState, companyOfficerIds !== null && companyOfficerIds !== void 0 ? companyOfficerIds : []);
|
|
54
55
|
const companyOfficerRoles = (0, userRoleSelector_1.getUserRoleByUserIds)(userRoleState, companyOfficerIds !== null && companyOfficerIds !== void 0 ? companyOfficerIds : []);
|
|
55
|
-
const primaryContact = ((
|
|
56
|
-
? (0, userSelector_1.getUserByUserId)(userState, (
|
|
56
|
+
const primaryContact = ((_f = companyView === null || companyView === void 0 ? void 0 : companyView.primaryContact) === null || _f === void 0 ? void 0 : _f.user.userId) != null
|
|
57
|
+
? (0, userSelector_1.getUserByUserId)(userState, (_g = companyView === null || companyView === void 0 ? void 0 : companyView.primaryContact) === null || _g === void 0 ? void 0 : _g.user.userId)
|
|
57
58
|
: undefined;
|
|
58
59
|
const { companyDetailsLocalData, companyOfficerLocalData } = (0, setupViewSelector_1.getCompanyAndIdentityDetails)(state, companyId, {
|
|
59
60
|
companyDetails,
|
|
60
61
|
companyOfficerUpdateStatus,
|
|
61
62
|
primaryContactDetails,
|
|
62
63
|
});
|
|
63
|
-
const companyAddress = (
|
|
64
|
+
const companyAddress = (_h = addressViewState.newAddressState) === null || _h === void 0 ? void 0 : _h.company_address;
|
|
64
65
|
if (companyAddress == null &&
|
|
65
66
|
(companyView === null || companyView === void 0 ? void 0 : companyView.company.company.managementInfo.companyAddressId) == null &&
|
|
66
67
|
(companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyOnboardingInfo.subscriptionBillingAddressId) != null &&
|
|
@@ -69,15 +70,15 @@ function getOnboardingCustomerView(state, companyId) {
|
|
|
69
70
|
companyDetailsLocalData.addressStatus = subscriptionBillingAddress;
|
|
70
71
|
}
|
|
71
72
|
const completedSteps = [];
|
|
72
|
-
if (((((
|
|
73
|
+
if (((((_k = (_j = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _j === void 0 ? void 0 : _j.code) === null || _k === void 0 ? void 0 : _k.includes('verified')) ===
|
|
73
74
|
true &&
|
|
74
75
|
(paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.isLoginRequired) === false) ||
|
|
75
|
-
((
|
|
76
|
+
((_m = (_l = subscriptionPaymentAccount === null || subscriptionPaymentAccount === void 0 ? void 0 : subscriptionPaymentAccount.providerVerificationStatus) === null || _l === void 0 ? void 0 : _l.code) === null || _m === void 0 ? void 0 : _m.includes('verified')) === true ||
|
|
76
77
|
cardPaymentViewState.cardPaymentsIds.length > 0) &&
|
|
77
78
|
(companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyOnboardingInfo.subscriptionBillingAddressId) != null) {
|
|
78
79
|
completedSteps.push('link_payment_account');
|
|
79
80
|
}
|
|
80
|
-
const isValidConnection = (
|
|
81
|
+
const isValidConnection = (_p = (_o = externalConnections === null || externalConnections === void 0 ? void 0 : externalConnections.accounting[0]) === null || _o === void 0 ? void 0 : _o.isValid) !== null && _p !== void 0 ? _p : false;
|
|
81
82
|
if (isValidConnection) {
|
|
82
83
|
completedSteps.push('qbo_connection');
|
|
83
84
|
}
|
|
@@ -94,7 +95,7 @@ function getOnboardingCustomerView(state, companyId) {
|
|
|
94
95
|
isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, companyOfficerLocalData[selectedOfficerType], fileState)) {
|
|
95
96
|
completedSteps.push('company_officer');
|
|
96
97
|
}
|
|
97
|
-
const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, (
|
|
98
|
+
const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, (_q = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _q !== void 0 ? _q : [], accountingConnectionCreationMode);
|
|
98
99
|
const allRequiredStepsCompleted = requiredStepsData.every((step) => {
|
|
99
100
|
return completedSteps.includes(step);
|
|
100
101
|
});
|
|
@@ -134,6 +135,8 @@ function getOnboardingCustomerView(state, companyId) {
|
|
|
134
135
|
fetchStatus,
|
|
135
136
|
saveStatus,
|
|
136
137
|
updateStatus,
|
|
138
|
+
qboConnected: (_r = onboardingInfo === null || onboardingInfo === void 0 ? void 0 : onboardingInfo.qboLinked.completed) !== null && _r !== void 0 ? _r : false,
|
|
139
|
+
isInterimEmailSent: (_s = onboardingInfo === null || onboardingInfo === void 0 ? void 0 : onboardingInfo.isInterimEmailSent) !== null && _s !== void 0 ? _s : false,
|
|
137
140
|
};
|
|
138
141
|
}
|
|
139
142
|
/**
|
|
@@ -52,6 +52,9 @@ const toPaymentInstrumentPayload = (paymentInstrumentLocalData) => {
|
|
|
52
52
|
(_a = paymentInstrumentLocalData.dynamicForm[accountType][field]) !== null && _a !== void 0 ? _a : '';
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
+
if (paymentInstrumentLocalData.countryCode != null) {
|
|
56
|
+
payload['country_code'] = paymentInstrumentLocalData.countryCode;
|
|
57
|
+
}
|
|
55
58
|
return payload;
|
|
56
59
|
};
|
|
57
60
|
exports.toPaymentInstrumentPayload = toPaymentInstrumentPayload;
|
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.8",
|
|
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",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/zeni-ai/client-epic-state#readme",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@liveblocks/client": "^2.
|
|
28
|
+
"@liveblocks/client": "^2.23.0",
|
|
29
29
|
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
30
30
|
"@types/chai": "^5.0.1",
|
|
31
31
|
"@types/jest": "^29.5.14",
|