@zeniai/client-epic-state 4.14.60 → 4.14.61
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/address/addressReducer.d.ts +2 -1
- package/lib/entity/address/addressReducer.js +1 -0
- package/lib/entity/company/companyPayload.d.ts +1 -0
- package/lib/entity/company/companyPayload.js +1 -0
- package/lib/entity/company/companyStateTypes.d.ts +3 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/epic.d.ts +3 -1
- package/lib/epic.js +3 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +23 -21
- package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +1 -0
- package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +1 -0
- package/lib/view/addressView/addressViewState.d.ts +1 -1
- package/lib/view/addressView/epic/saveNewAddressEpic.js +1 -0
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +37 -18
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.d.ts +2 -2
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +13 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +3 -2
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +3 -2
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +2 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +10 -8
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +2 -0
- package/lib/view/settingsView/epic/fetchBillingAccountsViewEpic.d.ts +2 -2
- package/lib/view/settingsView/epic/fetchBillingAccountsViewEpic.js +3 -1
- package/lib/view/settingsView/epic/fetchCompanyBillingAddressEpic.d.ts +11 -0
- package/lib/view/settingsView/epic/fetchCompanyBillingAddressEpic.js +57 -0
- package/lib/view/settingsView/epic/saveCompanyBillingAddressEpic.d.ts +10 -0
- package/lib/view/settingsView/epic/saveCompanyBillingAddressEpic.js +65 -0
- package/lib/view/settingsView/settingsViewPayload.d.ts +6 -0
- package/lib/view/settingsView/settingsViewReducer.d.ts +10 -2
- package/lib/view/settingsView/settingsViewReducer.js +59 -4
- package/lib/view/settingsView/settingsViewSelector.js +5 -1
- package/lib/view/settingsView/settingsViewState.d.ts +4 -0
- package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +3 -1
- package/lib/view/spendManagement/commonSetup/epic/setup/updateSetupViewLocalStoreDataEpic.js +5 -1
- package/lib/view/spendManagement/commonSetup/types/businessVerification.d.ts +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchCompanyBillingAddressEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const addressReducer_1 = require("../../../entity/address/addressReducer");
|
|
7
|
+
const companyReducer_1 = require("../../../entity/company/companyReducer");
|
|
8
|
+
const companySelector_1 = require("../../../entity/company/companySelector");
|
|
9
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
10
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
11
|
+
const addressViewReducer_1 = require("../../addressView/addressViewReducer");
|
|
12
|
+
const settingsViewReducer_1 = require("../settingsViewReducer");
|
|
13
|
+
const fetchCompanyBillingAddressEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchCompanyBillingAddress.match), (0, operators_1.switchMap)((action) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const { companyId, cacheOverride } = action.payload;
|
|
16
|
+
const { settingsViewState, companyState } = state$.value;
|
|
17
|
+
const company = (_a = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId)) === null || _a === void 0 ? void 0 : _a.company;
|
|
18
|
+
if (cacheOverride === true ||
|
|
19
|
+
company == null ||
|
|
20
|
+
settingsViewState.billingAddress.fetchState !== 'In-Progress') {
|
|
21
|
+
return zeniAPI
|
|
22
|
+
.getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}?query={"view":"subscription_billing_address"}`)
|
|
23
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
24
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
25
|
+
const actions = [
|
|
26
|
+
(0, companyReducer_1.updateCompanies)({
|
|
27
|
+
payload: response.data.companies,
|
|
28
|
+
schema: {},
|
|
29
|
+
}),
|
|
30
|
+
(0, addressReducer_1.updateAddresses)(response.data.addresses),
|
|
31
|
+
(0, settingsViewReducer_1.fetchCompanyBillingAddressSuccess)(),
|
|
32
|
+
];
|
|
33
|
+
const subscriptionBillingAddressId = response.data.companies[0].subscription_billing_address_id;
|
|
34
|
+
const subscriptionBillingAddress = response.data.addresses.find((address) => address.address_id === subscriptionBillingAddressId);
|
|
35
|
+
if (subscriptionBillingAddress != null) {
|
|
36
|
+
actions.push((0, addressViewReducer_1.newAddressInLocalStore)({
|
|
37
|
+
addressType: 'subscription_billing_address',
|
|
38
|
+
addressToCreate: (0, addressReducer_1.mapAddressPayloadToAddress)(subscriptionBillingAddress),
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
return (0, rxjs_1.from)(actions);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
|
|
45
|
+
messageSection: 'billing_address_view',
|
|
46
|
+
messageText: 'failed',
|
|
47
|
+
type: 'error',
|
|
48
|
+
}), (0, settingsViewReducer_1.fetchCompanyBillingAddressFailure)(response.status));
|
|
49
|
+
}
|
|
50
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.fetchCompanyBillingAddressFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Billing Address View errored out' +
|
|
51
|
+
JSON.stringify(error))))));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return (0, rxjs_1.of)((0, settingsViewReducer_1.fetchCompanyBillingAddressSuccess)());
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
exports.fetchCompanyBillingAddressEpic = fetchCompanyBillingAddressEpic;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
|
+
import { updateCompanies } from '../../../entity/company/companyReducer';
|
|
5
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
|
+
import { RootState } from '../../../reducer';
|
|
7
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
8
|
+
import { saveCompanyBillingAddress, saveCompanyBillingAddressFailure, saveCompanyBillingAddressSuccess } from '../settingsViewReducer';
|
|
9
|
+
export type ActionType = ReturnType<typeof saveCompanyBillingAddress> | ReturnType<typeof saveCompanyBillingAddressFailure> | ReturnType<typeof saveCompanyBillingAddressSuccess> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateAddresses> | ReturnType<typeof openSnackbar>;
|
|
10
|
+
export declare const saveCompanyBillingAddressEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveCompanyBillingAddressEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const addressReducer_1 = require("../../../entity/address/addressReducer");
|
|
7
|
+
const companyReducer_1 = require("../../../entity/company/companyReducer");
|
|
8
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
9
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
10
|
+
const addressViewPayload_1 = require("../../addressView/addressViewPayload");
|
|
11
|
+
const getCompanyView_1 = require("../../companyView/selectorHelpers/getCompanyView");
|
|
12
|
+
const settingsViewReducer_1 = require("../settingsViewReducer");
|
|
13
|
+
const saveCompanyBillingAddressEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.saveCompanyBillingAddress.match), (0, operators_1.mergeMap)((action) => {
|
|
14
|
+
const { companyId } = action.payload;
|
|
15
|
+
let payload;
|
|
16
|
+
const { newAddressState } = state$.value.addressViewState;
|
|
17
|
+
const companyView = (0, getCompanyView_1.getCompanyView)(state$.value, companyId, []);
|
|
18
|
+
if (companyView != null &&
|
|
19
|
+
(newAddressState === null || newAddressState === void 0 ? void 0 : newAddressState.subscription_billing_address.addressToCreate) != null) {
|
|
20
|
+
payload = prepareEditBillingAddressPayload(newAddressState.subscription_billing_address.addressToCreate, companyView.company.company.companyInfo.syncToken);
|
|
21
|
+
return zeniAPI
|
|
22
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, payload)
|
|
23
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
24
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
25
|
+
const actions = [
|
|
26
|
+
(0, companyReducer_1.updateCompanies)({
|
|
27
|
+
payload: response.data.companies,
|
|
28
|
+
schema: {},
|
|
29
|
+
}),
|
|
30
|
+
(0, addressReducer_1.updateAddresses)(response.data.addresses),
|
|
31
|
+
];
|
|
32
|
+
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
33
|
+
messageSection: 'billing_address_view',
|
|
34
|
+
messageText: 'success',
|
|
35
|
+
type: 'success',
|
|
36
|
+
}), (0, settingsViewReducer_1.saveCompanyBillingAddressSuccess)());
|
|
37
|
+
return (0, rxjs_1.from)(actions);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
|
|
41
|
+
messageSection: 'billing_address_view',
|
|
42
|
+
messageText: 'failed',
|
|
43
|
+
type: 'error',
|
|
44
|
+
}), (0, settingsViewReducer_1.saveCompanyBillingAddressFailure)(response.status));
|
|
45
|
+
}
|
|
46
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.saveCompanyBillingAddressFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save Billing Address Details errored out' +
|
|
47
|
+
JSON.stringify(error))))));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return (0, rxjs_1.from)([]);
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
exports.saveCompanyBillingAddressEpic = saveCompanyBillingAddressEpic;
|
|
54
|
+
/**
|
|
55
|
+
* Helpers
|
|
56
|
+
*/
|
|
57
|
+
const prepareEditBillingAddressPayload = (address, syncToken) => {
|
|
58
|
+
const addressPayload = (0, addressViewPayload_1.toAddressUpdatableInfoPayload)(address);
|
|
59
|
+
return {
|
|
60
|
+
company: {
|
|
61
|
+
sync_token: syncToken,
|
|
62
|
+
subscription_billing_address: addressPayload,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AddressPayload } from '../../entity/address/addressPayload';
|
|
2
|
+
import { CompanyPayload } from '../../entity/company/companyPayload';
|
|
2
3
|
import { UserPayload } from '../../entity/user/userPayload';
|
|
3
4
|
import { UserRolePayload } from '../../entity/userRole/userRolePayload';
|
|
4
5
|
import { ZeniAPIResponse } from '../../responsePayload';
|
|
@@ -38,5 +39,10 @@ export type NotificationSettingsResponse = ZeniAPIResponse<NotificationSettingsP
|
|
|
38
39
|
interface RefreshQBOPayload {
|
|
39
40
|
message: string;
|
|
40
41
|
}
|
|
42
|
+
export interface BillingAddressViewPayload {
|
|
43
|
+
addresses: AddressPayload[];
|
|
44
|
+
companies: CompanyPayload[];
|
|
45
|
+
}
|
|
46
|
+
export type BillingAddressViewResponse = ZeniAPIResponse<BillingAddressViewPayload>;
|
|
41
47
|
export type RefreshQBOResponse = ZeniAPIResponse<RefreshQBOPayload>;
|
|
42
48
|
export {};
|
|
@@ -14,7 +14,10 @@ export declare const fetchMyProfileView: import("@reduxjs/toolkit").ActionCreato
|
|
|
14
14
|
userId: string;
|
|
15
15
|
}, "settings/updateMyProfileOnSuccess", never, never>, updateMyProfileOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "settings/updateMyProfileOnFailure">, fetchBankConnectionsView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: any], {
|
|
16
16
|
cacheOverride: any;
|
|
17
|
-
}, "settings/fetchBankConnectionsView", never, never>, fetchBillingAccountsView: import("@reduxjs/toolkit").
|
|
17
|
+
}, "settings/fetchBankConnectionsView", never, never>, fetchBillingAccountsView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, cacheOverride: boolean], {
|
|
18
|
+
companyId: string;
|
|
19
|
+
cacheOverride: boolean;
|
|
20
|
+
}, "settings/fetchBillingAccountsView", never, never>, updateBankConnectionOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
18
21
|
bankAccountIds: ID[];
|
|
19
22
|
}, "settings/updateBankConnectionOnSuccess">, updateBankConnectionOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "settings/updateBankConnectionOnFailure">, fetchBankAccountsList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/fetchBankAccountsList">, fetchNotificationSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/fetchNotificationSettings">, updateNotificationSettingsOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[data: NotificationSettingsPayload, loggedInUserEmail: string], {
|
|
20
23
|
data: NotificationSettingsPayload;
|
|
@@ -33,6 +36,11 @@ export declare const fetchMyProfileView: import("@reduxjs/toolkit").ActionCreato
|
|
|
33
36
|
address: AddressUpdatableInfo | undefined;
|
|
34
37
|
}, "settings/updateMyProfile", never, never>, updateMyProfileFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "settings/updateMyProfileFailure">, updateMyProfileSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/updateMyProfileSuccess">, sendOtpMyProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/sendOtpMyProfile">, sendOtpMyProfileFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "settings/sendOtpMyProfileFailure">, sendOtpMyProfileSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
35
38
|
otpChallenge: string;
|
|
36
|
-
}, "settings/sendOtpMyProfileSuccess">, resendOtpMyProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/resendOtpMyProfile">, verifyOtpMyProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/verifyOtpMyProfile">, verifyOtpMyProfileFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "settings/verifyOtpMyProfileFailure">, verifyOtpMyProfileSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/verifyOtpMyProfileSuccess">,
|
|
39
|
+
}, "settings/sendOtpMyProfileSuccess">, resendOtpMyProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/resendOtpMyProfile">, verifyOtpMyProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/verifyOtpMyProfile">, verifyOtpMyProfileFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "settings/verifyOtpMyProfileFailure">, verifyOtpMyProfileSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/verifyOtpMyProfileSuccess">, fetchCompanyBillingAddress: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, cacheOverride: boolean], {
|
|
40
|
+
companyId: string;
|
|
41
|
+
cacheOverride: boolean;
|
|
42
|
+
}, "settings/fetchCompanyBillingAddress", never, never>, fetchCompanyBillingAddressSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/fetchCompanyBillingAddressSuccess">, fetchCompanyBillingAddressFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "settings/fetchCompanyBillingAddressFailure">, saveCompanyBillingAddress: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string], {
|
|
43
|
+
companyId: string;
|
|
44
|
+
}, "settings/saveCompanyBillingAddress", never, never>, saveCompanyBillingAddressSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/saveCompanyBillingAddressSuccess">, saveCompanyBillingAddressFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "settings/saveCompanyBillingAddressFailure">, clearSettingsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settings/clearSettingsView">;
|
|
37
45
|
declare const _default: import("redux").Reducer<SettingsViewState>;
|
|
38
46
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearSettingsView = exports.verifyOtpMyProfileSuccess = exports.verifyOtpMyProfileFailure = exports.verifyOtpMyProfile = exports.resendOtpMyProfile = exports.sendOtpMyProfileSuccess = exports.sendOtpMyProfileFailure = exports.sendOtpMyProfile = exports.updateMyProfileSuccess = exports.updateMyProfileFailure = exports.updateMyProfile = exports.updateMyProfileLocalData = exports.initializeMyProfileLocalData = exports.updateSettingsViewUIState = exports.refreshQBODataFailure = exports.refreshQBODataSuccess = exports.refreshQBOData = exports.resetNotificationSettingsUpdateStatus = exports.updateNotificationSettingsOnSaveFailure = exports.updateNotificationSettingsOnSaveSuccess = exports.saveNotificationSettings = exports.resetNotificationSettingsLocalData = exports.updateNotificationSettingsLocalData = exports.updateNotificationSettingsOnFailure = exports.updateNotificationSettingsOnSuccess = exports.fetchNotificationSettings = exports.fetchBankAccountsList = exports.updateBankConnectionOnFailure = exports.updateBankConnectionOnSuccess = exports.fetchBillingAccountsView = exports.fetchBankConnectionsView = exports.updateMyProfileOnFailure = exports.updateMyProfileOnSuccess = exports.fetchNotificationSettingsView = exports.fetchMyProfile = exports.fetchMyProfileView = exports.initialState = void 0;
|
|
4
|
+
exports.clearSettingsView = exports.saveCompanyBillingAddressFailure = exports.saveCompanyBillingAddressSuccess = exports.saveCompanyBillingAddress = exports.fetchCompanyBillingAddressFailure = exports.fetchCompanyBillingAddressSuccess = exports.fetchCompanyBillingAddress = exports.verifyOtpMyProfileSuccess = exports.verifyOtpMyProfileFailure = exports.verifyOtpMyProfile = exports.resendOtpMyProfile = exports.sendOtpMyProfileSuccess = exports.sendOtpMyProfileFailure = exports.sendOtpMyProfile = exports.updateMyProfileSuccess = exports.updateMyProfileFailure = exports.updateMyProfile = exports.updateMyProfileLocalData = exports.initializeMyProfileLocalData = exports.updateSettingsViewUIState = exports.refreshQBODataFailure = exports.refreshQBODataSuccess = exports.refreshQBOData = exports.resetNotificationSettingsUpdateStatus = exports.updateNotificationSettingsOnSaveFailure = exports.updateNotificationSettingsOnSaveSuccess = exports.saveNotificationSettings = exports.resetNotificationSettingsLocalData = exports.updateNotificationSettingsLocalData = exports.updateNotificationSettingsOnFailure = exports.updateNotificationSettingsOnSuccess = exports.fetchNotificationSettings = exports.fetchBankAccountsList = exports.updateBankConnectionOnFailure = exports.updateBankConnectionOnSuccess = exports.fetchBillingAccountsView = exports.fetchBankConnectionsView = exports.updateMyProfileOnFailure = exports.updateMyProfileOnSuccess = exports.fetchNotificationSettingsView = exports.fetchMyProfile = exports.fetchMyProfileView = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const settingsViewState_1 = require("./settingsViewState");
|
|
7
7
|
const initialNotificationSettingsData = {
|
|
@@ -52,6 +52,14 @@ const initialNotificationSettingsLocalData = {
|
|
|
52
52
|
};
|
|
53
53
|
exports.initialState = {
|
|
54
54
|
profile: initialMyProfileState,
|
|
55
|
+
billingAddress: {
|
|
56
|
+
fetchState: 'Not-Started',
|
|
57
|
+
error: undefined,
|
|
58
|
+
subscriptionBillingAddressSaveStatus: {
|
|
59
|
+
fetchState: 'Not-Started',
|
|
60
|
+
error: undefined,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
55
63
|
bankConnection: {
|
|
56
64
|
fetchState: 'Not-Started',
|
|
57
65
|
error: undefined,
|
|
@@ -120,8 +128,18 @@ const settings = (0, toolkit_1.createSlice)({
|
|
|
120
128
|
};
|
|
121
129
|
},
|
|
122
130
|
},
|
|
123
|
-
fetchBillingAccountsView
|
|
124
|
-
|
|
131
|
+
fetchBillingAccountsView: {
|
|
132
|
+
reducer() {
|
|
133
|
+
// do nothing
|
|
134
|
+
},
|
|
135
|
+
prepare(companyId, cacheOverride) {
|
|
136
|
+
return {
|
|
137
|
+
payload: {
|
|
138
|
+
companyId,
|
|
139
|
+
cacheOverride,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
},
|
|
125
143
|
},
|
|
126
144
|
fetchBankAccountsList(draft) {
|
|
127
145
|
draft.bankConnection.fetchState = 'In-Progress';
|
|
@@ -278,12 +296,49 @@ const settings = (0, toolkit_1.createSlice)({
|
|
|
278
296
|
draft.profile.verifyOtpStatus.fetchState = 'Error';
|
|
279
297
|
draft.profile.verifyOtpStatus.error = action.payload;
|
|
280
298
|
},
|
|
299
|
+
fetchCompanyBillingAddress: {
|
|
300
|
+
reducer() {
|
|
301
|
+
// Do nothing.
|
|
302
|
+
},
|
|
303
|
+
prepare(companyId, cacheOverride) {
|
|
304
|
+
return { payload: { companyId, cacheOverride } };
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
fetchCompanyBillingAddressSuccess(draft) {
|
|
308
|
+
draft.billingAddress.fetchState = 'Completed';
|
|
309
|
+
draft.billingAddress.error = undefined;
|
|
310
|
+
},
|
|
311
|
+
fetchCompanyBillingAddressFailure(draft, action) {
|
|
312
|
+
draft.billingAddress.fetchState = 'Error';
|
|
313
|
+
draft.billingAddress.error = action.payload;
|
|
314
|
+
},
|
|
315
|
+
saveCompanyBillingAddress: {
|
|
316
|
+
reducer(draft) {
|
|
317
|
+
draft.billingAddress.subscriptionBillingAddressSaveStatus.fetchState =
|
|
318
|
+
'In-Progress';
|
|
319
|
+
},
|
|
320
|
+
prepare(companyId) {
|
|
321
|
+
return { payload: { companyId } };
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
saveCompanyBillingAddressSuccess(draft) {
|
|
325
|
+
draft.billingAddress.subscriptionBillingAddressSaveStatus.fetchState =
|
|
326
|
+
'Completed';
|
|
327
|
+
draft.billingAddress.subscriptionBillingAddressSaveStatus.error =
|
|
328
|
+
undefined;
|
|
329
|
+
},
|
|
330
|
+
saveCompanyBillingAddressFailure(draft, action) {
|
|
331
|
+
draft.billingAddress.subscriptionBillingAddressSaveStatus.fetchState =
|
|
332
|
+
'Error';
|
|
333
|
+
draft.billingAddress.subscriptionBillingAddressSaveStatus.error =
|
|
334
|
+
action.payload;
|
|
335
|
+
},
|
|
281
336
|
clearSettingsView(draft) {
|
|
282
337
|
Object.assign(draft, exports.initialState);
|
|
283
338
|
},
|
|
284
339
|
},
|
|
285
340
|
});
|
|
286
|
-
_a = settings.actions, exports.fetchMyProfileView = _a.fetchMyProfileView, exports.fetchMyProfile = _a.fetchMyProfile, exports.fetchNotificationSettingsView = _a.fetchNotificationSettingsView, exports.updateMyProfileOnSuccess = _a.updateMyProfileOnSuccess, exports.updateMyProfileOnFailure = _a.updateMyProfileOnFailure, exports.fetchBankConnectionsView = _a.fetchBankConnectionsView, exports.fetchBillingAccountsView = _a.fetchBillingAccountsView, exports.updateBankConnectionOnSuccess = _a.updateBankConnectionOnSuccess, exports.updateBankConnectionOnFailure = _a.updateBankConnectionOnFailure, exports.fetchBankAccountsList = _a.fetchBankAccountsList, exports.fetchNotificationSettings = _a.fetchNotificationSettings, exports.updateNotificationSettingsOnSuccess = _a.updateNotificationSettingsOnSuccess, exports.updateNotificationSettingsOnFailure = _a.updateNotificationSettingsOnFailure, exports.updateNotificationSettingsLocalData = _a.updateNotificationSettingsLocalData, exports.resetNotificationSettingsLocalData = _a.resetNotificationSettingsLocalData, exports.saveNotificationSettings = _a.saveNotificationSettings, exports.updateNotificationSettingsOnSaveSuccess = _a.updateNotificationSettingsOnSaveSuccess, exports.updateNotificationSettingsOnSaveFailure = _a.updateNotificationSettingsOnSaveFailure, exports.resetNotificationSettingsUpdateStatus = _a.resetNotificationSettingsUpdateStatus, exports.refreshQBOData = _a.refreshQBOData, exports.refreshQBODataSuccess = _a.refreshQBODataSuccess, exports.refreshQBODataFailure = _a.refreshQBODataFailure, exports.updateSettingsViewUIState = _a.updateSettingsViewUIState, exports.initializeMyProfileLocalData = _a.initializeMyProfileLocalData, exports.updateMyProfileLocalData = _a.updateMyProfileLocalData, exports.updateMyProfile = _a.updateMyProfile, exports.updateMyProfileFailure = _a.updateMyProfileFailure, exports.updateMyProfileSuccess = _a.updateMyProfileSuccess, exports.sendOtpMyProfile = _a.sendOtpMyProfile, exports.sendOtpMyProfileFailure = _a.sendOtpMyProfileFailure, exports.sendOtpMyProfileSuccess = _a.sendOtpMyProfileSuccess, exports.resendOtpMyProfile = _a.resendOtpMyProfile, exports.verifyOtpMyProfile = _a.verifyOtpMyProfile, exports.verifyOtpMyProfileFailure = _a.verifyOtpMyProfileFailure, exports.verifyOtpMyProfileSuccess = _a.verifyOtpMyProfileSuccess, exports.clearSettingsView = _a.clearSettingsView;
|
|
341
|
+
_a = settings.actions, exports.fetchMyProfileView = _a.fetchMyProfileView, exports.fetchMyProfile = _a.fetchMyProfile, exports.fetchNotificationSettingsView = _a.fetchNotificationSettingsView, exports.updateMyProfileOnSuccess = _a.updateMyProfileOnSuccess, exports.updateMyProfileOnFailure = _a.updateMyProfileOnFailure, exports.fetchBankConnectionsView = _a.fetchBankConnectionsView, exports.fetchBillingAccountsView = _a.fetchBillingAccountsView, exports.updateBankConnectionOnSuccess = _a.updateBankConnectionOnSuccess, exports.updateBankConnectionOnFailure = _a.updateBankConnectionOnFailure, exports.fetchBankAccountsList = _a.fetchBankAccountsList, exports.fetchNotificationSettings = _a.fetchNotificationSettings, exports.updateNotificationSettingsOnSuccess = _a.updateNotificationSettingsOnSuccess, exports.updateNotificationSettingsOnFailure = _a.updateNotificationSettingsOnFailure, exports.updateNotificationSettingsLocalData = _a.updateNotificationSettingsLocalData, exports.resetNotificationSettingsLocalData = _a.resetNotificationSettingsLocalData, exports.saveNotificationSettings = _a.saveNotificationSettings, exports.updateNotificationSettingsOnSaveSuccess = _a.updateNotificationSettingsOnSaveSuccess, exports.updateNotificationSettingsOnSaveFailure = _a.updateNotificationSettingsOnSaveFailure, exports.resetNotificationSettingsUpdateStatus = _a.resetNotificationSettingsUpdateStatus, exports.refreshQBOData = _a.refreshQBOData, exports.refreshQBODataSuccess = _a.refreshQBODataSuccess, exports.refreshQBODataFailure = _a.refreshQBODataFailure, exports.updateSettingsViewUIState = _a.updateSettingsViewUIState, exports.initializeMyProfileLocalData = _a.initializeMyProfileLocalData, exports.updateMyProfileLocalData = _a.updateMyProfileLocalData, exports.updateMyProfile = _a.updateMyProfile, exports.updateMyProfileFailure = _a.updateMyProfileFailure, exports.updateMyProfileSuccess = _a.updateMyProfileSuccess, exports.sendOtpMyProfile = _a.sendOtpMyProfile, exports.sendOtpMyProfileFailure = _a.sendOtpMyProfileFailure, exports.sendOtpMyProfileSuccess = _a.sendOtpMyProfileSuccess, exports.resendOtpMyProfile = _a.resendOtpMyProfile, exports.verifyOtpMyProfile = _a.verifyOtpMyProfile, exports.verifyOtpMyProfileFailure = _a.verifyOtpMyProfileFailure, exports.verifyOtpMyProfileSuccess = _a.verifyOtpMyProfileSuccess, exports.fetchCompanyBillingAddress = _a.fetchCompanyBillingAddress, exports.fetchCompanyBillingAddressSuccess = _a.fetchCompanyBillingAddressSuccess, exports.fetchCompanyBillingAddressFailure = _a.fetchCompanyBillingAddressFailure, exports.saveCompanyBillingAddress = _a.saveCompanyBillingAddress, exports.saveCompanyBillingAddressSuccess = _a.saveCompanyBillingAddressSuccess, exports.saveCompanyBillingAddressFailure = _a.saveCompanyBillingAddressFailure, exports.clearSettingsView = _a.clearSettingsView;
|
|
287
342
|
exports.default = settings.reducer;
|
|
288
343
|
/**
|
|
289
344
|
* Helpers
|
|
@@ -112,15 +112,19 @@ function getBankConnectionsSetupViewDetails(state, companyId, isBillPayEnabled,
|
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
function getBillingAccountsViewDetails(state, companyId) {
|
|
115
|
-
|
|
115
|
+
var _a;
|
|
116
|
+
const { plaidAccountViewState, settingsViewState, addressViewState } = state;
|
|
116
117
|
const { uiState } = settingsViewState;
|
|
117
118
|
const fetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
118
119
|
settingsViewState.bankConnection,
|
|
119
120
|
plaidAccountViewState['billing_setup'].accountDetails.fetchStatus,
|
|
120
121
|
]);
|
|
122
|
+
const subscriptionBillingAddress = (_a = addressViewState.newAddressState) === null || _a === void 0 ? void 0 : _a.subscription_billing_address.addressToCreate;
|
|
121
123
|
return {
|
|
122
124
|
setupView: Object.assign({}, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'billing', 'billing_setup')),
|
|
123
125
|
uiState,
|
|
126
|
+
subscriptionBillingAddress: subscriptionBillingAddress,
|
|
127
|
+
subscriptionBillingAddressSaveStatus: settingsViewState.billingAddress.subscriptionBillingAddressSaveStatus,
|
|
124
128
|
cardPaymentView: (0, cardPaymentViewSelector_1.getAllCardsAndBankPaymentMethods)(state),
|
|
125
129
|
fetchState: fetchState.fetchState,
|
|
126
130
|
};
|
|
@@ -3,6 +3,9 @@ import { ZeniDate } from '../../zeniDayJS';
|
|
|
3
3
|
interface BankConnection extends FetchStateAndError {
|
|
4
4
|
bankAccountIds: ID[];
|
|
5
5
|
}
|
|
6
|
+
interface BillingAddress extends FetchStateAndError {
|
|
7
|
+
subscriptionBillingAddressSaveStatus: FetchStateAndError;
|
|
8
|
+
}
|
|
6
9
|
export interface IntegrationsSettings {
|
|
7
10
|
refreshQBO: FetchStateAndError;
|
|
8
11
|
}
|
|
@@ -66,6 +69,7 @@ export interface SettingsViewState {
|
|
|
66
69
|
notification: NotificationSettings;
|
|
67
70
|
integrations: IntegrationsSettings;
|
|
68
71
|
uiState: SettingsViewUIState;
|
|
72
|
+
billingAddress: BillingAddress;
|
|
69
73
|
}
|
|
70
74
|
export type SettingsViewUIState = {
|
|
71
75
|
isCardPaymentPopupOpen: boolean;
|
|
@@ -9,7 +9,7 @@ import { PaymentAccount } from '../../../entity/paymentAccount/paymentAccountSta
|
|
|
9
9
|
import { TenantExternalConnections } from '../../../entity/tenant/tenantState';
|
|
10
10
|
import { User } from '../../../entity/user/userState';
|
|
11
11
|
import { UserRole } from '../../../entity/userRole/userRoleState';
|
|
12
|
-
import { NewAddressData } from '../../addressView/addressViewState';
|
|
12
|
+
import { AddressUpdatableInfo, NewAddressData } from '../../addressView/addressViewState';
|
|
13
13
|
import { CardPaymentSelectorView } from '../../cardPayment/cardPaymentViewSelector';
|
|
14
14
|
import { Person } from '../../people/peopleSelectorTypes';
|
|
15
15
|
import { FundingAccount, SetupView } from '../../spendManagement/commonSetup/setupViewSelector';
|
|
@@ -50,6 +50,8 @@ export interface BillingView extends FetchStateAndError {
|
|
|
50
50
|
setupView: SetupView;
|
|
51
51
|
cardPaymentView: CardPaymentSelectorView;
|
|
52
52
|
uiState: SettingsViewUIState;
|
|
53
|
+
subscriptionBillingAddressSaveStatus: FetchStateAndError;
|
|
54
|
+
subscriptionBillingAddress?: AddressUpdatableInfo;
|
|
53
55
|
}
|
|
54
56
|
export interface ProductWisePrimaryAccount extends SetupView {
|
|
55
57
|
productType: SpendManagementEntityType;
|
package/lib/view/spendManagement/commonSetup/epic/setup/updateSetupViewLocalStoreDataEpic.js
CHANGED
|
@@ -134,5 +134,9 @@ function toSetupViewLocalData(company, users, userRoles, primaryContact) {
|
|
|
134
134
|
areAdditionalDocumentsSubmittedForVerification: false,
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
-
return {
|
|
137
|
+
return {
|
|
138
|
+
companyDetails,
|
|
139
|
+
officers,
|
|
140
|
+
primaryContactDetails,
|
|
141
|
+
};
|
|
138
142
|
}
|
|
@@ -62,6 +62,7 @@ export interface CompanyDetailsVerificationPayload {
|
|
|
62
62
|
company_inc_type: string;
|
|
63
63
|
company_inc_date: string | null;
|
|
64
64
|
is_new_company_industry_verified: boolean;
|
|
65
|
+
subscription_billing_address?: AddressUpdatableInfoPayload;
|
|
65
66
|
}
|
|
66
67
|
export interface BusinessVerificationDataPayload {
|
|
67
68
|
company_officer: Partial<CompanyOfficerVerificationPayload> | Partial<NewCompanyOfficerVerificationPayload>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.61",
|
|
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",
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"create-release-branch": "chmod +x ./scripts/create_release_branch.sh && ./scripts/create_release_branch.sh",
|
|
97
97
|
"bump-update-web-app-cockpit-beta": "chmod +x ./scripts/bump_and_update_web_app_ui_beta.sh && ./scripts/bump_and_update_web_app_ui_beta.sh",
|
|
98
98
|
"send-release-notes": "chmod +x ./scripts/send_release_notes.sh && ./scripts/send_release_notes.sh",
|
|
99
|
-
"update-slack-group-topic": "chmod +x ./scripts/update-slack-group-topic.sh && ./scripts/update-slack-group-topic.sh"
|
|
99
|
+
"update-slack-group-topic": "chmod +x ./scripts/update-slack-group-topic.sh && ./scripts/update-slack-group-topic.sh",
|
|
100
|
+
"build-beta-and-copy": "chmod +x ./scripts/build_and_copy.sh && ./scripts/build_and_copy.sh"
|
|
100
101
|
}
|
|
101
102
|
}
|