@zeniai/client-epic-state 5.0.36 → 5.0.38-betaNB1
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/agingReportStateTypes.d.ts +1 -1
- package/lib/entity/accountRecon/accountReconPayload.d.ts +19 -1
- package/lib/entity/accountRecon/accountReconPayload.js +21 -0
- package/lib/entity/accountRecon/accountReconSelector.d.ts +5 -1
- package/lib/entity/accountRecon/accountReconSelector.js +4 -0
- package/lib/entity/accountRecon/accountReconState.d.ts +18 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
- package/lib/entity/tenant/clearAllEpic.js +2 -0
- package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +19 -0
- package/lib/entity/tenant/epic/deleteConnectionEpic.js +29 -0
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +19 -0
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +31 -0
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +19 -0
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +33 -0
- package/lib/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/tenant/tenantReducer.d.ts +59 -1
- package/lib/entity/tenant/tenantReducer.js +139 -4
- package/lib/entity/tenant/tenantState.d.ts +7 -0
- package/lib/epic.d.ts +3 -1
- package/lib/epic.js +6 -1
- package/lib/esm/entity/accountRecon/accountReconPayload.js +21 -0
- package/lib/esm/entity/accountRecon/accountReconSelector.js +4 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -0
- package/lib/esm/entity/tenant/epic/deleteConnectionEpic.js +25 -0
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +27 -0
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +29 -0
- package/lib/esm/entity/tenant/tenantReducer.js +135 -2
- package/lib/esm/epic.js +6 -1
- package/lib/esm/index.js +5 -2
- package/lib/esm/reducer.js +3 -0
- package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +7 -2
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +2 -0
- package/lib/esm/view/expenseAutomationView/types/reconciliationViewState.js +20 -0
- package/lib/esm/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +23 -0
- package/lib/esm/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +25 -0
- package/lib/esm/view/featureNotificationView/featureNotificationViewPayload.js +11 -0
- package/lib/esm/view/featureNotificationView/featureNotificationViewReducer.js +106 -0
- package/lib/esm/view/featureNotificationView/featureNotificationViewSelector.js +4 -0
- package/lib/esm/view/featureNotificationView/featureNotificationViewState.js +1 -0
- package/lib/index.d.ts +6 -2
- package/lib/index.js +45 -31
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +19 -0
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +7 -2
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +2 -1
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +2 -0
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +24 -0
- package/lib/view/expenseAutomationView/types/reconciliationViewState.js +21 -0
- package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.d.ts +16 -0
- package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +27 -0
- package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.d.ts +14 -0
- package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +29 -0
- package/lib/view/featureNotificationView/featureNotificationViewPayload.d.ts +23 -0
- package/lib/view/featureNotificationView/featureNotificationViewPayload.js +15 -0
- package/lib/view/featureNotificationView/featureNotificationViewReducer.d.ts +19 -0
- package/lib/view/featureNotificationView/featureNotificationViewReducer.js +110 -0
- package/lib/view/featureNotificationView/featureNotificationViewSelector.d.ts +6 -0
- package/lib/view/featureNotificationView/featureNotificationViewSelector.js +11 -0
- package/lib/view/featureNotificationView/featureNotificationViewState.d.ts +26 -0
- package/lib/view/featureNotificationView/featureNotificationViewState.js +2 -0
- package/lib/view/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListState.d.ts +1 -1
- package/package.json +1 -1
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
|
@@ -31,6 +31,24 @@ interface ExclusionInfoPayload {
|
|
|
31
31
|
export interface ExcludedAccountPayload extends AccountAndPaymentAccountPayload {
|
|
32
32
|
exclusion_info: ExclusionInfoPayload;
|
|
33
33
|
}
|
|
34
|
+
export interface ReconciliationSummaryPayload {
|
|
35
|
+
accounts: {
|
|
36
|
+
done: number;
|
|
37
|
+
failed: number;
|
|
38
|
+
in_progress: number;
|
|
39
|
+
total: number;
|
|
40
|
+
};
|
|
41
|
+
accounts_to_connect_count: number;
|
|
42
|
+
auto_matched: {
|
|
43
|
+
matched_txns: number;
|
|
44
|
+
total_txns: number;
|
|
45
|
+
};
|
|
46
|
+
needs_review: {
|
|
47
|
+
account_count: number;
|
|
48
|
+
txn_count: number;
|
|
49
|
+
};
|
|
50
|
+
time_saved_percentage: number;
|
|
51
|
+
}
|
|
34
52
|
export interface ReconciliationPayload {
|
|
35
53
|
accounts: AccountAndPaymentAccountPayload[];
|
|
36
54
|
files: FilePayload[];
|
|
@@ -39,6 +57,7 @@ export interface ReconciliationPayload {
|
|
|
39
57
|
detection_info?: DetectionInfoPayload;
|
|
40
58
|
detection_reason?: string;
|
|
41
59
|
excluded_accounts?: ExcludedAccountPayload[];
|
|
60
|
+
summary?: ReconciliationSummaryPayload;
|
|
42
61
|
}
|
|
43
62
|
export type ReconciliationResponse = ZeniAPIResponse<ReconciliationPayload>;
|
|
44
63
|
export interface SaveReconciliationReviewPayload {
|
|
@@ -6,6 +6,7 @@ const toolkit_1 = require("@reduxjs/toolkit");
|
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
7
|
const accountState_1 = require("../../../entity/account/accountState");
|
|
8
8
|
const accountReconState_1 = require("../../../entity/accountRecon/accountReconState");
|
|
9
|
+
const reconciliationViewState_1 = require("../types/reconciliationViewState");
|
|
9
10
|
// Initial state
|
|
10
11
|
exports.initialReconciliationTabsState = {
|
|
11
12
|
balances: {
|
|
@@ -79,6 +80,7 @@ exports.initialState = {
|
|
|
79
80
|
},
|
|
80
81
|
},
|
|
81
82
|
excludedAccountIDs: [],
|
|
83
|
+
summary: undefined,
|
|
82
84
|
};
|
|
83
85
|
// Create slice with reducers
|
|
84
86
|
const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
@@ -147,7 +149,7 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
147
149
|
fetchReconciliationSuccess: {
|
|
148
150
|
reducer(draft, action) {
|
|
149
151
|
if (action.payload.accountId == null) {
|
|
150
|
-
updateAllReconciliation(draft, action.payload.reconciliation.accounts, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground, action.payload.reconciliation.excluded_accounts ?? []);
|
|
152
|
+
updateAllReconciliation(draft, action.payload.reconciliation.accounts, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground, action.payload.reconciliation.excluded_accounts ?? [], action.payload.reconciliation.summary);
|
|
151
153
|
}
|
|
152
154
|
else if (action.payload.reconciliation.reconciliation.length > 0 &&
|
|
153
155
|
action.payload.reconciliation.accounts.length > 0) {
|
|
@@ -531,7 +533,7 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
531
533
|
_a = expenseAutomationReconciliationView.actions, exports.fetchReconciliation = _a.fetchReconciliation, exports.fetchReconciliationFailure = _a.fetchReconciliationFailure, exports.fetchReconciliationSuccess = _a.fetchReconciliationSuccess, exports.saveReconciliationDetail = _a.saveReconciliationDetail, exports.saveReconciliationDetailFailure = _a.saveReconciliationDetailFailure, exports.updateSelectedAccountId = _a.updateSelectedAccountId, exports.setConnectionInProgressForAccount = _a.setConnectionInProgressForAccount, exports.setStatementParseInProgress = _a.setStatementParseInProgress, exports.updateReconcileTabLocalData = _a.updateReconcileTabLocalData, exports.updateReconcileTabListSortState = _a.updateReconcileTabListSortState, exports.updateReconcileTabListScrollState = _a.updateReconcileTabListScrollState, exports.saveReconciliationDetailSuccess = _a.saveReconciliationDetailSuccess, exports.updateSelectedTab = _a.updateSelectedTab, exports.updateBalancesLocalData = _a.updateBalancesLocalData, exports.initialiseLocalDataForSelectedAccountId = _a.initialiseLocalDataForSelectedAccountId, exports.clearExpenseAutomationReconciliationView = _a.clearExpenseAutomationReconciliationView, exports.updateSelectedDrawerAccountId = _a.updateSelectedDrawerAccountId, exports.updateReviewTabSortState = _a.updateReviewTabSortState, exports.initializeReconciliationReviewTabLocalData = _a.initializeReconciliationReviewTabLocalData, exports.updateReviewTabLocalData = _a.updateReviewTabLocalData, exports.saveReconciliationReview = _a.saveReconciliationReview, exports.updateSaveReconciliationReviewFetchStatus = _a.updateSaveReconciliationReviewFetchStatus, exports.updateReconListScrollPosition = _a.updateReconListScrollPosition, exports.updateAccountReconciliationLocalData = _a.updateAccountReconciliationLocalData, exports.deleteAccountStatement = _a.deleteAccountStatement, exports.deleteAccountStatementSuccess = _a.deleteAccountStatementSuccess, exports.deleteAccountStatementFailure = _a.deleteAccountStatementFailure, exports.excludeAccountFromReconciliation = _a.excludeAccountFromReconciliation, exports.excludeAccountFromReconciliationSuccess = _a.excludeAccountFromReconciliationSuccess, exports.excludeAccountFromReconciliationFailure = _a.excludeAccountFromReconciliationFailure, exports.includeAccountInReconciliation = _a.includeAccountInReconciliation, exports.includeAccountInReconciliationSuccess = _a.includeAccountInReconciliationSuccess, exports.includeAccountInReconciliationFailure = _a.includeAccountInReconciliationFailure, exports.uploadAccountStatement = _a.uploadAccountStatement, exports.uploadAccountStatementSuccess = _a.uploadAccountStatementSuccess, exports.uploadAccountStatementFailure = _a.uploadAccountStatementFailure, exports.updateStatementUploadChosen = _a.updateStatementUploadChosen, exports.updateNodeCollapseState = _a.updateNodeCollapseState;
|
|
532
534
|
// Export reducer
|
|
533
535
|
exports.default = expenseAutomationReconciliationView.reducer;
|
|
534
|
-
function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliationData, refreshViewInBackground, excludedAccounts) {
|
|
536
|
+
function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliationData, refreshViewInBackground, excludedAccounts, summary) {
|
|
535
537
|
draft.excludedAccountIDs = excludedAccounts.map((ea) => ea.account_id);
|
|
536
538
|
draft.excludedAccountExclusionInfo = {};
|
|
537
539
|
excludedAccounts.forEach((ea) => {
|
|
@@ -613,6 +615,9 @@ function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliation
|
|
|
613
615
|
draft.fetchState = 'Completed';
|
|
614
616
|
draft.error = undefined;
|
|
615
617
|
}
|
|
618
|
+
if (summary !== undefined) {
|
|
619
|
+
draft.summary = (0, reconciliationViewState_1.toReconciliationViewSummary)(summary);
|
|
620
|
+
}
|
|
616
621
|
}
|
|
617
622
|
function updateReconciliationByAccountID(draft, accounts, selectedPeriod, accountId, reconciliationData, refreshViewInBackground) {
|
|
618
623
|
const oldRecord = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId];
|
|
@@ -9,7 +9,7 @@ import { BankStatusCodeType } from '../../../entity/accountRecon/accountReconSta
|
|
|
9
9
|
import { ClassBase } from '../../../entity/class/classState';
|
|
10
10
|
import { Vendor } from '../../../entity/vendor/vendorState';
|
|
11
11
|
import { PlaidConnectionDetails } from '../../spendManagement/plaidAccount/plaidAccountViewState';
|
|
12
|
-
import { AccountReconciliationLocalData, ActionFetchStates, ReconListUIState, ReconciliationTabsState, ReconciliationViewTabType } from '../types/reconciliationViewState';
|
|
12
|
+
import { AccountReconciliationLocalData, ActionFetchStates, ReconListUIState, ReconciliationTabsState, ReconciliationViewSummary, ReconciliationViewTabType } from '../types/reconciliationViewState';
|
|
13
13
|
export declare const ALL_ACCOUNT_RECON_SECTION_IDS: readonly ["assets", "liabilities"];
|
|
14
14
|
export declare const toAccountReconSectionID: (v: string) => "assets" | "liabilities";
|
|
15
15
|
export type AccountReconSectionID = ReturnType<typeof toAccountReconSectionID>;
|
|
@@ -41,6 +41,7 @@ export interface ExpenseAutomationReconciliationViewSelector {
|
|
|
41
41
|
selectedAccountId?: ID;
|
|
42
42
|
selectedDrawerAccountId?: ID;
|
|
43
43
|
selectedReconAccount?: AccountReconciliationByAccount;
|
|
44
|
+
summary?: ReconciliationViewSummary;
|
|
44
45
|
}
|
|
45
46
|
export interface AccountReconciliationBySection {
|
|
46
47
|
accountIDs: ID[];
|
|
@@ -121,6 +121,7 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
121
121
|
excludeAccountFetchState: reconciliationViewState.actionFetchState.excludeAccountFetch,
|
|
122
122
|
includeAccountFetchState: reconciliationViewState.actionFetchState.includeAccountFetch,
|
|
123
123
|
excludedAccountIDs: reconciliationViewState.excludedAccountIDs,
|
|
124
|
+
summary: reconciliationViewState.summary,
|
|
124
125
|
};
|
|
125
126
|
}
|
|
126
127
|
const allAccountIDs = accountReconForMonthYearPeriod.accountIDs;
|
|
@@ -429,6 +430,7 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
429
430
|
excludeAccountFetchState: reconciliationViewState.actionFetchState.excludeAccountFetch,
|
|
430
431
|
includeAccountFetchState: reconciliationViewState.actionFetchState.includeAccountFetch,
|
|
431
432
|
excludedAccountIDs: reconciliationViewState.excludedAccountIDs,
|
|
433
|
+
summary: reconciliationViewState.summary,
|
|
432
434
|
};
|
|
433
435
|
});
|
|
434
436
|
const isAccountReconReport = (reportId) => {
|
|
@@ -7,6 +7,29 @@ import { BankStatusCodeType } from '../../../entity/accountRecon/accountReconSta
|
|
|
7
7
|
import { CustomerBase } from '../../../entity/customer/customerState';
|
|
8
8
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
9
9
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
10
|
+
import { ReconciliationSummaryPayload } from '../payload/reconciliationPayload';
|
|
11
|
+
export interface ReconciliationSummaryAccounts {
|
|
12
|
+
done: number;
|
|
13
|
+
failed: number;
|
|
14
|
+
inProgress: number;
|
|
15
|
+
total: number;
|
|
16
|
+
}
|
|
17
|
+
export interface ReconciliationSummaryAutoMatched {
|
|
18
|
+
matchedTxns: number;
|
|
19
|
+
totalTxns: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ReconciliationSummaryNeedsReview {
|
|
22
|
+
accountCount: number;
|
|
23
|
+
txnCount: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ReconciliationViewSummary {
|
|
26
|
+
accounts: ReconciliationSummaryAccounts;
|
|
27
|
+
accountsToConnectCount: number;
|
|
28
|
+
autoMatched: ReconciliationSummaryAutoMatched;
|
|
29
|
+
needsReview: ReconciliationSummaryNeedsReview;
|
|
30
|
+
timeSavedPercentage: number;
|
|
31
|
+
}
|
|
32
|
+
export declare function toReconciliationViewSummary(payload: ReconciliationSummaryPayload): ReconciliationViewSummary;
|
|
10
33
|
export declare const RECONCILE_ACTIONS: readonly ["reconcile", "save_reconcile_for_later", "exclude"];
|
|
11
34
|
export declare const toReconcileActions: (v: string) => "reconcile" | "save_reconcile_for_later" | "exclude";
|
|
12
35
|
export type ReconcileActionType = ReturnType<typeof toReconcileActions>;
|
|
@@ -110,6 +133,7 @@ export interface ReconciliationViewState extends FetchStateAndError {
|
|
|
110
133
|
statementUploadChosen: boolean;
|
|
111
134
|
selectedAccountId?: ID;
|
|
112
135
|
selectedDrawerAccountId?: ID;
|
|
136
|
+
summary?: ReconciliationViewSummary;
|
|
113
137
|
}
|
|
114
138
|
export interface BankConnectionStatus {
|
|
115
139
|
connectionInProgress: boolean;
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toReconciliationTabsType = exports.toReconcileActions = exports.RECONCILE_ACTIONS = void 0;
|
|
4
|
+
exports.toReconciliationViewSummary = toReconciliationViewSummary;
|
|
4
5
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
6
|
+
function toReconciliationViewSummary(payload) {
|
|
7
|
+
return {
|
|
8
|
+
accounts: {
|
|
9
|
+
done: payload.accounts.done,
|
|
10
|
+
failed: payload.accounts.failed,
|
|
11
|
+
inProgress: payload.accounts.in_progress,
|
|
12
|
+
total: payload.accounts.total,
|
|
13
|
+
},
|
|
14
|
+
accountsToConnectCount: payload.accounts_to_connect_count,
|
|
15
|
+
autoMatched: {
|
|
16
|
+
matchedTxns: payload.auto_matched.matched_txns,
|
|
17
|
+
totalTxns: payload.auto_matched.total_txns,
|
|
18
|
+
},
|
|
19
|
+
needsReview: {
|
|
20
|
+
accountCount: payload.needs_review.account_count,
|
|
21
|
+
txnCount: payload.needs_review.txn_count,
|
|
22
|
+
},
|
|
23
|
+
timeSavedPercentage: payload.time_saved_percentage,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
5
26
|
exports.RECONCILE_ACTIONS = [
|
|
6
27
|
'reconcile',
|
|
7
28
|
'save_reconcile_for_later',
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { RootState } from '../../../reducer';
|
|
3
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
+
import { fetchRegisteredInterests, fetchRegisteredInterestsFailure, fetchRegisteredInterestsSuccess } from '../featureNotificationViewReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof fetchRegisteredInterests> | ReturnType<typeof fetchRegisteredInterestsSuccess> | ReturnType<typeof fetchRegisteredInterestsFailure>;
|
|
6
|
+
export declare const fetchRegisteredInterestsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
+
payload: {
|
|
8
|
+
interests: import("../featureNotificationViewState").FeatureInterest[];
|
|
9
|
+
};
|
|
10
|
+
type: "featureNotificationView/fetchRegisteredInterestsSuccess";
|
|
11
|
+
} | {
|
|
12
|
+
payload: {
|
|
13
|
+
status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
14
|
+
};
|
|
15
|
+
type: "featureNotificationView/fetchRegisteredInterestsFailure";
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchRegisteredInterestsEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const featureNotificationViewPayload_1 = require("../featureNotificationViewPayload");
|
|
8
|
+
const featureNotificationViewReducer_1 = require("../featureNotificationViewReducer");
|
|
9
|
+
const fetchRegisteredInterestsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(featureNotificationViewReducer_1.fetchRegisteredInterests.match), (0, operators_1.switchMap)((action) => zeniAPI
|
|
10
|
+
.getJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/feature-interests?feature=${encodeURIComponent(action.payload.feature)}`)
|
|
11
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
12
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
13
|
+
const interests = response.data.feature_interests.map(featureNotificationViewPayload_1.toFeatureInterest);
|
|
14
|
+
return (0, rxjs_1.from)([(0, featureNotificationViewReducer_1.fetchRegisteredInterestsSuccess)(interests)]);
|
|
15
|
+
}
|
|
16
|
+
const status = response.status ??
|
|
17
|
+
(0, responsePayload_1.createZeniAPIStatus)('Failed to fetch registered interests. Please try again.');
|
|
18
|
+
return (0, rxjs_1.from)([(0, featureNotificationViewReducer_1.fetchRegisteredInterestsFailure)(status)]);
|
|
19
|
+
}), (0, operators_1.catchError)((error) => {
|
|
20
|
+
const message = error instanceof Error
|
|
21
|
+
? error.message
|
|
22
|
+
: 'Unexpected error fetching registered interests.';
|
|
23
|
+
return (0, rxjs_1.from)([
|
|
24
|
+
(0, featureNotificationViewReducer_1.fetchRegisteredInterestsFailure)((0, responsePayload_1.createZeniAPIStatus)(message)),
|
|
25
|
+
]);
|
|
26
|
+
}))));
|
|
27
|
+
exports.fetchRegisteredInterestsEpic = fetchRegisteredInterestsEpic;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { RootState } from '../../../reducer';
|
|
3
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
+
import { notifyMeForFeature, notifyMeForFeatureFailure, notifyMeForFeatureSuccess } from '../featureNotificationViewReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof notifyMeForFeature> | ReturnType<typeof notifyMeForFeatureSuccess> | ReturnType<typeof notifyMeForFeatureFailure>;
|
|
6
|
+
export declare const notifyMeForFeatureEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
+
payload: import("../featureNotificationViewPayload").FeatureInterestDataPayload;
|
|
8
|
+
type: "featureNotificationView/notifyMeForFeatureSuccess";
|
|
9
|
+
} | {
|
|
10
|
+
payload: {
|
|
11
|
+
status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
type: "featureNotificationView/notifyMeForFeatureFailure";
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notifyMeForFeatureEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const featureNotificationViewReducer_1 = require("../featureNotificationViewReducer");
|
|
8
|
+
const notifyMeForFeatureEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(featureNotificationViewReducer_1.notifyMeForFeature.match), (0, operators_1.switchMap)((action) => zeniAPI
|
|
9
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/feature-interests`, {
|
|
10
|
+
additional_info: action.payload.additionalInfo,
|
|
11
|
+
email: action.payload.email,
|
|
12
|
+
feature: action.payload.feature,
|
|
13
|
+
})
|
|
14
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
16
|
+
return (0, rxjs_1.from)([(0, featureNotificationViewReducer_1.notifyMeForFeatureSuccess)(response.data)]);
|
|
17
|
+
}
|
|
18
|
+
const status = response.status ??
|
|
19
|
+
(0, responsePayload_1.createZeniAPIStatus)('Failed to register interest. Please try again.');
|
|
20
|
+
return (0, rxjs_1.from)([(0, featureNotificationViewReducer_1.notifyMeForFeatureFailure)(status)]);
|
|
21
|
+
}), (0, operators_1.catchError)((error) => {
|
|
22
|
+
const message = error instanceof Error
|
|
23
|
+
? error.message
|
|
24
|
+
: 'Unexpected error registering interest.';
|
|
25
|
+
return (0, rxjs_1.from)([
|
|
26
|
+
(0, featureNotificationViewReducer_1.notifyMeForFeatureFailure)((0, responsePayload_1.createZeniAPIStatus)(message)),
|
|
27
|
+
]);
|
|
28
|
+
}))));
|
|
29
|
+
exports.notifyMeForFeatureEpic = notifyMeForFeatureEpic;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ZeniAPIResponse } from '../../responsePayload';
|
|
2
|
+
import { FeatureInterest } from './featureNotificationViewState';
|
|
3
|
+
/**
|
|
4
|
+
* Backend payload shapes for the FeatureInterest API exposed by
|
|
5
|
+
* `@repo:notifications`. snake_case is preserved here verbatim; the
|
|
6
|
+
* `toFeatureInterest` mapper converts to the camelCase state shape.
|
|
7
|
+
*/
|
|
8
|
+
export interface FeatureInterestDataPayload {
|
|
9
|
+
create_time: string;
|
|
10
|
+
feature: string;
|
|
11
|
+
interest_id: string;
|
|
12
|
+
notified: boolean;
|
|
13
|
+
update_time: string;
|
|
14
|
+
additional_info?: string | null;
|
|
15
|
+
email?: string | null;
|
|
16
|
+
notified_time?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface FeatureInterestListPayload {
|
|
19
|
+
feature_interests: FeatureInterestDataPayload[];
|
|
20
|
+
}
|
|
21
|
+
export type FeatureInterestResponse = ZeniAPIResponse<FeatureInterestDataPayload>;
|
|
22
|
+
export type FeatureInterestListResponse = ZeniAPIResponse<FeatureInterestListPayload>;
|
|
23
|
+
export declare const toFeatureInterest: (payload: FeatureInterestDataPayload) => FeatureInterest;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toFeatureInterest = void 0;
|
|
4
|
+
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
5
|
+
const toFeatureInterest = (payload) => ({
|
|
6
|
+
interestId: payload.interest_id,
|
|
7
|
+
feature: payload.feature,
|
|
8
|
+
notified: payload.notified,
|
|
9
|
+
createTime: (0, zeniDayJS_1.date)(payload.create_time),
|
|
10
|
+
updateTime: (0, zeniDayJS_1.date)(payload.update_time),
|
|
11
|
+
additionalInfo: payload.additional_info ?? undefined,
|
|
12
|
+
email: payload.email ?? undefined,
|
|
13
|
+
notifiedTime: payload.notified_time != null ? (0, zeniDayJS_1.date)(payload.notified_time) : undefined,
|
|
14
|
+
});
|
|
15
|
+
exports.toFeatureInterest = toFeatureInterest;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ZeniAPIStatus } from '../../responsePayload';
|
|
2
|
+
import { FeatureInterestDataPayload } from './featureNotificationViewPayload';
|
|
3
|
+
import { FeatureInterest, FeatureNotificationViewState } from './featureNotificationViewState';
|
|
4
|
+
export declare const initialState: FeatureNotificationViewState;
|
|
5
|
+
export declare const clearFeatureNotificationView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"featureNotificationView/clearFeatureNotificationView">, fetchRegisteredInterests: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[feature: string], {
|
|
6
|
+
feature: string;
|
|
7
|
+
}, "featureNotificationView/fetchRegisteredInterests", never, never>, fetchRegisteredInterestsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
8
|
+
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
9
|
+
}, "featureNotificationView/fetchRegisteredInterestsFailure", never, never>, fetchRegisteredInterestsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[interests: FeatureInterest[]], {
|
|
10
|
+
interests: FeatureInterest[];
|
|
11
|
+
}, "featureNotificationView/fetchRegisteredInterestsSuccess", never, never>, notifyMeForFeature: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[feature: string, additionalInfo: string, email: string], {
|
|
12
|
+
feature: string;
|
|
13
|
+
additionalInfo: string;
|
|
14
|
+
email: string;
|
|
15
|
+
}, "featureNotificationView/notifyMeForFeature", never, never>, notifyMeForFeatureFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
16
|
+
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
17
|
+
}, "featureNotificationView/notifyMeForFeatureFailure", never, never>, notifyMeForFeatureSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: FeatureInterestDataPayload], FeatureInterestDataPayload, "featureNotificationView/notifyMeForFeatureSuccess", never, never>;
|
|
18
|
+
declare const _default: import("redux").Reducer<FeatureNotificationViewState>;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.notifyMeForFeatureSuccess = exports.notifyMeForFeatureFailure = exports.notifyMeForFeature = exports.fetchRegisteredInterestsSuccess = exports.fetchRegisteredInterestsFailure = exports.fetchRegisteredInterests = exports.clearFeatureNotificationView = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const featureNotificationViewPayload_1 = require("./featureNotificationViewPayload");
|
|
7
|
+
exports.initialState = {
|
|
8
|
+
fetchRegisteredInterestsState: {
|
|
9
|
+
fetchState: 'Not-Started',
|
|
10
|
+
error: undefined,
|
|
11
|
+
},
|
|
12
|
+
notifyMeForFeatureState: {
|
|
13
|
+
fetchState: 'Not-Started',
|
|
14
|
+
error: undefined,
|
|
15
|
+
},
|
|
16
|
+
registeredInterests: [],
|
|
17
|
+
};
|
|
18
|
+
const featureNotificationView = (0, toolkit_1.createSlice)({
|
|
19
|
+
name: 'featureNotificationView',
|
|
20
|
+
initialState: exports.initialState,
|
|
21
|
+
reducers: {
|
|
22
|
+
notifyMeForFeature: {
|
|
23
|
+
prepare(feature, additionalInfo, email) {
|
|
24
|
+
return { payload: { feature, additionalInfo, email } };
|
|
25
|
+
},
|
|
26
|
+
reducer(draft,
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
|
+
_action) {
|
|
29
|
+
draft.notifyMeForFeatureState = {
|
|
30
|
+
fetchState: 'In-Progress',
|
|
31
|
+
error: undefined,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
notifyMeForFeatureSuccess: {
|
|
36
|
+
prepare(payload) {
|
|
37
|
+
return { payload };
|
|
38
|
+
},
|
|
39
|
+
reducer(draft, action) {
|
|
40
|
+
draft.notifyMeForFeatureState = {
|
|
41
|
+
fetchState: 'Completed',
|
|
42
|
+
error: undefined,
|
|
43
|
+
};
|
|
44
|
+
const interest = (0, featureNotificationViewPayload_1.toFeatureInterest)(action.payload);
|
|
45
|
+
// Idempotent: if a row for this (feature, additional_info) already
|
|
46
|
+
// exists in the slice, replace it; otherwise append.
|
|
47
|
+
const existingIndex = draft.registeredInterests.findIndex((r) => r.feature === interest.feature &&
|
|
48
|
+
r.additionalInfo === interest.additionalInfo);
|
|
49
|
+
if (existingIndex >= 0) {
|
|
50
|
+
draft.registeredInterests[existingIndex] = interest;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
draft.registeredInterests.push(interest);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
notifyMeForFeatureFailure: {
|
|
58
|
+
prepare(status) {
|
|
59
|
+
return { payload: { status } };
|
|
60
|
+
},
|
|
61
|
+
reducer(draft, action) {
|
|
62
|
+
draft.notifyMeForFeatureState = {
|
|
63
|
+
fetchState: 'Error',
|
|
64
|
+
error: action.payload.status,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
fetchRegisteredInterests: {
|
|
69
|
+
prepare(feature) {
|
|
70
|
+
return { payload: { feature } };
|
|
71
|
+
},
|
|
72
|
+
reducer(draft,
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
74
|
+
_action) {
|
|
75
|
+
draft.fetchRegisteredInterestsState = {
|
|
76
|
+
fetchState: 'In-Progress',
|
|
77
|
+
error: undefined,
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
fetchRegisteredInterestsSuccess: {
|
|
82
|
+
prepare(interests) {
|
|
83
|
+
return { payload: { interests } };
|
|
84
|
+
},
|
|
85
|
+
reducer(draft, action) {
|
|
86
|
+
draft.fetchRegisteredInterestsState = {
|
|
87
|
+
fetchState: 'Completed',
|
|
88
|
+
error: undefined,
|
|
89
|
+
};
|
|
90
|
+
draft.registeredInterests = action.payload.interests;
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
fetchRegisteredInterestsFailure: {
|
|
94
|
+
prepare(status) {
|
|
95
|
+
return { payload: { status } };
|
|
96
|
+
},
|
|
97
|
+
reducer(draft, action) {
|
|
98
|
+
draft.fetchRegisteredInterestsState = {
|
|
99
|
+
fetchState: 'Error',
|
|
100
|
+
error: action.payload.status,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
clearFeatureNotificationView(draft) {
|
|
105
|
+
Object.assign(draft, exports.initialState);
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
_a = featureNotificationView.actions, exports.clearFeatureNotificationView = _a.clearFeatureNotificationView, exports.fetchRegisteredInterests = _a.fetchRegisteredInterests, exports.fetchRegisteredInterestsFailure = _a.fetchRegisteredInterestsFailure, exports.fetchRegisteredInterestsSuccess = _a.fetchRegisteredInterestsSuccess, exports.notifyMeForFeature = _a.notifyMeForFeature, exports.notifyMeForFeatureFailure = _a.notifyMeForFeatureFailure, exports.notifyMeForFeatureSuccess = _a.notifyMeForFeatureSuccess;
|
|
110
|
+
exports.default = featureNotificationView.reducer;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RootState } from '../../reducer';
|
|
2
|
+
import { FeatureInterest } from './featureNotificationViewState';
|
|
3
|
+
export declare const getFeatureNotificationView: (state: RootState) => import("./featureNotificationViewState").FeatureNotificationViewState;
|
|
4
|
+
export declare const getRegisteredInterests: (state: RootState) => FeatureInterest[];
|
|
5
|
+
export declare const getRegisteredInterestsByFeature: (state: RootState, feature: string) => FeatureInterest[];
|
|
6
|
+
export declare const isFeatureInterestRegistered: (state: RootState, feature: string, additionalInfo: string) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isFeatureInterestRegistered = exports.getRegisteredInterestsByFeature = exports.getRegisteredInterests = exports.getFeatureNotificationView = void 0;
|
|
4
|
+
const getFeatureNotificationView = (state) => state.featureNotificationViewState;
|
|
5
|
+
exports.getFeatureNotificationView = getFeatureNotificationView;
|
|
6
|
+
const getRegisteredInterests = (state) => state.featureNotificationViewState.registeredInterests;
|
|
7
|
+
exports.getRegisteredInterests = getRegisteredInterests;
|
|
8
|
+
const getRegisteredInterestsByFeature = (state, feature) => state.featureNotificationViewState.registeredInterests.filter((interest) => interest.feature === feature);
|
|
9
|
+
exports.getRegisteredInterestsByFeature = getRegisteredInterestsByFeature;
|
|
10
|
+
const isFeatureInterestRegistered = (state, feature, additionalInfo) => state.featureNotificationViewState.registeredInterests.some((interest) => interest.feature === feature && interest.additionalInfo === additionalInfo);
|
|
11
|
+
exports.isFeatureInterestRegistered = isFeatureInterestRegistered;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
+
/**
|
|
4
|
+
* A single user-feature interest record returned by
|
|
5
|
+
* `GET /1.0/feature-interests` and `POST /1.0/feature-interests`.
|
|
6
|
+
*
|
|
7
|
+
* Used by the Integrations page "Notify me" buttons to register that the
|
|
8
|
+
* user wants an email when a not-yet-shipped connector becomes available.
|
|
9
|
+
* Generic enough to drive any future "Notify me" UI by adding a slug to
|
|
10
|
+
* the backend allowlist (FEATURE_INTEREST_ALLOWED_VALUES).
|
|
11
|
+
*/
|
|
12
|
+
export interface FeatureInterest {
|
|
13
|
+
createTime: ZeniDate;
|
|
14
|
+
feature: string;
|
|
15
|
+
interestId: ID;
|
|
16
|
+
notified: boolean;
|
|
17
|
+
updateTime: ZeniDate;
|
|
18
|
+
additionalInfo?: string;
|
|
19
|
+
email?: string;
|
|
20
|
+
notifiedTime?: ZeniDate;
|
|
21
|
+
}
|
|
22
|
+
export interface FeatureNotificationViewState {
|
|
23
|
+
fetchRegisteredInterestsState: FetchStateAndError;
|
|
24
|
+
notifyMeForFeatureState: FetchStateAndError;
|
|
25
|
+
registeredInterests: FeatureInterest[];
|
|
26
|
+
}
|
|
@@ -20,7 +20,7 @@ export interface VendorFiling1099ListQuery {
|
|
|
20
20
|
sortKey: VendorFiling1099ListViewSortKey;
|
|
21
21
|
sortOrder: SortOrder;
|
|
22
22
|
}
|
|
23
|
-
declare const toVendorFiling1099ListViewSortKey: (v: string) => "status" | "w9" | "
|
|
23
|
+
declare const toVendorFiling1099ListViewSortKey: (v: string) => "status" | "w9" | "total" | "legal_name" | "tax_classification" | "filing1099type";
|
|
24
24
|
export type VendorFiling1099ListViewSortKey = ReturnType<typeof toVendorFiling1099ListViewSortKey>;
|
|
25
25
|
export type Type1099Download = 'nec' | 'misc' | 'int';
|
|
26
26
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.38-betaNB1",
|
|
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
|
"module": "lib/esm/index.js",
|