@zeniai/client-epic-state 4.13.44 → 4.13.46
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/commonStateTypes/timePeriod.d.ts +1 -0
- package/lib/commonStateTypes/timePeriod.js +8 -1
- package/lib/entity/tenant/epic/fetchAllTenantsEpic.js +2 -2
- package/lib/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/tenant/tenantReducer.js +4 -0
- package/lib/entity/tenant/tenantState.d.ts +2 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +2 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +2 -1
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.js +2 -2
- package/package.json +1 -1
|
@@ -27,6 +27,7 @@ export interface MonthYearPeriod {
|
|
|
27
27
|
}
|
|
28
28
|
export declare type MonthYearPeriodId = `${Month}_${number}`;
|
|
29
29
|
export declare type MonthYearPeriodQuery = `${Month}-${number}`;
|
|
30
|
+
export declare const toMonthYearPeriod: (periodPayload: string) => MonthYearPeriod;
|
|
30
31
|
export declare const toMonthYearPeriodQuery: (selectedPeriod: MonthYearPeriod) => MonthYearPeriodQuery;
|
|
31
32
|
export declare const toMonthYearPeriodId: (selectedPeriod: MonthYearPeriod) => MonthYearPeriodId;
|
|
32
33
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toString = exports.toAbsoluteDay = exports.convertToPeriod = exports.toMonthYearPeriodId = exports.toMonthYearPeriodQuery = exports.toQuarterStrict = exports.toQuarter = exports.getMonthFromMonthName = exports.toMonthStrict = exports.toMonth = exports.LAST_SCHEDULE_DAY_OF_MONTH = exports.MAX_SCHEDULE_DAY_OF_MONTH = exports.MIN_SCHEDULE_DAY_OF_MONTH = exports.toScheduleDaysOfMonth = exports.SCHEDULE_DAYS_OF_MONTH = void 0;
|
|
3
|
+
exports.toString = exports.toAbsoluteDay = exports.convertToPeriod = exports.toMonthYearPeriodId = exports.toMonthYearPeriodQuery = exports.toMonthYearPeriod = exports.toQuarterStrict = exports.toQuarter = exports.getMonthFromMonthName = exports.toMonthStrict = exports.toMonth = exports.LAST_SCHEDULE_DAY_OF_MONTH = exports.MAX_SCHEDULE_DAY_OF_MONTH = exports.MIN_SCHEDULE_DAY_OF_MONTH = exports.toScheduleDaysOfMonth = exports.SCHEDULE_DAYS_OF_MONTH = void 0;
|
|
4
4
|
const zeniDayJS_1 = require("../zeniDayJS");
|
|
5
5
|
const formatZeniDateFY_1 = require("./fiscalYearHelpers/formatZeniDateFY");
|
|
6
6
|
const numberToUnion_1 = require("./numberToUnion");
|
|
@@ -38,6 +38,13 @@ const toQuarter = (n) => (0, numberToUnion_1.numberToUnion)(n, allQuarters);
|
|
|
38
38
|
exports.toQuarter = toQuarter;
|
|
39
39
|
const toQuarterStrict = (n) => (0, numberToUnion_1.numberToUnionStrict)(n, allQuarters);
|
|
40
40
|
exports.toQuarterStrict = toQuarterStrict;
|
|
41
|
+
const toMonthYearPeriod = (periodPayload) => {
|
|
42
|
+
return {
|
|
43
|
+
month: (0, exports.toMonth)(Number(periodPayload.split('-')[0])),
|
|
44
|
+
year: Number(periodPayload.split('-')[1]),
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
exports.toMonthYearPeriod = toMonthYearPeriod;
|
|
41
48
|
const toMonthYearPeriodQuery = (selectedPeriod) => {
|
|
42
49
|
const { month, year } = selectedPeriod;
|
|
43
50
|
return `${month}-${year}`;
|
|
@@ -58,8 +58,8 @@ const defaultMonthYearPeriod = {
|
|
|
58
58
|
};
|
|
59
59
|
const getDefaultSelectedPeriodsForTenants = (tenantsData) => {
|
|
60
60
|
const defaultSelectedPeriodsForTenants = tenantsData.tenants.reduce((prev, currentTenant) => {
|
|
61
|
-
const monthYearPeriod = currentTenant.
|
|
62
|
-
? (0,
|
|
61
|
+
const monthYearPeriod = currentTenant.zeni_book_close_month_and_year != null
|
|
62
|
+
? (0, timePeriod_1.toMonthYearPeriod)(currentTenant.zeni_book_close_month_and_year)
|
|
63
63
|
: defaultMonthYearPeriod;
|
|
64
64
|
return Object.assign(Object.assign({}, prev), { [currentTenant.tenant_id]: monthYearPeriod });
|
|
65
65
|
}, {});
|
|
@@ -9,6 +9,7 @@ const toolkit_1 = require("@reduxjs/toolkit");
|
|
|
9
9
|
const assignWith_1 = __importDefault(require("lodash/assignWith"));
|
|
10
10
|
const js_base64_1 = require("js-base64");
|
|
11
11
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
12
|
+
const timePeriod_1 = require("../../commonStateTypes/timePeriod");
|
|
12
13
|
const urlPayload_1 = require("../../commonPayloadTypes/urlPayload");
|
|
13
14
|
const userRolePayload_1 = require("../userRole/userRolePayload");
|
|
14
15
|
const subscriptionSummaryReducer_1 = require("../subscription/subscriptionSummary/subscriptionSummaryReducer");
|
|
@@ -403,6 +404,9 @@ function mapTenantPayloadToTenant(payload, userTenantPayload) {
|
|
|
403
404
|
zeniBookCloseDate: payload.zeni_book_close_date != null
|
|
404
405
|
? (0, zeniDayJS_1.date)(payload.zeni_book_close_date)
|
|
405
406
|
: undefined,
|
|
407
|
+
zeniBookCloseMonthAndYear: payload.zeni_book_close_month_and_year != null
|
|
408
|
+
? (0, timePeriod_1.toMonthYearPeriod)(payload.zeni_book_close_month_and_year)
|
|
409
|
+
: undefined,
|
|
406
410
|
};
|
|
407
411
|
return tenant;
|
|
408
412
|
}
|
|
@@ -2,6 +2,7 @@ import { ID, FetchedState, FetchState, FetchStateAndError } from '../../commonSt
|
|
|
2
2
|
import { AccountingMethod } from '../../view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardSelectorTypes';
|
|
3
3
|
import { AverageMonthsCount, TimeSpanIdForAverage } from '../../view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardState';
|
|
4
4
|
import { ZeniDate } from '../../zeniDayJS';
|
|
5
|
+
import { MonthYearPeriod } from '../../commonStateTypes/timePeriod';
|
|
5
6
|
import ZeniUrl from '../../zeniUrl';
|
|
6
7
|
import { UserReimbursementInfo } from '../company/companyStateTypes';
|
|
7
8
|
import { SubscriptionSummary } from '../subscription/subscriptionSummary/subscriptionSummaryState';
|
|
@@ -71,6 +72,7 @@ export interface Tenant {
|
|
|
71
72
|
userReimbursementInfo?: UserReimbursementInfo;
|
|
72
73
|
rewardsLastViewedTime?: ZeniDate;
|
|
73
74
|
zeniBookCloseDate?: ZeniDate;
|
|
75
|
+
zeniBookCloseMonthAndYear?: MonthYearPeriod;
|
|
74
76
|
}
|
|
75
77
|
export interface LoggedInUser {
|
|
76
78
|
userId: ID;
|
|
@@ -4,12 +4,14 @@ import { UserPayload } from '../../../../entity/user/userPayload';
|
|
|
4
4
|
import { UserRolePayload } from '../../../../entity/userRole/userRolePayload';
|
|
5
5
|
import { AddressPayload } from '../../../../entity/address/addressPayload';
|
|
6
6
|
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
7
|
+
import { ActiveChargeCardCountPayload } from '../../../../view/userListView/userListViewPayload';
|
|
7
8
|
export interface ChargeCardListPayload {
|
|
8
9
|
cards: ChargeCardPayload[];
|
|
9
10
|
unassigned_credit?: AmountPayload;
|
|
10
11
|
users: UserPayload[];
|
|
11
12
|
user_roles: UserRolePayload[];
|
|
12
13
|
addresses: AddressPayload[];
|
|
14
|
+
cards_count_by_user_id?: ActiveChargeCardCountPayload[];
|
|
13
15
|
}
|
|
14
16
|
export declare type FetchChargeCardListResponse = ZeniAPIResponse<ChargeCardListPayload>;
|
|
15
17
|
export interface CreditAccountPayload {
|
|
@@ -7,7 +7,7 @@ import { updateAllUsers } from '../../../../entity/user/userReducer';
|
|
|
7
7
|
import { updateUserRoles } from '../../../../entity/userRole/userRoleReducer';
|
|
8
8
|
import { updateAddresses } from '../../../../entity/address/addressReducer';
|
|
9
9
|
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
10
|
-
import { issueChargeCards, issueChargeCardSuccessOrFailure } from './issueChargeCardReducer';
|
|
10
|
+
import { issueChargeCards, updateCardCount, issueChargeCardSuccessOrFailure } from './issueChargeCardReducer';
|
|
11
11
|
import { updateChargeCardList } from '../chargeCardList/chargeCardListReducer';
|
|
12
|
-
export declare type ActionType = ReturnType<typeof issueChargeCards> | ReturnType<typeof updateChargeCards> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCardList> | ReturnType<typeof issueChargeCardSuccessOrFailure> | ReturnType<typeof updateAddresses>;
|
|
12
|
+
export declare type ActionType = ReturnType<typeof issueChargeCards> | ReturnType<typeof updateChargeCards> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCardList> | ReturnType<typeof updateCardCount> | ReturnType<typeof issueChargeCardSuccessOrFailure> | ReturnType<typeof updateAddresses>;
|
|
13
13
|
export declare const issueChargeCardEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -44,12 +44,13 @@ const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
44
44
|
return zeniAPI
|
|
45
45
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards`, { cards: payload })
|
|
46
46
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
47
|
+
var _a, _b;
|
|
47
48
|
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
48
49
|
const actions = [];
|
|
49
50
|
actions.push((0, chargeCardReducer_1.updateChargeCards)(response.data.cards), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, chargeCardListReducer_1.updateChargeCardList)({
|
|
50
51
|
chargeCardListPayload: response.data,
|
|
51
52
|
keepExistingListItems: true,
|
|
52
|
-
}), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0, issueChargeCardReducer_1.issueChargeCardSuccessOrFailure)({ fetchState: 'Completed' }));
|
|
53
|
+
}), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0, issueChargeCardReducer_1.updateCardCount)((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.cards_count_by_user_id) !== null && _b !== void 0 ? _b : []), (0, issueChargeCardReducer_1.issueChargeCardSuccessOrFailure)({ fetchState: 'Completed' }));
|
|
53
54
|
const cardHolderIds = response.data.cards.map((card) => card.holder_user_id);
|
|
54
55
|
const names = response.data.users
|
|
55
56
|
.filter((user) => cardHolderIds.includes(user.user_id))
|
|
@@ -11,9 +11,9 @@ export interface ActiveChargeCardCount {
|
|
|
11
11
|
virtualCardCount: number;
|
|
12
12
|
}
|
|
13
13
|
export interface PhysicalCardData {
|
|
14
|
-
addressType: ShippingAddressType;
|
|
15
14
|
cardName: string;
|
|
16
15
|
frequency: CreditLimitFrequencyCodeType;
|
|
16
|
+
addressType?: ShippingAddressType;
|
|
17
17
|
addressId?: ID;
|
|
18
18
|
amount?: Amount;
|
|
19
19
|
userId?: ID;
|
|
@@ -6,12 +6,12 @@ exports.initialIssueChargeCardLocalData = [
|
|
|
6
6
|
lineId: '1',
|
|
7
7
|
cardType: 'business_virtual_credit_card',
|
|
8
8
|
physicalCard: {
|
|
9
|
-
|
|
9
|
+
userId: undefined,
|
|
10
10
|
cardName: '',
|
|
11
11
|
frequency: 'monthly',
|
|
12
|
+
addressType: undefined,
|
|
12
13
|
addressId: undefined,
|
|
13
14
|
amount: undefined,
|
|
14
|
-
userId: undefined,
|
|
15
15
|
},
|
|
16
16
|
virtualCard: {
|
|
17
17
|
userIds: [],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.46",
|
|
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",
|