@zeniai/client-epic-state 4.11.61 → 4.11.63
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/cardPayment/cardPaymentViewPayload.d.ts +2 -0
- package/lib/view/cardPayment/cardPaymentViewReducer.js +3 -0
- package/lib/view/cardPayment/cardPaymentViewSelector.d.ts +2 -0
- package/lib/view/cardPayment/cardPaymentViewSelector.js +4 -1
- package/lib/view/cardPayment/cardPaymentViewState.d.ts +1 -0
- package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +5 -1
- package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.js +2 -0
- package/lib/view/onboardingView/customerView/epic/customerDetails/fetchOnboardingCustomerSetupViewEpic.d.ts +2 -1
- package/lib/view/onboardingView/customerView/epic/customerDetails/fetchOnboardingCustomerSetupViewEpic.js +6 -3
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +13 -5
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +2 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +5 -3
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +26 -10
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +1 -0
- package/lib/view/settingsView/settingsViewSelector.js +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CardPaymentPayload } from '../../entity/cardPayment/cardPaymentPayload';
|
|
2
|
+
import { SubscriptionPaymentAccountPayload } from '../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountPayload';
|
|
2
3
|
import { ZeniAPIResponse } from '../../responsePayload';
|
|
3
4
|
export declare type DeleteCardPaymentResponse = ZeniAPIResponse<FetchCardSetupIntentPayload>;
|
|
4
5
|
export interface FetchCardSetupIntentPayload {
|
|
@@ -16,6 +17,7 @@ export interface AddCardPaymentSourcePayload {
|
|
|
16
17
|
}
|
|
17
18
|
export interface PaymentSourcesPayload {
|
|
18
19
|
cards: CardPaymentPayload[];
|
|
20
|
+
bank_accounts: SubscriptionPaymentAccountPayload[];
|
|
19
21
|
}
|
|
20
22
|
export interface AddCardPaymentSourceResponse {
|
|
21
23
|
payment_sources: PaymentSourcesPayload;
|
|
@@ -5,6 +5,7 @@ exports.clearCardPaymentView = exports.resetCardPaymentErrorStatuses = exports.u
|
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
exports.initialState = {
|
|
7
7
|
cardPaymentsIds: [],
|
|
8
|
+
bankPaymentMethodsIds: [],
|
|
8
9
|
clientSecret: null,
|
|
9
10
|
fetchState: 'Not-Started',
|
|
10
11
|
error: undefined,
|
|
@@ -106,6 +107,8 @@ const cardPaymentView = (0, toolkit_1.createSlice)({
|
|
|
106
107
|
if (paymentMethods) {
|
|
107
108
|
const cardIds = paymentMethods.cards.map((card) => card.id);
|
|
108
109
|
state.cardPaymentsIds = cardIds;
|
|
110
|
+
const bankPaymentMethodsIds = paymentMethods.bank_accounts.map((bankAccount) => bankAccount.subscription_payment_account_id);
|
|
111
|
+
state.bankPaymentMethodsIds = bankPaymentMethodsIds;
|
|
109
112
|
}
|
|
110
113
|
},
|
|
111
114
|
resetCardPaymentErrorStatuses(draft) {
|
|
@@ -4,8 +4,10 @@ import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport
|
|
|
4
4
|
import { CardPayment } from '../../entity/cardPayment/cardPaymentState';
|
|
5
5
|
import { RootState } from '../../reducer';
|
|
6
6
|
import { SetupIntentData } from './cardPaymentViewState';
|
|
7
|
+
import { SubscriptionPaymentAccount } from '../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountState';
|
|
7
8
|
export interface CardPaymentSelectorView extends SelectorView {
|
|
8
9
|
cardsList: CardPayment[];
|
|
10
|
+
bankAccountsList: SubscriptionPaymentAccount[];
|
|
9
11
|
cardDeleteStatusById: Record<ID, FetchStateAndError>;
|
|
10
12
|
addCardPaymentSourceStatus: FetchStateAndError;
|
|
11
13
|
cardSetupConfirmStatus: {
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAllCardsAndBankPaymentMethods = void 0;
|
|
4
4
|
const cardPaymentSelector_1 = require("../../entity/cardPayment/cardPaymentSelector");
|
|
5
|
+
const subscriptionPaymentAccountSelector_1 = require("../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountSelector");
|
|
5
6
|
const getAllCardsAndBankPaymentMethods = (state) => {
|
|
6
|
-
const { cardPaymentState, cardPaymentViewState } = state;
|
|
7
|
+
const { cardPaymentState, cardPaymentViewState, subscriptionPaymentAccountState, } = state;
|
|
7
8
|
const cardList = (0, cardPaymentSelector_1.getCardsByIds)(cardPaymentState, cardPaymentViewState.cardPaymentsIds);
|
|
9
|
+
const bankAccountsList = (0, subscriptionPaymentAccountSelector_1.getSubscriptionPaymentAccountsByAccountIds)(subscriptionPaymentAccountState, cardPaymentViewState.bankPaymentMethodsIds);
|
|
8
10
|
return {
|
|
9
11
|
cardsList: cardList,
|
|
12
|
+
bankAccountsList: bankAccountsList,
|
|
10
13
|
fetchState: cardPaymentViewState.fetchState,
|
|
11
14
|
clientSecret: cardPaymentViewState.clientSecret,
|
|
12
15
|
setupIntentData: cardPaymentViewState.setupIntentData,
|
|
@@ -2,6 +2,7 @@ import { StripeError } from '@stripe/stripe-js';
|
|
|
2
2
|
import { FetchedState, FetchState, FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
3
3
|
export interface CardPaymentViewState extends FetchedState {
|
|
4
4
|
cardPaymentsIds: ID[];
|
|
5
|
+
bankPaymentMethodsIds: ID[];
|
|
5
6
|
cardSetupConfirmStatus: {
|
|
6
7
|
fetchState: FetchState;
|
|
7
8
|
error: StripeError | undefined;
|
|
@@ -3,7 +3,8 @@ import { ZeniAPI } from '../../../zeniAPI';
|
|
|
3
3
|
import { RootState } from '../../../reducer';
|
|
4
4
|
import { fetchPaymentSources, updatePaymentSources } from '../cardPaymentViewReducer';
|
|
5
5
|
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
|
-
|
|
6
|
+
import { updateSubscriptionPaymentAccounts } from '../../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountReducer';
|
|
7
|
+
export declare type ActionType = ReturnType<typeof fetchPaymentSources> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateSubscriptionPaymentAccounts> | ReturnType<typeof updatePaymentSources>;
|
|
7
8
|
export declare const fetchPaymentSourcesEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
8
9
|
payload: {
|
|
9
10
|
messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated";
|
|
@@ -23,6 +24,9 @@ export declare const fetchPaymentSourcesEpic: (actions$: ActionsObservable<Actio
|
|
|
23
24
|
response?: import("../cardPaymentViewPayload").AddCardPaymentSourceResponse | undefined;
|
|
24
25
|
};
|
|
25
26
|
type: string;
|
|
27
|
+
} | {
|
|
28
|
+
payload: import("../../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountPayload").SubscriptionPaymentAccountPayload[];
|
|
29
|
+
type: string;
|
|
26
30
|
} | import("@reduxjs/toolkit").PayloadAction<import("../../../entity/cardPayment/cardPaymentPayload").CardPaymentPayload[], string, {
|
|
27
31
|
updateType: import("../../..").UpdateType;
|
|
28
32
|
}, never>>;
|
|
@@ -7,6 +7,7 @@ const cardPaymentViewReducer_1 = require("../cardPaymentViewReducer");
|
|
|
7
7
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
9
|
const cardPaymentReducer_1 = require("../../../entity/cardPayment/cardPaymentReducer");
|
|
10
|
+
const subscriptionPaymentAccountReducer_1 = require("../../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountReducer");
|
|
10
11
|
const fetchPaymentSourcesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPaymentViewReducer_1.fetchPaymentSources.match), (0, operators_1.mergeMap)(() => {
|
|
11
12
|
const queryParams = { is_return_only_valid: true };
|
|
12
13
|
const fetchPaymentSourcesApi$ = zeniAPI.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/subscriptions/payment-sources?query=${encodeURIComponent(JSON.stringify(queryParams))}`);
|
|
@@ -18,6 +19,7 @@ const fetchPaymentSourcesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0
|
|
|
18
19
|
response: response.data,
|
|
19
20
|
}),
|
|
20
21
|
(0, cardPaymentReducer_1.updateCardPayments)(response.data.payment_sources.cards),
|
|
22
|
+
(0, subscriptionPaymentAccountReducer_1.updateSubscriptionPaymentAccounts)(response.data.payment_sources.bank_accounts),
|
|
21
23
|
]);
|
|
22
24
|
}
|
|
23
25
|
else {
|
|
@@ -9,7 +9,8 @@ import { updateFiles } from '../../../../../entity/file/fileReducer';
|
|
|
9
9
|
import { updateAddresses } from '../../../../../entity/address/addressReducer';
|
|
10
10
|
import { updateAccounts } from '../../../../../entity/account/accountReducer';
|
|
11
11
|
import { updatePaymentAccounts } from '../../../../../entity/paymentAccount/paymentAccountReducer';
|
|
12
|
+
import { updateSubscriptionPaymentAccounts } from '../../../../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountReducer';
|
|
12
13
|
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
13
14
|
import { fetchOnboardingCustomerSetupView, fetchOnboardingCustomerSetupViewSuccess, fetchOnboardingCustomerSetupViewFailure, updateOnboardingCustomerViewAccountDetails, updateOnboardingCustomerViewLocalStoreData } from '../../onboardingCustomerViewReducer';
|
|
14
|
-
export declare type ActionType = ReturnType<typeof fetchOnboardingCustomerSetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updateOnboardingCustomerViewLocalStoreData> | ReturnType<typeof updateOnboardingCustomerViewAccountDetails> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchOnboardingCustomerSetupViewSuccess> | ReturnType<typeof fetchOnboardingCustomerSetupViewFailure>;
|
|
15
|
+
export declare type ActionType = ReturnType<typeof fetchOnboardingCustomerSetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updateSubscriptionPaymentAccounts> | ReturnType<typeof updateOnboardingCustomerViewLocalStoreData> | ReturnType<typeof updateOnboardingCustomerViewAccountDetails> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchOnboardingCustomerSetupViewSuccess> | ReturnType<typeof fetchOnboardingCustomerSetupViewFailure>;
|
|
15
16
|
export declare const fetchOnboardingCustomerSetupViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -11,6 +11,7 @@ const fileReducer_1 = require("../../../../../entity/file/fileReducer");
|
|
|
11
11
|
const addressReducer_1 = require("../../../../../entity/address/addressReducer");
|
|
12
12
|
const accountReducer_1 = require("../../../../../entity/account/accountReducer");
|
|
13
13
|
const paymentAccountReducer_1 = require("../../../../../entity/paymentAccount/paymentAccountReducer");
|
|
14
|
+
const subscriptionPaymentAccountReducer_1 = require("../../../../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountReducer");
|
|
14
15
|
const companySelector_1 = require("../../../../../entity/company/companySelector");
|
|
15
16
|
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
16
17
|
const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
|
|
@@ -28,6 +29,7 @@ const fetchOnboardingCustomerSetupViewEpic = (actions$, state$, zeniAPI) => acti
|
|
|
28
29
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
29
30
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
30
31
|
const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
|
|
32
|
+
const subscriptionPaymentAccountIds = response.data.subscription_payment_accounts.map((subscriptionPaymentAccount) => subscriptionPaymentAccount.subscription_payment_account_id);
|
|
31
33
|
const actions = [
|
|
32
34
|
(0, userReducer_1.updateAllUsers)({ users: response.data.users }),
|
|
33
35
|
(0, userRoleReducer_1.updateUserRoles)(response.data.user_roles),
|
|
@@ -39,7 +41,8 @@ const fetchOnboardingCustomerSetupViewEpic = (actions$, state$, zeniAPI) => acti
|
|
|
39
41
|
(0, fileReducer_1.updateFiles)({ files: response.data.files }),
|
|
40
42
|
(0, accountReducer_1.updateAccounts)(response.data.accounts, 'onboarding'),
|
|
41
43
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
42
|
-
(0,
|
|
44
|
+
(0, subscriptionPaymentAccountReducer_1.updateSubscriptionPaymentAccounts)(response.data.subscription_payment_accounts),
|
|
45
|
+
(0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewAccountDetails)(paymentAccountIds, subscriptionPaymentAccountIds),
|
|
43
46
|
(0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewLocalStoreData)({
|
|
44
47
|
companyId: response.data.companies[0].company_id,
|
|
45
48
|
reCalculateCurrentStep,
|
|
@@ -59,8 +62,8 @@ const fetchOnboardingCustomerSetupViewEpic = (actions$, state$, zeniAPI) => acti
|
|
|
59
62
|
JSON.stringify(error))))));
|
|
60
63
|
}
|
|
61
64
|
else {
|
|
62
|
-
const { paymentAccountDetails } = onboardingCustomerViewState;
|
|
63
|
-
return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewAccountDetails)(paymentAccountDetails.paymentAccountIds), (0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewLocalStoreData)({
|
|
65
|
+
const { subscriptionPaymentAccountIds, paymentAccountDetails } = onboardingCustomerViewState;
|
|
66
|
+
return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewAccountDetails)(paymentAccountDetails.paymentAccountIds, subscriptionPaymentAccountIds), (0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewLocalStoreData)({
|
|
64
67
|
companyId,
|
|
65
68
|
reCalculateCurrentStep,
|
|
66
69
|
}), (0, onboardingCustomerViewReducer_1.fetchOnboardingCustomerSetupViewSuccess)());
|
|
@@ -18,10 +18,12 @@ const addressViewReducer_1 = require("../../../../addressView/addressViewReducer
|
|
|
18
18
|
const paymentAccountSelector_1 = require("../../../../../entity/paymentAccount/paymentAccountSelector");
|
|
19
19
|
const tenantSelector_1 = require("../../../../../entity/tenant/tenantSelector");
|
|
20
20
|
const onboardingCustomerViewSelector_1 = require("../../onboardingCustomerViewSelector");
|
|
21
|
+
const subscriptionPaymentAccountSelector_1 = require("../../../../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountSelector");
|
|
21
22
|
const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.updateOnboardingCustomerViewLocalStoreData.match), (0, operators_1.mergeMap)((action) => {
|
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
23
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
23
24
|
const { companyId, currentStep, reCalculateCurrentStep } = action.payload;
|
|
24
|
-
const { companyState, companyViewState, fileState, userState, userRoleState, onboardingCustomerViewState, paymentAccountState, } = state$.value;
|
|
25
|
+
const { companyState, companyViewState, fileState, userState, userRoleState, onboardingCustomerViewState, subscriptionPaymentAccountState, paymentAccountState, } = state$.value;
|
|
26
|
+
const { subscriptionPaymentAccountIds } = onboardingCustomerViewState;
|
|
25
27
|
const subscriptionIDs = (0, get_1.default)(companyViewState.passportView.subscriptionIDsByCompanyID, companyId, undefined);
|
|
26
28
|
const companyView = (0, getCompanyView_1.getCompanyView)(state$.value, companyId, subscriptionIDs !== null && subscriptionIDs !== void 0 ? subscriptionIDs : []);
|
|
27
29
|
const company = (_a = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId)) === null || _a === void 0 ? void 0 : _a.company;
|
|
@@ -42,8 +44,13 @@ const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$) => act
|
|
|
42
44
|
updatedCompanyDetails = Object.assign(Object.assign({}, onboardingCustomerViewState.companyDetails.localData), { syncToken });
|
|
43
45
|
}
|
|
44
46
|
let updatedCurrentStep = 'link_payment_account';
|
|
47
|
+
let subscriptionPaymentAccount;
|
|
45
48
|
const { companyOnboardingInfo } = company;
|
|
46
49
|
const accountingConnectionCreationMode = (_d = companyOnboardingInfo === null || companyOnboardingInfo === void 0 ? void 0 : companyOnboardingInfo.onboardingInfo) === null || _d === void 0 ? void 0 : _d.accountingConnectionCreationMode;
|
|
50
|
+
if (subscriptionPaymentAccountIds.length > 0) {
|
|
51
|
+
const subscriptionPaymentAccountId = subscriptionPaymentAccountIds[0];
|
|
52
|
+
subscriptionPaymentAccount = (0, subscriptionPaymentAccountSelector_1.getSubscriptionPaymentAccountByAccountId)(subscriptionPaymentAccountState, subscriptionPaymentAccountId);
|
|
53
|
+
}
|
|
47
54
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
|
|
48
55
|
const externalConnections = currentTenant.externalConnections;
|
|
49
56
|
const isValidConnection = (_f = (_e = externalConnections === null || externalConnections === void 0 ? void 0 : externalConnections.accounting[0]) === null || _e === void 0 ? void 0 : _e.isValid) !== null && _f !== void 0 ? _f : false;
|
|
@@ -55,8 +62,9 @@ const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$) => act
|
|
|
55
62
|
const paymentAccountId = paymentAccountIds[0];
|
|
56
63
|
paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, paymentAccountId);
|
|
57
64
|
}
|
|
58
|
-
if (((_h = (_g = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _g === void 0 ? void 0 : _g.code) === null || _h === void 0 ? void 0 : _h.includes('verified')) === true &&
|
|
59
|
-
(paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.isLoginRequired) === false)
|
|
65
|
+
if ((((_h = (_g = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _g === void 0 ? void 0 : _g.code) === null || _h === void 0 ? void 0 : _h.includes('verified')) === true &&
|
|
66
|
+
(paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.isLoginRequired) === false) ||
|
|
67
|
+
((_k = (_j = subscriptionPaymentAccount === null || subscriptionPaymentAccount === void 0 ? void 0 : subscriptionPaymentAccount.providerVerificationStatus) === null || _j === void 0 ? void 0 : _j.code) === null || _k === void 0 ? void 0 : _k.includes('verified')) === true) {
|
|
60
68
|
updatedCurrentStep = 'qbo_connection';
|
|
61
69
|
if (isValidConnection) {
|
|
62
70
|
updatedCurrentStep = 'company_officer';
|
|
@@ -72,7 +80,7 @@ const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$) => act
|
|
|
72
80
|
}
|
|
73
81
|
}
|
|
74
82
|
}
|
|
75
|
-
const { allStepsData } = (0, onboardingCustomerViewSelector_1.onboardingStepsData)(isValidConnection, (
|
|
83
|
+
const { allStepsData } = (0, onboardingCustomerViewSelector_1.onboardingStepsData)(isValidConnection, (_l = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _l !== void 0 ? _l : [], accountingConnectionCreationMode, subscriptionPaymentAccount);
|
|
76
84
|
if (allStepsData.length > 0 &&
|
|
77
85
|
allStepsData.indexOf(updatedCurrentStep) === -1) {
|
|
78
86
|
updatedCurrentStep = allStepsData[0];
|
|
@@ -60,8 +60,9 @@ export declare const fetchOnboardingCustomerView: import("@reduxjs/toolkit").Act
|
|
|
60
60
|
linkTokenType: PlaidLinkTokenType;
|
|
61
61
|
}, string, never, never>, updateCurrentStep: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
62
62
|
step: OnboardingStep;
|
|
63
|
-
}, string>, updateOnboardingCustomerViewAccountDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentAccountIds: string[]], {
|
|
63
|
+
}, string>, updateOnboardingCustomerViewAccountDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentAccountIds: string[], subscriptionPaymentAccountIds: string[]], {
|
|
64
64
|
paymentAccountIds: string[];
|
|
65
|
+
subscriptionPaymentAccountIds: string[];
|
|
65
66
|
}, string, never, never>, updateOnboardingCustomerViewLocalStoreData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
66
67
|
companyId: ID;
|
|
67
68
|
currentStep?: "company_details" | "company_officer" | "link_payment_account" | "qbo_connection" | undefined;
|
|
@@ -73,6 +73,7 @@ exports.initialState = {
|
|
|
73
73
|
updateStatus: initialStatus,
|
|
74
74
|
paymentAccountIds: [],
|
|
75
75
|
},
|
|
76
|
+
subscriptionPaymentAccountIds: [],
|
|
76
77
|
plaidConnectionDetails: {
|
|
77
78
|
link_account: {
|
|
78
79
|
fetchStatus: initialStatus,
|
|
@@ -146,12 +147,13 @@ const onboardingCustomerView = (0, toolkit_1.createSlice)({
|
|
|
146
147
|
draft.currentStep = action.payload.step;
|
|
147
148
|
},
|
|
148
149
|
updateOnboardingCustomerViewAccountDetails: {
|
|
149
|
-
prepare(paymentAccountIds) {
|
|
150
|
-
return { payload: { paymentAccountIds } };
|
|
150
|
+
prepare(paymentAccountIds, subscriptionPaymentAccountIds) {
|
|
151
|
+
return { payload: { paymentAccountIds, subscriptionPaymentAccountIds } };
|
|
151
152
|
},
|
|
152
153
|
reducer(draft, action) {
|
|
153
|
-
const { paymentAccountIds } = action.payload;
|
|
154
|
+
const { paymentAccountIds, subscriptionPaymentAccountIds } = action.payload;
|
|
154
155
|
draft.paymentAccountDetails.paymentAccountIds = paymentAccountIds;
|
|
156
|
+
draft.subscriptionPaymentAccountIds = subscriptionPaymentAccountIds;
|
|
155
157
|
draft.paymentAccountDetails.fetchStatus = {
|
|
156
158
|
fetchState: 'Completed',
|
|
157
159
|
error: undefined,
|
|
@@ -46,7 +46,7 @@ export declare function getOnboardingCustomerView(state: RootState, companyId: I
|
|
|
46
46
|
*/
|
|
47
47
|
export declare function isCompanyDetailsCompleted(fileState: FileState, company?: CompanyView, primaryContact?: User): boolean;
|
|
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 | undefined) => {
|
|
49
|
+
export declare const onboardingStepsData: (isValidConnection: boolean, productSettings: TenantProductSettings, accountingConnectionCreationMode?: AccountingConnectionCreationMode | undefined, subscriptionPaymentAccount?: SubscriptionPaymentAccount | undefined) => {
|
|
50
50
|
allStepsData: OnboardingStep[];
|
|
51
51
|
requiredStepsData: OnboardingStep[];
|
|
52
52
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isOfficerDetailsSavePending = exports.isCompanyDetailsSavePending = exports.onboardingStepsData = exports.isOfficerDetailsCompleted = exports.isCompanyDetailsCompleted = exports.getOnboardingCustomerView = void 0;
|
|
4
4
|
const paymentAccountSelector_1 = require("../../../entity/paymentAccount/paymentAccountSelector");
|
|
5
|
+
const subscriptionPaymentAccountSelector_1 = require("../../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountSelector");
|
|
5
6
|
const onboardingCustomerViewState_1 = require("./onboardingCustomerViewState");
|
|
6
7
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
7
8
|
const getCompanyView_1 = require("../../companyView/selectorHelpers/getCompanyView");
|
|
@@ -12,10 +13,11 @@ const userSelector_1 = require("../../../entity/user/userSelector");
|
|
|
12
13
|
const userRoleSelector_1 = require("../../../entity/userRole/userRoleSelector");
|
|
13
14
|
const fileSelector_1 = require("../../../entity/file/fileSelector");
|
|
14
15
|
function getOnboardingCustomerView(state, companyId) {
|
|
15
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
16
|
-
const { fileState, paymentAccountState, onboardingCustomerViewState, userState, userRoleState, companyConfigState, cardPaymentViewState, } = state;
|
|
17
|
-
const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, paymentAccountDetails, plaidConnectionDetails, updateStatus, saveStatus, currentStep, uiState, fetchState, error, } = onboardingCustomerViewState;
|
|
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;
|
|
18
|
+
const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, subscriptionPaymentAccountIds, paymentAccountDetails, plaidConnectionDetails, updateStatus, saveStatus, currentStep, uiState, fetchState, error, } = onboardingCustomerViewState;
|
|
18
19
|
const { paymentAccountIds } = paymentAccountDetails;
|
|
20
|
+
let subscriptionPaymentAccount;
|
|
19
21
|
let paymentAccount;
|
|
20
22
|
let paymentAccountStatus;
|
|
21
23
|
if ((paymentAccountIds === null || paymentAccountIds === void 0 ? void 0 : paymentAccountIds.length) > 0) {
|
|
@@ -36,6 +38,10 @@ function getOnboardingCustomerView(state, companyId) {
|
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
}
|
|
41
|
+
if (subscriptionPaymentAccountIds.length > 0) {
|
|
42
|
+
const subscriptionPaymentAccountId = subscriptionPaymentAccountIds[0];
|
|
43
|
+
subscriptionPaymentAccount = (0, subscriptionPaymentAccountSelector_1.getSubscriptionPaymentAccountByAccountId)(subscriptionPaymentAccountState, subscriptionPaymentAccountId);
|
|
44
|
+
}
|
|
39
45
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
40
46
|
const externalConnections = currentTenant.externalConnections;
|
|
41
47
|
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
@@ -55,10 +61,11 @@ function getOnboardingCustomerView(state, companyId) {
|
|
|
55
61
|
if ((((_j = (_h = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _h === void 0 ? void 0 : _h.code) === null || _j === void 0 ? void 0 : _j.includes('verified')) ===
|
|
56
62
|
true &&
|
|
57
63
|
(paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.isLoginRequired) === false) ||
|
|
64
|
+
((_l = (_k = subscriptionPaymentAccount === null || subscriptionPaymentAccount === void 0 ? void 0 : subscriptionPaymentAccount.providerVerificationStatus) === null || _k === void 0 ? void 0 : _k.code) === null || _l === void 0 ? void 0 : _l.includes('verified')) === true ||
|
|
58
65
|
cardPaymentViewState.cardPaymentsIds.length > 0) {
|
|
59
66
|
completedSteps.push('link_payment_account');
|
|
60
67
|
}
|
|
61
|
-
const isValidConnection = (
|
|
68
|
+
const isValidConnection = (_o = (_m = externalConnections === null || externalConnections === void 0 ? void 0 : externalConnections.accounting[0]) === null || _m === void 0 ? void 0 : _m.isValid) !== null && _o !== void 0 ? _o : false;
|
|
62
69
|
if (isValidConnection) {
|
|
63
70
|
completedSteps.push('qbo_connection');
|
|
64
71
|
}
|
|
@@ -75,7 +82,7 @@ function getOnboardingCustomerView(state, companyId) {
|
|
|
75
82
|
isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, companyOfficerLocalData[selectedOfficerType], fileState)) {
|
|
76
83
|
completedSteps.push('company_officer');
|
|
77
84
|
}
|
|
78
|
-
const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, (
|
|
85
|
+
const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, (_p = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _p !== void 0 ? _p : [], accountingConnectionCreationMode, subscriptionPaymentAccount);
|
|
79
86
|
const allRequiredStepsCompleted = requiredStepsData.every((step) => {
|
|
80
87
|
return completedSteps.includes(step);
|
|
81
88
|
});
|
|
@@ -102,6 +109,7 @@ function getOnboardingCustomerView(state, companyId) {
|
|
|
102
109
|
allStepsCompleted,
|
|
103
110
|
companyIndustries,
|
|
104
111
|
externalConnections,
|
|
112
|
+
subscriptionPaymentAccount,
|
|
105
113
|
paymentAccount,
|
|
106
114
|
paymentAccountStatus,
|
|
107
115
|
plaidConnectionDetails,
|
|
@@ -170,17 +178,25 @@ function isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, officer
|
|
|
170
178
|
files.length >= 2);
|
|
171
179
|
}
|
|
172
180
|
exports.isOfficerDetailsCompleted = isOfficerDetailsCompleted;
|
|
173
|
-
const onboardingStepsData = (isValidConnection, productSettings, accountingConnectionCreationMode) => {
|
|
181
|
+
const onboardingStepsData = (isValidConnection, productSettings, accountingConnectionCreationMode, subscriptionPaymentAccount) => {
|
|
174
182
|
const allStepsData = accountingConnectionCreationMode === 'zeni_user' ||
|
|
175
183
|
((productSettings.isBankingEnabled || productSettings.isCardsEnabled) &&
|
|
176
184
|
!productSettings.isBookkeepingEnabled)
|
|
177
|
-
?
|
|
178
|
-
|
|
185
|
+
? subscriptionPaymentAccount != null
|
|
186
|
+
? onboardingCustomerViewState_1.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT
|
|
187
|
+
: onboardingCustomerViewState_1.ALL_ZENI_USER_ONBOARDING_STEPS
|
|
188
|
+
: subscriptionPaymentAccount != null
|
|
189
|
+
? onboardingCustomerViewState_1.ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO
|
|
190
|
+
: onboardingCustomerViewState_1.ALL_ONBOARDING_STEPS;
|
|
179
191
|
const requiredStepsData = (accountingConnectionCreationMode === 'zeni_user' && isValidConnection) ||
|
|
180
192
|
((productSettings.isBankingEnabled || productSettings.isCardsEnabled) &&
|
|
181
193
|
!productSettings.isBookkeepingEnabled)
|
|
182
|
-
?
|
|
183
|
-
|
|
194
|
+
? subscriptionPaymentAccount != null
|
|
195
|
+
? []
|
|
196
|
+
: onboardingCustomerViewState_1.ZENI_USER_REQUIRED_ONBOARDING_STEPS
|
|
197
|
+
: subscriptionPaymentAccount != null
|
|
198
|
+
? onboardingCustomerViewState_1.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO
|
|
199
|
+
: onboardingCustomerViewState_1.REQUIRED_ONBOARDING_STEPS;
|
|
184
200
|
return {
|
|
185
201
|
allStepsData: allStepsData.map((step) => (0, onboardingCustomerViewState_1.toOnboardingStepType)(step)),
|
|
186
202
|
requiredStepsData: requiredStepsData.map((step) => (0, onboardingCustomerViewState_1.toOnboardingStepType)(step)),
|
|
@@ -39,6 +39,7 @@ export interface OnboardingCustomerViewState extends FetchedState {
|
|
|
39
39
|
updateStatus: FetchStateAndError;
|
|
40
40
|
paymentAccountIds: ID[];
|
|
41
41
|
};
|
|
42
|
+
subscriptionPaymentAccountIds: ID[];
|
|
42
43
|
plaidConnectionDetails: PlaidConnectionDetails;
|
|
43
44
|
currentStep: OnboardingStep;
|
|
44
45
|
uiState: OnboardingCustomerViewUIState;
|
|
@@ -62,14 +62,14 @@ function getBankConnectionsSetupViewDetails(state, companyId, isBillPayEnabled,
|
|
|
62
62
|
if (isBillPayEnabled) {
|
|
63
63
|
primaryAccountsProductWise.push(Object.assign({ productType: 'bill_pay' }, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'bill_pay', 'bill_pay_setup')));
|
|
64
64
|
}
|
|
65
|
-
if (
|
|
66
|
-
primaryAccountsProductWise.push(Object.assign({ productType: '
|
|
65
|
+
if (isCardEnabled) {
|
|
66
|
+
primaryAccountsProductWise.push(Object.assign({ productType: 'charge_cards' }, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'charge_cards', 'charge_card_setup')));
|
|
67
67
|
}
|
|
68
68
|
if (isAccountEnabled) {
|
|
69
69
|
primaryAccountsProductWise.push(Object.assign({ productType: 'zeni_accounts' }, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'zeni_accounts', 'account_setup')));
|
|
70
70
|
}
|
|
71
|
-
if (
|
|
72
|
-
primaryAccountsProductWise.push(Object.assign({ productType: '
|
|
71
|
+
if (isRemiEnabled) {
|
|
72
|
+
primaryAccountsProductWise.push(Object.assign({ productType: 'reimbursement' }, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'reimbursement', 'reimbursement_setup')));
|
|
73
73
|
}
|
|
74
74
|
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
75
75
|
const billPayPrimaryAccount = (_c = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyBillPayInfo.primaryFundingAccount) === null || _c === void 0 ? void 0 : _c.accountId; //companyBillPayInfo
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.63",
|
|
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",
|