@zeniai/client-epic-state 4.8.73 → 4.8.75
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/viewAndReport/viewAndReport.d.ts +1 -0
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +3 -3
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
- package/lib/entity/tenant/clearAllEpic.js +2 -0
- package/lib/epic.d.ts +7 -1
- package/lib/epic.js +7 -1
- package/lib/index.d.ts +15 -7
- package/lib/index.js +35 -12
- package/lib/init.js +1 -1
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +6 -0
- package/lib/view/auditReportView/auditReportViewHelper.d.ts +12 -0
- package/lib/view/auditReportView/auditReportViewHelper.js +79 -0
- package/lib/view/auditReportView/auditReportViewPayload.d.ts +53 -0
- package/lib/view/auditReportView/auditReportViewPayload.js +2 -0
- package/lib/view/auditReportView/auditReportViewReducer.d.ts +27 -0
- package/lib/view/auditReportView/auditReportViewReducer.js +121 -0
- package/lib/view/auditReportView/auditReportViewSelector.d.ts +22 -0
- package/lib/view/auditReportView/auditReportViewSelector.js +34 -0
- package/lib/view/auditReportView/auditReportViewState.d.ts +71 -0
- package/lib/view/auditReportView/auditReportViewState.js +22 -0
- package/lib/view/auditReportView/epics/fetchAuditReportGroupViewEpic.d.ts +7 -0
- package/lib/view/auditReportView/epics/fetchAuditReportGroupViewEpic.js +54 -0
- package/lib/view/auditReportView/epics/fetchAuditRuleGroupViewEpic.d.ts +7 -0
- package/lib/view/auditReportView/epics/fetchAuditRuleGroupViewEpic.js +39 -0
- package/lib/view/companyView/types/cockpitTypes.d.ts +2 -0
- package/lib/view/companyView/types/cockpitTypes.js +9 -1
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/referralView/epics/fetchReferralsEpic.d.ts +7 -0
- package/lib/view/referralView/epics/fetchReferralsEpic.js +36 -0
- package/lib/view/referralView/epics/fetchRewardsPlanEpic.d.ts +7 -0
- package/lib/view/referralView/epics/fetchRewardsPlanEpic.js +41 -0
- package/lib/view/referralView/epics/resendReferralInviteEpic.d.ts +8 -0
- package/lib/view/referralView/epics/resendReferralInviteEpic.js +39 -0
- package/lib/view/referralView/epics/sendReferralInviteEpic.d.ts +8 -0
- package/lib/view/referralView/epics/sendReferralInviteEpic.js +52 -0
- package/lib/view/referralView/referralPayload.d.ts +43 -0
- package/lib/view/referralView/referralPayload.js +33 -0
- package/lib/view/referralView/referralReducer.d.ts +23 -0
- package/lib/view/referralView/referralReducer.js +162 -0
- package/lib/view/referralView/referralSelector.d.ts +21 -0
- package/lib/view/referralView/referralSelector.js +76 -0
- package/lib/view/referralView/referralState.d.ts +54 -0
- package/lib/view/referralView/referralState.js +37 -0
- package/lib/view/reviewCompanyView/reviewCompanyPayload.d.ts +25 -1
- package/lib/view/reviewCompanyView/reviewCompanyViewSelector.d.ts +1 -0
- package/lib/view/reviewCompanyView/reviewCompanyViewSelector.js +31 -8
- package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +12 -4
- package/lib/view/reviewCompanyView/reviewCompanyViewState.js +15 -5
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.updateRewardsPlanFailure = exports.updateRewardsPlan = exports.fetchRewardsPlan = exports.clearReferrals = exports.resendReferralInviteSuccess = exports.resendReferralInvite = exports.sendReferralInviteFailure = exports.sendReferralInviteSuccess = exports.sendReferralInvite = exports.clearReferralFormDataInLocalStore = exports.saveReferralFormDataInLocalStore = exports.updateReferralsFailure = exports.updateReferralListSortUiState = exports.updateReferrals = exports.fetchReferrals = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const referralPayload_1 = require("./referralPayload");
|
|
7
|
+
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
8
|
+
const amount_1 = require("../../commonStateTypes/amount");
|
|
9
|
+
const zeniUrl_1 = require("../../zeniUrl");
|
|
10
|
+
exports.initialState = {
|
|
11
|
+
fetchState: 'Not-Started',
|
|
12
|
+
error: undefined,
|
|
13
|
+
hasValidState() {
|
|
14
|
+
return this.fetchState === 'Completed';
|
|
15
|
+
},
|
|
16
|
+
earnedBonus: {
|
|
17
|
+
amount: 0,
|
|
18
|
+
currencyCode: 'USD',
|
|
19
|
+
currencySymbol: '$',
|
|
20
|
+
},
|
|
21
|
+
pendingBonus: {
|
|
22
|
+
amount: 0,
|
|
23
|
+
currencyCode: 'USD',
|
|
24
|
+
currencySymbol: '$',
|
|
25
|
+
},
|
|
26
|
+
pendingReferrals: 0,
|
|
27
|
+
invitations: [],
|
|
28
|
+
referralFormLocalData: [
|
|
29
|
+
{
|
|
30
|
+
companyName: '',
|
|
31
|
+
emailIds: [],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
sendInviteState: {
|
|
35
|
+
fetchState: 'Not-Started',
|
|
36
|
+
},
|
|
37
|
+
uiState: {
|
|
38
|
+
sortKey: 'invitee_email',
|
|
39
|
+
sortOrder: 'descending', //default sort order
|
|
40
|
+
},
|
|
41
|
+
referalUniqueLink: (0, zeniUrl_1.toZeniUrl)(''),
|
|
42
|
+
rewardsPlanFetchState: {
|
|
43
|
+
fetchState: 'Not-Started',
|
|
44
|
+
error: undefined,
|
|
45
|
+
},
|
|
46
|
+
rewardsPlan: {
|
|
47
|
+
amount: {
|
|
48
|
+
amount: 0,
|
|
49
|
+
currencyCode: 'USD',
|
|
50
|
+
currencySymbol: '$',
|
|
51
|
+
},
|
|
52
|
+
referRewardPlanId: 'dummy',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
const referral = (0, toolkit_1.createSlice)({
|
|
56
|
+
name: 'referral',
|
|
57
|
+
initialState: exports.initialState,
|
|
58
|
+
reducers: {
|
|
59
|
+
fetchReferrals: {
|
|
60
|
+
reducer(draft) {
|
|
61
|
+
draft.fetchState = 'In-Progress';
|
|
62
|
+
draft.error = undefined;
|
|
63
|
+
},
|
|
64
|
+
prepare(cacheOverride = false) {
|
|
65
|
+
return {
|
|
66
|
+
payload: { cacheOverride },
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
updateReferrals(draft, action) {
|
|
71
|
+
draft.fetchState = 'Completed';
|
|
72
|
+
draft.error = undefined;
|
|
73
|
+
draft.earnedBonus = (0, amount_1.toAmount)(action.payload.earned_bonus.amount, action.payload.earned_bonus.currency_code, action.payload.earned_bonus.currency_symbol);
|
|
74
|
+
draft.pendingBonus = (0, amount_1.toAmount)(action.payload.pending_bonus.amount, action.payload.pending_bonus.currency_code, action.payload.pending_bonus.currency_symbol);
|
|
75
|
+
draft.pendingReferrals = action.payload.pending_referals;
|
|
76
|
+
draft.referalUniqueLink = (0, zeniUrl_1.toZeniUrl)(action.payload.static_referal_link);
|
|
77
|
+
draft.invitations = (0, referralPayload_1.toReferralInvitation)(action.payload.referees);
|
|
78
|
+
},
|
|
79
|
+
updateReferralsFailure(draft, action) {
|
|
80
|
+
draft.fetchState = 'Error';
|
|
81
|
+
draft.error = action.payload;
|
|
82
|
+
},
|
|
83
|
+
updateReferralListSortUiState(draft, action) {
|
|
84
|
+
draft.uiState = {
|
|
85
|
+
sortKey: action.payload.sortkey,
|
|
86
|
+
sortOrder: action.payload.sortOrder,
|
|
87
|
+
};
|
|
88
|
+
if (action.payload.scrollYOffset != null) {
|
|
89
|
+
draft.uiState.scrollYOffset = action.payload.scrollYOffset;
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
saveReferralFormDataInLocalStore(draft, action) {
|
|
93
|
+
draft.referralFormLocalData = action.payload.localData;
|
|
94
|
+
},
|
|
95
|
+
clearReferralFormDataInLocalStore(draft) {
|
|
96
|
+
draft.referralFormLocalData = exports.initialState.referralFormLocalData;
|
|
97
|
+
},
|
|
98
|
+
sendReferralInvite(draft) {
|
|
99
|
+
draft.sendInviteState.fetchState = 'In-Progress';
|
|
100
|
+
draft.sendInviteState.error = undefined;
|
|
101
|
+
},
|
|
102
|
+
sendReferralInviteSuccess(draft) {
|
|
103
|
+
draft.sendInviteState.fetchState = 'Completed';
|
|
104
|
+
draft.sendInviteState.error = undefined;
|
|
105
|
+
},
|
|
106
|
+
sendReferralInviteFailure(draft, action) {
|
|
107
|
+
draft.sendInviteState.fetchState = 'Error';
|
|
108
|
+
draft.sendInviteState.error = action.payload;
|
|
109
|
+
},
|
|
110
|
+
resendReferralInvite: {
|
|
111
|
+
prepare(emailId) {
|
|
112
|
+
return { payload: { emailId } };
|
|
113
|
+
},
|
|
114
|
+
reducer(draft, action) {
|
|
115
|
+
const inviteeIndex = draft.invitations.findIndex((invitee) => invitee.refereeEmailId === action.payload.emailId);
|
|
116
|
+
if (inviteeIndex > -1) {
|
|
117
|
+
draft.invitations[inviteeIndex] = Object.assign(Object.assign({}, draft.invitations[inviteeIndex]), { resendInviteStatus: {
|
|
118
|
+
fetchState: 'In-Progress',
|
|
119
|
+
error: undefined,
|
|
120
|
+
} });
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
resendReferralInviteSuccess(draft, action) {
|
|
125
|
+
const inviteeIndex = draft.invitations.findIndex((invitee) => invitee.refereeEmailId === action.payload.emailId);
|
|
126
|
+
if (inviteeIndex > -1) {
|
|
127
|
+
draft.invitations[inviteeIndex] = Object.assign(Object.assign({}, draft.invitations[inviteeIndex]), { resendInviteStatus: {
|
|
128
|
+
fetchState: 'Completed',
|
|
129
|
+
error: undefined,
|
|
130
|
+
}, lastInviteTimestamp: action.payload.timestamp != null
|
|
131
|
+
? (0, zeniDayJS_1.date)(action.payload.timestamp)
|
|
132
|
+
: undefined });
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
fetchRewardsPlan: {
|
|
136
|
+
reducer(draft) {
|
|
137
|
+
draft.rewardsPlanFetchState.fetchState = 'In-Progress';
|
|
138
|
+
draft.rewardsPlanFetchState.error = undefined;
|
|
139
|
+
},
|
|
140
|
+
prepare(cacheOverride = false) {
|
|
141
|
+
return {
|
|
142
|
+
payload: { cacheOverride },
|
|
143
|
+
};
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
updateRewardsPlan(draft, action) {
|
|
147
|
+
draft.rewardsPlanFetchState.fetchState = 'Completed';
|
|
148
|
+
draft.rewardsPlanFetchState.error = undefined;
|
|
149
|
+
draft.rewardsPlan.amount = (0, amount_1.toAmount)(action.payload.referral_plan_amount.amount, action.payload.referral_plan_amount.currency_code, action.payload.referral_plan_amount.currency_symbol);
|
|
150
|
+
draft.rewardsPlan.referRewardPlanId = action.payload.refer_reward_plan_id;
|
|
151
|
+
},
|
|
152
|
+
updateRewardsPlanFailure(draft, action) {
|
|
153
|
+
draft.rewardsPlanFetchState.fetchState = 'Error';
|
|
154
|
+
draft.rewardsPlanFetchState.error = action.payload;
|
|
155
|
+
},
|
|
156
|
+
clearReferrals(draft) {
|
|
157
|
+
Object.assign(draft, exports.initialState);
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
_a = referral.actions, exports.fetchReferrals = _a.fetchReferrals, exports.updateReferrals = _a.updateReferrals, exports.updateReferralListSortUiState = _a.updateReferralListSortUiState, exports.updateReferralsFailure = _a.updateReferralsFailure, exports.saveReferralFormDataInLocalStore = _a.saveReferralFormDataInLocalStore, exports.clearReferralFormDataInLocalStore = _a.clearReferralFormDataInLocalStore, exports.sendReferralInvite = _a.sendReferralInvite, exports.sendReferralInviteSuccess = _a.sendReferralInviteSuccess, exports.sendReferralInviteFailure = _a.sendReferralInviteFailure, exports.resendReferralInvite = _a.resendReferralInvite, exports.resendReferralInviteSuccess = _a.resendReferralInviteSuccess, exports.clearReferrals = _a.clearReferrals, exports.fetchRewardsPlan = _a.fetchRewardsPlan, exports.updateRewardsPlan = _a.updateRewardsPlan, exports.updateRewardsPlanFailure = _a.updateRewardsPlanFailure;
|
|
162
|
+
exports.default = referral.reducer;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RootState } from '../../reducer';
|
|
2
|
+
import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
+
import { InviteCompanyLocalData, ReferralInvitation, ReferralViewUIState } from './referralState';
|
|
4
|
+
import { Amount } from '../../commonStateTypes/amount';
|
|
5
|
+
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
6
|
+
import ZeniUrl from '../../zeniUrl';
|
|
7
|
+
export interface ReferralListSelectorView extends SelectorView {
|
|
8
|
+
earnedBonus: Amount;
|
|
9
|
+
pendingBonus: Amount;
|
|
10
|
+
pendingReferrals: number;
|
|
11
|
+
referralLink: ZeniUrl;
|
|
12
|
+
invitations: ReferralInvitation[];
|
|
13
|
+
uiState: ReferralViewUIState;
|
|
14
|
+
}
|
|
15
|
+
export interface InviteFormSelectorView extends SelectorView {
|
|
16
|
+
localData: InviteCompanyLocalData[];
|
|
17
|
+
saveStatus: FetchStateAndError;
|
|
18
|
+
amount: Amount;
|
|
19
|
+
}
|
|
20
|
+
export declare const getReferralListView: (state: RootState) => ReferralListSelectorView;
|
|
21
|
+
export declare const getInviteFormView: (state: RootState) => InviteFormSelectorView;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getInviteFormView = exports.getReferralListView = void 0;
|
|
7
|
+
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
8
|
+
const getReferralListView = (state) => {
|
|
9
|
+
const { referralViewState } = state;
|
|
10
|
+
const { fetchState, error } = referralViewState;
|
|
11
|
+
const unsortedInvitations = referralViewState.invitations;
|
|
12
|
+
const invitationsWithNoSortKeyValue = [];
|
|
13
|
+
const invitationsWithSortKeyValue = [];
|
|
14
|
+
const { sortKey, sortOrder } = referralViewState.uiState;
|
|
15
|
+
unsortedInvitations.forEach((invitation) => {
|
|
16
|
+
switch (sortKey) {
|
|
17
|
+
case 'invitee_email':
|
|
18
|
+
if (Boolean(invitation.refereeEmailId) === true) {
|
|
19
|
+
invitationsWithSortKeyValue.push(invitation);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
invitationsWithNoSortKeyValue.push(invitation);
|
|
23
|
+
}
|
|
24
|
+
break;
|
|
25
|
+
case 'amount':
|
|
26
|
+
if (Boolean(invitation.amount) === true) {
|
|
27
|
+
invitationsWithSortKeyValue.push(invitation);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
invitationsWithNoSortKeyValue.push(invitation);
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
33
|
+
case 'status':
|
|
34
|
+
if (Boolean(invitation.currentState) === true) {
|
|
35
|
+
invitationsWithSortKeyValue.push(invitation);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
invitationsWithNoSortKeyValue.push(invitation);
|
|
39
|
+
}
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const sortedInvitations = (0, orderBy_1.default)(invitationsWithSortKeyValue, (invitation) => {
|
|
44
|
+
switch (sortKey) {
|
|
45
|
+
case 'invitee_email':
|
|
46
|
+
return invitation.refereeEmailId.toLowerCase();
|
|
47
|
+
case 'amount':
|
|
48
|
+
return invitation.amount.amount;
|
|
49
|
+
case 'status':
|
|
50
|
+
return invitation.currentState.toLowerCase();
|
|
51
|
+
}
|
|
52
|
+
}, sortOrder === 'ascending' ? 'asc' : 'desc');
|
|
53
|
+
return {
|
|
54
|
+
earnedBonus: referralViewState.earnedBonus,
|
|
55
|
+
pendingBonus: referralViewState.pendingBonus,
|
|
56
|
+
pendingReferrals: referralViewState.pendingReferrals,
|
|
57
|
+
referralLink: referralViewState.referalUniqueLink,
|
|
58
|
+
invitations: sortedInvitations,
|
|
59
|
+
uiState: referralViewState.uiState,
|
|
60
|
+
fetchState,
|
|
61
|
+
error,
|
|
62
|
+
amount: referralViewState.rewardsPlan.amount,
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
exports.getReferralListView = getReferralListView;
|
|
66
|
+
const getInviteFormView = (state) => {
|
|
67
|
+
const { referralViewState } = state;
|
|
68
|
+
return {
|
|
69
|
+
localData: referralViewState.referralFormLocalData,
|
|
70
|
+
saveStatus: referralViewState.sendInviteState,
|
|
71
|
+
amount: referralViewState.rewardsPlan.amount,
|
|
72
|
+
fetchState: referralViewState.rewardsPlanFetchState.fetchState,
|
|
73
|
+
error: referralViewState.rewardsPlanFetchState.error,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
exports.getInviteFormView = getInviteFormView;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Amount } from '../../commonStateTypes/amount';
|
|
2
|
+
import { FetchStateAndError, FetchedState, ID } from '../../commonStateTypes/common';
|
|
3
|
+
import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
4
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
5
|
+
import ZeniUrl from '../../zeniUrl';
|
|
6
|
+
export interface ReferralInvitation {
|
|
7
|
+
companyName: string;
|
|
8
|
+
currentState: string;
|
|
9
|
+
inviteesId: ID;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
lastInviteTimestamp?: ZeniDate;
|
|
12
|
+
refereeEmailId: string;
|
|
13
|
+
rewardPlan: string;
|
|
14
|
+
userId: ID;
|
|
15
|
+
voucherId: ID;
|
|
16
|
+
amount: Amount;
|
|
17
|
+
resendInviteStatus: FetchStateAndError;
|
|
18
|
+
}
|
|
19
|
+
export interface ReferralViewState extends FetchedState {
|
|
20
|
+
earnedBonus: Amount;
|
|
21
|
+
pendingBonus: Amount;
|
|
22
|
+
pendingReferrals: number;
|
|
23
|
+
invitations: ReferralInvitation[];
|
|
24
|
+
referralFormLocalData: InviteCompanyLocalData[];
|
|
25
|
+
referalUniqueLink: ZeniUrl;
|
|
26
|
+
sendInviteState: FetchStateAndError;
|
|
27
|
+
uiState: ReferralViewUIState;
|
|
28
|
+
rewardsPlanFetchState: FetchStateAndError;
|
|
29
|
+
rewardsPlan: RewardsPlanData;
|
|
30
|
+
}
|
|
31
|
+
export interface ReferralViewUIState {
|
|
32
|
+
sortOrder: SortOrder;
|
|
33
|
+
sortKey: ReferralListViewSortKey;
|
|
34
|
+
scrollYOffset?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface RewardsPlanData {
|
|
37
|
+
amount: Amount;
|
|
38
|
+
referRewardPlanId: ID;
|
|
39
|
+
}
|
|
40
|
+
export interface InviteCompanyLocalData {
|
|
41
|
+
companyName: string;
|
|
42
|
+
emailIds: string[];
|
|
43
|
+
}
|
|
44
|
+
export declare const REFERRAL_LIST_VIEW_SORT_KEYS: readonly ["invitee_email", "amount", "status"];
|
|
45
|
+
export declare const toReferralListViewSortKeyType: (v: string) => "status" | "amount" | "invitee_email";
|
|
46
|
+
export declare type ReferralListViewSortKey = ReturnType<typeof toReferralListViewSortKeyType>;
|
|
47
|
+
export declare const ALL_REFERRAL_STATUSES: readonly ["invite_sent", "onboarding", "active", "declined", "resend_invite"];
|
|
48
|
+
export declare const toReferralStatusType: (v: string) => "active" | "onboarding" | "invite_sent" | "declined" | "resend_invite";
|
|
49
|
+
export declare type ReferralStatus = ReturnType<typeof toReferralStatusType>;
|
|
50
|
+
export declare const StatusTypes: Record<ReferralStatus, string>;
|
|
51
|
+
export declare const ALL_REFERRAL_AMOUNT_STATUSES: readonly ["received", "to_be_received"];
|
|
52
|
+
export declare const toReferralAmountStatusType: (v: string) => "received" | "to_be_received";
|
|
53
|
+
export declare type ReferralAmountStatus = ReturnType<typeof toReferralAmountStatusType>;
|
|
54
|
+
export declare const AmountStatusTypes: Record<ReferralAmountStatus, string>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmountStatusTypes = exports.toReferralAmountStatusType = exports.ALL_REFERRAL_AMOUNT_STATUSES = exports.StatusTypes = exports.toReferralStatusType = exports.ALL_REFERRAL_STATUSES = exports.toReferralListViewSortKeyType = exports.REFERRAL_LIST_VIEW_SORT_KEYS = void 0;
|
|
4
|
+
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
|
+
exports.REFERRAL_LIST_VIEW_SORT_KEYS = [
|
|
6
|
+
'invitee_email',
|
|
7
|
+
'amount',
|
|
8
|
+
'status',
|
|
9
|
+
];
|
|
10
|
+
const toReferralListViewSortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.REFERRAL_LIST_VIEW_SORT_KEYS);
|
|
11
|
+
exports.toReferralListViewSortKeyType = toReferralListViewSortKeyType;
|
|
12
|
+
exports.ALL_REFERRAL_STATUSES = [
|
|
13
|
+
'invite_sent',
|
|
14
|
+
'onboarding',
|
|
15
|
+
'active',
|
|
16
|
+
'declined',
|
|
17
|
+
'resend_invite',
|
|
18
|
+
];
|
|
19
|
+
const toReferralStatusType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_REFERRAL_STATUSES);
|
|
20
|
+
exports.toReferralStatusType = toReferralStatusType;
|
|
21
|
+
exports.StatusTypes = {
|
|
22
|
+
invite_sent: 'Invite Sent',
|
|
23
|
+
onboarding: 'Onboarding',
|
|
24
|
+
active: 'Active',
|
|
25
|
+
declined: 'Declined',
|
|
26
|
+
resend_invite: 'Resend Invite',
|
|
27
|
+
};
|
|
28
|
+
exports.ALL_REFERRAL_AMOUNT_STATUSES = [
|
|
29
|
+
'received',
|
|
30
|
+
'to_be_received',
|
|
31
|
+
];
|
|
32
|
+
const toReferralAmountStatusType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_REFERRAL_AMOUNT_STATUSES);
|
|
33
|
+
exports.toReferralAmountStatusType = toReferralAmountStatusType;
|
|
34
|
+
exports.AmountStatusTypes = {
|
|
35
|
+
received: 'Received',
|
|
36
|
+
to_be_received: 'To be received',
|
|
37
|
+
};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { ID } from '../../commonStateTypes/common';
|
|
2
2
|
import { OnboardingInfoPayload } from '../../entity/company/companyPayload';
|
|
3
3
|
import { ZeniAPIResponse } from '../../responsePayload';
|
|
4
|
+
export interface AuditSummaryPayload {
|
|
5
|
+
fixes_required: number;
|
|
6
|
+
total_checks: number;
|
|
7
|
+
audit_score_percentage: number;
|
|
8
|
+
audit_report_last_generated_date?: string | null;
|
|
9
|
+
}
|
|
4
10
|
export interface ReviewCompanyPayload {
|
|
5
11
|
company_id: ID;
|
|
6
12
|
name: string;
|
|
@@ -12,11 +18,29 @@ export interface ReviewCompanyPayload {
|
|
|
12
18
|
is_uncategorized_income_transactions_present: boolean;
|
|
13
19
|
is_miscategorized_expenses_transactions_present: boolean;
|
|
14
20
|
is_miscategorized_income_transactions_present: boolean;
|
|
15
|
-
onboarding_info?: OnboardingInfoPayload;
|
|
16
21
|
is_vendor_review_required: boolean;
|
|
22
|
+
onboarding_info?: OnboardingInfoPayload;
|
|
23
|
+
audit_summary: AuditSummaryPayload;
|
|
24
|
+
}
|
|
25
|
+
export interface AuditRuleGroupPayload {
|
|
26
|
+
audit_rule_category: string;
|
|
27
|
+
audit_rule_group_description: string;
|
|
28
|
+
audit_rule_group_id: string;
|
|
29
|
+
audit_rules: AuditRulePayload[];
|
|
30
|
+
sequence: number;
|
|
31
|
+
}
|
|
32
|
+
export interface AuditRulePayload {
|
|
33
|
+
audit_rule_description: string;
|
|
34
|
+
audit_rule_id: string;
|
|
35
|
+
sequence: number;
|
|
36
|
+
}
|
|
37
|
+
export interface AuditRuleGroupsPayload {
|
|
38
|
+
audit_rule_groups: AuditRuleGroupPayload[];
|
|
39
|
+
version: string;
|
|
17
40
|
}
|
|
18
41
|
export interface ReviewCompanyViewPayload {
|
|
19
42
|
companies: ReviewCompanyPayload[];
|
|
20
43
|
}
|
|
21
44
|
export declare type ReviewCompanyListResponse = ZeniAPIResponse<ReviewCompanyViewPayload>;
|
|
45
|
+
export declare type AuditRuleGroupsResponse = ZeniAPIResponse<AuditRuleGroupsPayload>;
|
|
22
46
|
export declare type RetryBankAccountConnectionResponse = ZeniAPIResponse<ReviewCompanyViewPayload>;
|
|
@@ -12,3 +12,4 @@ export interface ReviewCompanySelectorView extends SelectorView {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const getReviewCompanySelectorView: (state: RootState) => ReviewCompanySelectorView;
|
|
14
14
|
export declare const getReviewCompanyListCount: (state: RootState) => number;
|
|
15
|
+
export declare const getAuditWarningsCount: (companyView: ReviewCompanyView) => number;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getReviewCompanyListCount = exports.getReviewCompanySelectorView = void 0;
|
|
6
|
+
exports.getAuditWarningsCount = exports.getReviewCompanyListCount = exports.getReviewCompanySelectorView = void 0;
|
|
7
7
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
8
8
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
9
9
|
const values_1 = __importDefault(require("lodash/values"));
|
|
@@ -27,7 +27,8 @@ exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) =>
|
|
|
27
27
|
.filter((value) => value != null);
|
|
28
28
|
const orderedZeniUsers = (0, orderBy_1.default)(zeniUsers, (user) => (0, userSelector_1.getUserName)(user), 'asc');
|
|
29
29
|
const sortedCompanies = (0, orderBy_1.default)(companies, (company) => {
|
|
30
|
-
var _a
|
|
30
|
+
var _a;
|
|
31
|
+
const warningCount = (0, exports.getAuditWarningsCount)(company);
|
|
31
32
|
switch (sortKey) {
|
|
32
33
|
case 'notes':
|
|
33
34
|
return (_a = company.note) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
@@ -37,12 +38,10 @@ exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) =>
|
|
|
37
38
|
case 'miscategorized':
|
|
38
39
|
return ((company.miscategorizedTransactions.income ? 1 : 0) +
|
|
39
40
|
(company.miscategorizedTransactions.expense ? 1 : 0));
|
|
40
|
-
case '
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
case 'identityVerified':
|
|
45
|
-
return (_d = company.onboardingInfo) === null || _d === void 0 ? void 0 : _d[sortKey].status.toLowerCase();
|
|
41
|
+
case 'warnings':
|
|
42
|
+
return warningCount;
|
|
43
|
+
case 'auditScore':
|
|
44
|
+
return company.auditSummary.fixesRequired;
|
|
46
45
|
case 'reviewVendor':
|
|
47
46
|
return company.isVendorReviewReqiured;
|
|
48
47
|
case 'companyName':
|
|
@@ -62,3 +61,27 @@ exports.getReviewCompanyListCount = (0, toolkit_1.createSelector)((state) => sta
|
|
|
62
61
|
const companies = (0, values_1.default)(rootState.reviewCompanyViewState.reviewCompanyById);
|
|
63
62
|
return companies.length;
|
|
64
63
|
});
|
|
64
|
+
const getAuditWarningsCount = (companyView) => {
|
|
65
|
+
var _a, _b, _c, _d;
|
|
66
|
+
let warningsCount = 0;
|
|
67
|
+
const bankConnectionStepInfo = (_a = companyView.onboardingInfo) === null || _a === void 0 ? void 0 : _a['bankAccountLinked'];
|
|
68
|
+
if ((bankConnectionStepInfo === null || bankConnectionStepInfo === void 0 ? void 0 : bankConnectionStepInfo.error) === true ||
|
|
69
|
+
(bankConnectionStepInfo === null || bankConnectionStepInfo === void 0 ? void 0 : bankConnectionStepInfo.completed) === false) {
|
|
70
|
+
warningsCount++;
|
|
71
|
+
}
|
|
72
|
+
const qboLinkedStepInfo = (_b = companyView.onboardingInfo) === null || _b === void 0 ? void 0 : _b['qboLinked'];
|
|
73
|
+
if ((qboLinkedStepInfo === null || qboLinkedStepInfo === void 0 ? void 0 : qboLinkedStepInfo.error) === true ||
|
|
74
|
+
(qboLinkedStepInfo === null || qboLinkedStepInfo === void 0 ? void 0 : qboLinkedStepInfo.completed) === false) {
|
|
75
|
+
warningsCount++;
|
|
76
|
+
}
|
|
77
|
+
const identityVerificationStepInfo = (_c = companyView.onboardingInfo) === null || _c === void 0 ? void 0 : _c['identityVerified'];
|
|
78
|
+
if ((identityVerificationStepInfo === null || identityVerificationStepInfo === void 0 ? void 0 : identityVerificationStepInfo.status) !== 'Complete') {
|
|
79
|
+
warningsCount++;
|
|
80
|
+
}
|
|
81
|
+
const businessVerificationStepInfo = (_d = companyView.onboardingInfo) === null || _d === void 0 ? void 0 : _d['businessVerified'];
|
|
82
|
+
if ((businessVerificationStepInfo === null || businessVerificationStepInfo === void 0 ? void 0 : businessVerificationStepInfo.status) !== 'Complete') {
|
|
83
|
+
warningsCount++;
|
|
84
|
+
}
|
|
85
|
+
return warningsCount;
|
|
86
|
+
};
|
|
87
|
+
exports.getAuditWarningsCount = getAuditWarningsCount;
|
|
@@ -2,23 +2,30 @@ import { FetchedState, ID, FetchStateAndError } from '../../commonStateTypes/com
|
|
|
2
2
|
import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
3
|
import { OnboardingInfo } from '../../entity/company/companyStateTypes';
|
|
4
4
|
import { ZeniDate } from '../../zeniDayJS';
|
|
5
|
-
import { ReviewCompanyPayload } from './reviewCompanyPayload';
|
|
6
|
-
export declare const REVIEW_COMPANY_COLUMN_KEYS: readonly ["miscategorized", "companyName", "notes", "uncategorized", "
|
|
7
|
-
export declare const toReviewColumnKeyType: (v: string) => "companyName" | "
|
|
5
|
+
import { AuditSummaryPayload, ReviewCompanyPayload } from './reviewCompanyPayload';
|
|
6
|
+
export declare const REVIEW_COMPANY_COLUMN_KEYS: readonly ["auditScore", "miscategorized", "companyName", "notes", "uncategorized", "warnings", "vendorReview", "reviewVendor"];
|
|
7
|
+
export declare const toReviewColumnKeyType: (v: string) => "companyName" | "notes" | "auditScore" | "miscategorized" | "uncategorized" | "warnings" | "vendorReview" | "reviewVendor";
|
|
8
8
|
export declare type ReviewCompanyColumnKey = ReturnType<typeof toReviewColumnKeyType>;
|
|
9
9
|
export declare type ReviewTransactionsType = 'income' | 'expense';
|
|
10
|
+
export interface AuditSummary {
|
|
11
|
+
fixesRequired: number;
|
|
12
|
+
totalChecks: number;
|
|
13
|
+
auditScorePercentage: number;
|
|
14
|
+
auditReportLastGeneratedDate: ZeniDate | null;
|
|
15
|
+
}
|
|
10
16
|
export interface ReviewCompany {
|
|
11
17
|
companyId: ID;
|
|
12
18
|
name: string;
|
|
13
19
|
primaryEmailDomain: string;
|
|
14
20
|
miscategorizedTransactions: Record<ReviewTransactionsType, boolean>;
|
|
15
21
|
uncategorizedTransactions: Record<ReviewTransactionsType, boolean>;
|
|
22
|
+
isVendorReviewReqiured: boolean;
|
|
23
|
+
auditSummary: AuditSummary;
|
|
16
24
|
noteLastUpdatedUserId?: ID;
|
|
17
25
|
noteLastUpdateTime?: ZeniDate;
|
|
18
26
|
note?: string;
|
|
19
27
|
onboardingInfo?: OnboardingInfo;
|
|
20
28
|
retryBankAccountConnectionFetchState: FetchStateAndError;
|
|
21
|
-
isVendorReviewReqiured: boolean;
|
|
22
29
|
}
|
|
23
30
|
export interface ReviewCompanyListUIState {
|
|
24
31
|
filterText: string;
|
|
@@ -29,4 +36,5 @@ export interface ReviewCompanyViewState extends FetchedState {
|
|
|
29
36
|
reviewCompanyById: Record<ID, ReviewCompany>;
|
|
30
37
|
uiState: ReviewCompanyListUIState;
|
|
31
38
|
}
|
|
39
|
+
export declare const toAuditSummary: (auditSummaryPayload: AuditSummaryPayload) => AuditSummary;
|
|
32
40
|
export declare function toReviewCompany(company: ReviewCompanyPayload): ReviewCompany;
|
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toReviewCompany = exports.toReviewColumnKeyType = exports.REVIEW_COMPANY_COLUMN_KEYS = void 0;
|
|
3
|
+
exports.toReviewCompany = exports.toAuditSummary = exports.toReviewColumnKeyType = exports.REVIEW_COMPANY_COLUMN_KEYS = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
5
|
const companyPayload_1 = require("../../entity/company/companyPayload");
|
|
6
6
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
7
7
|
exports.REVIEW_COMPANY_COLUMN_KEYS = [
|
|
8
|
+
'auditScore',
|
|
8
9
|
'miscategorized',
|
|
9
10
|
'companyName',
|
|
10
11
|
'notes',
|
|
11
12
|
'uncategorized',
|
|
13
|
+
'warnings',
|
|
12
14
|
'vendorReview',
|
|
13
|
-
'bankAccountLinked',
|
|
14
|
-
'qboLinked',
|
|
15
|
-
'identityVerified',
|
|
16
|
-
'businessVerified',
|
|
17
15
|
'reviewVendor',
|
|
18
16
|
];
|
|
19
17
|
const toReviewColumnKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.REVIEW_COMPANY_COLUMN_KEYS);
|
|
20
18
|
exports.toReviewColumnKeyType = toReviewColumnKeyType;
|
|
19
|
+
const toAuditSummary = (auditSummaryPayload) => {
|
|
20
|
+
return {
|
|
21
|
+
fixesRequired: auditSummaryPayload.fixes_required,
|
|
22
|
+
totalChecks: auditSummaryPayload.total_checks,
|
|
23
|
+
auditScorePercentage: auditSummaryPayload.audit_score_percentage,
|
|
24
|
+
auditReportLastGeneratedDate: auditSummaryPayload.audit_report_last_generated_date != null
|
|
25
|
+
? (0, zeniDayJS_1.date)(auditSummaryPayload.audit_report_last_generated_date)
|
|
26
|
+
: null,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
exports.toAuditSummary = toAuditSummary;
|
|
21
30
|
function toReviewCompany(company) {
|
|
22
31
|
const reviewCompany = {
|
|
23
32
|
companyId: company.company_id,
|
|
@@ -35,6 +44,7 @@ function toReviewCompany(company) {
|
|
|
35
44
|
fetchState: 'Not-Started',
|
|
36
45
|
},
|
|
37
46
|
isVendorReviewReqiured: company.is_vendor_review_required,
|
|
47
|
+
auditSummary: (0, exports.toAuditSummary)(company.audit_summary),
|
|
38
48
|
};
|
|
39
49
|
if (company.note != null) {
|
|
40
50
|
reviewCompany.note = company.note;
|
|
@@ -18,7 +18,7 @@ export declare const saveNotificationSettingsEpic: (actions$: ActionsObservable<
|
|
|
18
18
|
type: string;
|
|
19
19
|
} | {
|
|
20
20
|
payload: {
|
|
21
|
-
messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_monthEndEmailSent" | "cockpit_monthEndEmailSave" | "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_setup" | "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" | "bill_pay_setup" | "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" | "zeni_account_accept_term" | "update_vendor" | "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" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "save_task_detail" | "delete_task" | "archive_task" | "update_charge_card" | "notification_settings_saved";
|
|
21
|
+
messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_monthEndEmailSent" | "cockpit_monthEndEmailSave" | "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_setup" | "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" | "bill_pay_setup" | "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" | "zeni_account_accept_term" | "update_vendor" | "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" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "save_task_detail" | "delete_task" | "archive_task" | "update_charge_card" | "notification_settings_saved" | "referral_invite_sent";
|
|
22
22
|
messageText: "failed" | "success";
|
|
23
23
|
type: import("../../..").SnackbarMessageType;
|
|
24
24
|
showStatusIcon?: boolean | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.75",
|
|
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",
|