@zeniai/client-epic-state 5.0.35 → 5.0.36-betaRD1
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/coreEpics.js +4 -1
- 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/coreEpics.js +4 -1
- 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/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +2 -0
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +11 -8
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +13 -11
- 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/esm/view/recommendation/fetchEntityRecommendationsByTransactionIdEpic.js +2 -1
- package/lib/index.d.ts +6 -2
- package/lib/index.js +51 -31
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +2 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +3 -3
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +11 -8
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +6 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +13 -11
- 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/recommendation/fetchEntityRecommendationsByTransactionIdEpic.js +2 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ exports.saveTransactionVendorEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
7
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
7
8
|
const transactionSelector_1 = require("../../../../entity/transaction/transactionSelector");
|
|
8
9
|
const vendorReducer_1 = require("../../../../entity/vendor/vendorReducer");
|
|
9
10
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
@@ -59,6 +60,7 @@ const saveTransactionVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
59
60
|
lineId: selectedTransactionLineId, // provide appropriate lineId
|
|
60
61
|
selectedTransaction, // provide appropriate selectedTransaction
|
|
61
62
|
uncategorizedAccounts: uncategorizedIncomeExpense, // provide appropriate uncategorizedAccounts
|
|
63
|
+
isAccountingClassesEnabled: (0, tenantSelector_1.getIsAccountingClassesEnabled)(state),
|
|
62
64
|
updatedVendor: {
|
|
63
65
|
name: response.data.vendors[0].vendor_name,
|
|
64
66
|
id: response.data.vendors[0].qbo_id,
|
package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts
CHANGED
|
@@ -27,12 +27,12 @@ export declare const removeTransactionFromTabView: (tabView: TransactionsTabView
|
|
|
27
27
|
export declare const filterAutoTabLineItems: (tabView: TransactionsTabViewState, transactionId: ID, updatedTransaction: SupportedTransactionWithCOT) => void;
|
|
28
28
|
export declare const MAX_SELECTION_LIMIT = 5;
|
|
29
29
|
export declare const toTransactionDetailLocalData: (transaction: SupportedTransactionWithCOT, selectedTab: TransactionsTab, lineItemsByTransactionIds: string[], uncategorizedIncomeExpense: UncategorizedAccounts, isUncategorizedExpenseCategoryEnabled?: boolean) => TransactionReviewLocalData;
|
|
30
|
-
export declare const toSetAllLineItemsToCategoryClass: (draft: TransactionsTabViewState, transaction: SupportedTransactionWithCOT, transactionId: ID, transactionLineId: ID, transactionDetailLocalData: TransactionReviewLocalData, updatedItem: "category" | "class", uncategorizedAccounts: UncategorizedAccounts, selectedTab: TransactionsTab, vendorId?: ID, customerId?: ID, selectedAccount?: AccountBase, selectedClassBase?: ClassBase, isUncategorizedExpenseCategoryEnabled?: boolean) => {
|
|
30
|
+
export declare const toSetAllLineItemsToCategoryClass: (draft: TransactionsTabViewState, transaction: SupportedTransactionWithCOT, transactionId: ID, transactionLineId: ID, transactionDetailLocalData: TransactionReviewLocalData, updatedItem: "category" | "class", uncategorizedAccounts: UncategorizedAccounts, selectedTab: TransactionsTab, vendorId?: ID, customerId?: ID, selectedAccount?: AccountBase, selectedClassBase?: ClassBase, isUncategorizedExpenseCategoryEnabled?: boolean, isAccountingClassesEnabled?: boolean) => {
|
|
31
31
|
localData: TransactionReviewLocalData;
|
|
32
32
|
similarTransactionUpdated: boolean;
|
|
33
33
|
};
|
|
34
|
-
export declare const setEntityRecommendationForLineIdInLocalData: (draft: TransactionsTabViewState, transaction: SupportedTransactionWithCOT, transactionDetailLocalData: TransactionReviewLocalData, entity: Entity, recommendationLineIds: ID[], uncategorizedAccounts: UncategorizedAccounts, recommendationWithCOTByLineId?: RecommendationWithCOTByLineId, isUncategorizedExpenseCategoryEnabled?: boolean) => TransactionReviewLocalData;
|
|
35
|
-
export declare const checkIfAllLineItemsAreCategoryClassFilled: (transaction: SupportedTransactionWithCOT, transactionDetailLocalData: TransactionReviewLocalData, uncategorizedAccounts: UncategorizedAccounts, isUncategorizedExpenseCategoryEnabled?: boolean) => boolean;
|
|
34
|
+
export declare const setEntityRecommendationForLineIdInLocalData: (draft: TransactionsTabViewState, transaction: SupportedTransactionWithCOT, transactionDetailLocalData: TransactionReviewLocalData, entity: Entity, recommendationLineIds: ID[], uncategorizedAccounts: UncategorizedAccounts, recommendationWithCOTByLineId?: RecommendationWithCOTByLineId, isUncategorizedExpenseCategoryEnabled?: boolean, isAccountingClassesEnabled?: boolean) => TransactionReviewLocalData;
|
|
35
|
+
export declare const checkIfAllLineItemsAreCategoryClassFilled: (transaction: SupportedTransactionWithCOT, transactionDetailLocalData: TransactionReviewLocalData, uncategorizedAccounts: UncategorizedAccounts, isUncategorizedExpenseCategoryEnabled?: boolean, isAccountingClassesEnabled?: boolean) => boolean;
|
|
36
36
|
export declare const getLineItemsByTransactionsIdsFromResponse: (transactions: SupportedTransactionPayload[]) => Record<string, string[]>;
|
|
37
37
|
export declare const getLineItemsByTransactionIdsFromLocalData: (transactionLocalData: TransactionReviewLocalDataSelectorView[], selectedTab: TransactionsTab) => Record<ID, string[]>;
|
|
38
38
|
export declare const mergeTabSpecificLineItems: (currentTabSpecificLineItems: TabSpecificLineItems, selectedTab: TransactionsTab, newLineItems: TabSpecificLineItems) => TabSpecificLineItems;
|
|
@@ -312,7 +312,7 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
312
312
|
});
|
|
313
313
|
return lineItemData;
|
|
314
314
|
};
|
|
315
|
-
const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, transactionLineId, transactionDetailLocalData, updatedItem, uncategorizedAccounts, selectedTab, vendorId, customerId, selectedAccount, selectedClassBase, isUncategorizedExpenseCategoryEnabled) => {
|
|
315
|
+
const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, transactionLineId, transactionDetailLocalData, updatedItem, uncategorizedAccounts, selectedTab, vendorId, customerId, selectedAccount, selectedClassBase, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) => {
|
|
316
316
|
let newLineItems = {};
|
|
317
317
|
let selectedCheckBoxTransactionIds = draft.selectedCheckBoxTransactionIds;
|
|
318
318
|
let similarTransactionUpdated = false;
|
|
@@ -341,7 +341,8 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
341
341
|
if (selectedClassBase != null) {
|
|
342
342
|
record.class = selectedClassBase;
|
|
343
343
|
}
|
|
344
|
-
|
|
344
|
+
const isClassSatisfied = isAccountingClassesEnabled === false || record.class != null;
|
|
345
|
+
if (isClassSatisfied && record.account != null) {
|
|
345
346
|
if (selectedCheckBoxTransactionIds.length < exports.MAX_SELECTION_LIMIT &&
|
|
346
347
|
selectedCheckBoxTransactionIds.includes(transaction.id) ===
|
|
347
348
|
false) {
|
|
@@ -371,7 +372,8 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
371
372
|
: undefined) === true)) {
|
|
372
373
|
record.account = selectedAccount;
|
|
373
374
|
similarTransactionUpdated = true;
|
|
374
|
-
if (
|
|
375
|
+
if ((isAccountingClassesEnabled === false ||
|
|
376
|
+
record.class != null) &&
|
|
375
377
|
selectedCheckBoxTransactionIds.length < exports.MAX_SELECTION_LIMIT &&
|
|
376
378
|
selectedCheckBoxTransactionIds.includes(transaction.id) ===
|
|
377
379
|
false) {
|
|
@@ -432,14 +434,14 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
432
434
|
selectedEntity: transactionDetailLocalData.selectedEntity,
|
|
433
435
|
tabSpecificLineItems: transactionDetailLocalData.tabSpecificLineItems,
|
|
434
436
|
};
|
|
435
|
-
if (!(0, exports.checkIfAllLineItemsAreCategoryClassFilled)(transaction, newLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled)) {
|
|
437
|
+
if (!(0, exports.checkIfAllLineItemsAreCategoryClassFilled)(transaction, newLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled)) {
|
|
436
438
|
selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
|
|
437
439
|
}
|
|
438
440
|
draft.selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds;
|
|
439
441
|
return { localData: newLocalData, similarTransactionUpdated };
|
|
440
442
|
};
|
|
441
443
|
exports.toSetAllLineItemsToCategoryClass = toSetAllLineItemsToCategoryClass;
|
|
442
|
-
const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transactionDetailLocalData, entity, recommendationLineIds, uncategorizedAccounts, recommendationWithCOTByLineId, isUncategorizedExpenseCategoryEnabled) => {
|
|
444
|
+
const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transactionDetailLocalData, entity, recommendationLineIds, uncategorizedAccounts, recommendationWithCOTByLineId, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) => {
|
|
443
445
|
const newLineItems = {};
|
|
444
446
|
let matchingEntityLineId = undefined;
|
|
445
447
|
const checkIfNotJEAndDeposit = !(0, vendorTransaction_1.isVendorTransaction)(transaction);
|
|
@@ -541,7 +543,7 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
|
|
|
541
543
|
selectedEntity: transactionDetailLocalData.selectedEntity,
|
|
542
544
|
tabSpecificLineItems: transactionDetailLocalData.tabSpecificLineItems,
|
|
543
545
|
};
|
|
544
|
-
if (!(0, exports.checkIfAllLineItemsAreCategoryClassFilled)(transaction, newLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled)) {
|
|
546
|
+
if (!(0, exports.checkIfAllLineItemsAreCategoryClassFilled)(transaction, newLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled)) {
|
|
545
547
|
selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
|
|
546
548
|
}
|
|
547
549
|
else if (selectedCheckBoxTransactionIds.includes(transaction.id) === false) {
|
|
@@ -551,12 +553,13 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
|
|
|
551
553
|
return newLocalData;
|
|
552
554
|
};
|
|
553
555
|
exports.setEntityRecommendationForLineIdInLocalData = setEntityRecommendationForLineIdInLocalData;
|
|
554
|
-
const checkIfAllLineItemsAreCategoryClassFilled = (transaction, transactionDetailLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled) => {
|
|
556
|
+
const checkIfAllLineItemsAreCategoryClassFilled = (transaction, transactionDetailLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) => {
|
|
555
557
|
const lineItems = Object.values(transactionDetailLocalData.lineItemById);
|
|
556
558
|
const isVendorTransactionAvailable = (0, vendorTransaction_1.isVendorTransaction)(transaction);
|
|
557
559
|
const uncategorizedAccountTypes = isUncategorizedExpenseCategoryEnabled === true ? ['income'] : undefined;
|
|
558
560
|
return lineItems.every((lineItem) => Boolean(lineItem?.account?.qboId) &&
|
|
559
|
-
|
|
561
|
+
(isAccountingClassesEnabled === false ||
|
|
562
|
+
Boolean(lineItem?.class?.qboId)) &&
|
|
560
563
|
(0, transactionDetailLocalDataHelper_2.isAccountUncategorized)(uncategorizedAccounts, lineItem?.account?.qboId, uncategorizedAccountTypes) === false &&
|
|
561
564
|
((isVendorTransactionAvailable
|
|
562
565
|
? Boolean(transactionDetailLocalData?.vendor?.id)
|
|
@@ -86,6 +86,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
86
86
|
selectedTransaction: SupportedTransaction;
|
|
87
87
|
transactionId: ID;
|
|
88
88
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
89
|
+
isAccountingClassesEnabled?: boolean;
|
|
89
90
|
isUncategorizedExpenseCategoryEnabled?: boolean;
|
|
90
91
|
selectedEntity?: Entity;
|
|
91
92
|
updatedVendor?: VendorBase;
|
|
@@ -95,10 +96,11 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
95
96
|
selectedTransaction: SupportedTransaction;
|
|
96
97
|
transactionId: ID;
|
|
97
98
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
99
|
+
isAccountingClassesEnabled?: boolean;
|
|
98
100
|
isUncategorizedExpenseCategoryEnabled?: boolean;
|
|
99
101
|
selectedEntity?: Entity;
|
|
100
102
|
updatedCustomer?: CustomerBase;
|
|
101
|
-
}, "expenseAutomationTransactionsView/updateSelectedCustomerForTransaction">, setAllItemsToCategoryClassInLocalDataForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: string, lineId: string, transactions: SupportedTransactionWithCOT[], uncategorizedAccounts: UncategorizedAccounts, vendorId?: string | undefined, customerId?: string | undefined, selectedAccount?: AccountBase | undefined, selectedClassBase?: ClassBase | undefined, lineEntity?: Entity | undefined, recommendations?: RecommendationWithCOT[] | undefined, isUncategorizedExpenseCategoryEnabled?: boolean | undefined], {
|
|
103
|
+
}, "expenseAutomationTransactionsView/updateSelectedCustomerForTransaction">, setAllItemsToCategoryClassInLocalDataForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: string, lineId: string, transactions: SupportedTransactionWithCOT[], uncategorizedAccounts: UncategorizedAccounts, vendorId?: string | undefined, customerId?: string | undefined, selectedAccount?: AccountBase | undefined, selectedClassBase?: ClassBase | undefined, lineEntity?: Entity | undefined, recommendations?: RecommendationWithCOT[] | undefined, isUncategorizedExpenseCategoryEnabled?: boolean | undefined, isAccountingClassesEnabled?: boolean | undefined], {
|
|
102
104
|
selectedTab: "review" | "autoCategorized";
|
|
103
105
|
transactionId: string;
|
|
104
106
|
lineId: string;
|
|
@@ -110,6 +112,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
110
112
|
selectedClassBase: ClassBase | undefined;
|
|
111
113
|
recommendations: RecommendationWithCOT[] | undefined;
|
|
112
114
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
115
|
+
isAccountingClassesEnabled: boolean | undefined;
|
|
113
116
|
isUncategorizedExpenseCategoryEnabled: boolean | undefined;
|
|
114
117
|
}, "expenseAutomationTransactionsView/setAllItemsToCategoryClassInLocalDataForCategorization", never, never>, updateTotalCountForTransactionCategorization: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
115
118
|
selectedPeriod: MonthYearPeriod;
|
|
@@ -135,7 +138,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
135
138
|
}, "expenseAutomationTransactionsView/fetchTransactionCategorizationView", never, never>, updateSelectedCheckboxTransactionIds: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
136
139
|
selectedTab: TransactionsTab;
|
|
137
140
|
transactionIds: ID[];
|
|
138
|
-
}, "expenseAutomationTransactionsView/updateSelectedCheckboxTransactionIds">, clearExpenseAutomationTransactionsViewPerTabView: import("@reduxjs/toolkit").ActionCreatorWithPayload<"review" | "autoCategorized", "expenseAutomationTransactionsView/clearExpenseAutomationTransactionsViewPerTabView">, clearExpenseAutomationTransactionsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationTransactionsView/clearExpenseAutomationTransactionsView">, setEntityRecommendationForLineIdsForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: TransactionID, transaction: SupportedTransactionWithCOT, lineIds: string[], entity: Entity, amount: number, recommendationWithCOTByLineId: RecommendationWithCOTByLineId, uncategorizedAccounts: UncategorizedAccounts, isUncategorizedExpenseCategoryEnabled?: boolean | undefined], {
|
|
141
|
+
}, "expenseAutomationTransactionsView/updateSelectedCheckboxTransactionIds">, clearExpenseAutomationTransactionsViewPerTabView: import("@reduxjs/toolkit").ActionCreatorWithPayload<"review" | "autoCategorized", "expenseAutomationTransactionsView/clearExpenseAutomationTransactionsViewPerTabView">, clearExpenseAutomationTransactionsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationTransactionsView/clearExpenseAutomationTransactionsView">, setEntityRecommendationForLineIdsForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: TransactionID, transaction: SupportedTransactionWithCOT, lineIds: string[], entity: Entity, amount: number, recommendationWithCOTByLineId: RecommendationWithCOTByLineId, uncategorizedAccounts: UncategorizedAccounts, isUncategorizedExpenseCategoryEnabled?: boolean | undefined, isAccountingClassesEnabled?: boolean | undefined], {
|
|
139
142
|
selectedTab: "review" | "autoCategorized";
|
|
140
143
|
transactionId: TransactionID;
|
|
141
144
|
transaction: SupportedTransactionWithCOT;
|
|
@@ -144,6 +147,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
144
147
|
amount: number;
|
|
145
148
|
recommendationWithCOTByLineId: RecommendationWithCOTByLineId;
|
|
146
149
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
150
|
+
isAccountingClassesEnabled: boolean | undefined;
|
|
147
151
|
isUncategorizedExpenseCategoryEnabled: boolean | undefined;
|
|
148
152
|
}, "expenseAutomationTransactionsView/setEntityRecommendationForLineIdsForCategorization", never, never>, updateSelectedTransactionId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
149
153
|
lineId: ID;
|
|
@@ -289,7 +289,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
289
289
|
},
|
|
290
290
|
setAllItemsToCategoryClassInLocalDataForCategorization: {
|
|
291
291
|
reducer(draft, action) {
|
|
292
|
-
const { vendorId, customerId, selectedAccount, selectedClassBase, transactions, transactionId, lineId, selectedTab, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
292
|
+
const { vendorId, customerId, selectedAccount, selectedClassBase, transactions, transactionId, lineId, selectedTab, uncategorizedAccounts, isAccountingClassesEnabled, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
293
293
|
const transactionLocalData = (0, get_1.default)(draft.transactionCategorizationView[selectedTab]
|
|
294
294
|
.transactionReviewLocalDataById, transactionId, undefined);
|
|
295
295
|
const existingAccount = transactionLocalData?.transactionReviewLocalData.lineItemById[lineId]
|
|
@@ -314,7 +314,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
314
314
|
const selectedCheckBoxTransactionIds = draft.transactionCategorizationView[selectedTab]
|
|
315
315
|
.selectedCheckBoxTransactionIds;
|
|
316
316
|
if (selectedTransaction != null &&
|
|
317
|
-
(0, transactionCategorizationLocalDataHelper_1.checkIfAllLineItemsAreCategoryClassFilled)(selectedTransaction, newTransactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled) === true && // check if all line items are filled
|
|
317
|
+
(0, transactionCategorizationLocalDataHelper_1.checkIfAllLineItemsAreCategoryClassFilled)(selectedTransaction, newTransactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) === true && // check if all line items are filled
|
|
318
318
|
selectedCheckBoxTransactionIds.length < transactionCategorizationLocalDataHelper_1.MAX_SELECTION_LIMIT &&
|
|
319
319
|
selectedCheckBoxTransactionIds.includes(transactionId) === false) {
|
|
320
320
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
|
|
@@ -333,7 +333,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
333
333
|
if (transactionLocalData != null) {
|
|
334
334
|
const { localData, similarTransactionUpdated } = (0, transactionCategorizationLocalDataHelper_1.toSetAllLineItemsToCategoryClass)(draft.transactionCategorizationView[selectedTab], transaction, transactionId, lineId, transactionLocalData.transactionReviewLocalData, existingAccount?.accountId !== selectedAccount?.accountId
|
|
335
335
|
? 'category'
|
|
336
|
-
: 'class', uncategorizedAccounts, selectedTab, vendorId, customerId, selectedAccount, selectedClassBase, isUncategorizedExpenseCategoryEnabled);
|
|
336
|
+
: 'class', uncategorizedAccounts, selectedTab, vendorId, customerId, selectedAccount, selectedClassBase, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled);
|
|
337
337
|
draft.transactionCategorizationView[selectedTab].transactionReviewLocalDataById[transaction.id] = {
|
|
338
338
|
transactionId: transaction.id,
|
|
339
339
|
transactionReviewLocalData: localData,
|
|
@@ -352,7 +352,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
352
352
|
...dirtyIds,
|
|
353
353
|
]);
|
|
354
354
|
},
|
|
355
|
-
prepare(selectedTab, transactionId, lineId, transactions, uncategorizedAccounts, vendorId, customerId, selectedAccount, selectedClassBase, lineEntity, recommendations, isUncategorizedExpenseCategoryEnabled) {
|
|
355
|
+
prepare(selectedTab, transactionId, lineId, transactions, uncategorizedAccounts, vendorId, customerId, selectedAccount, selectedClassBase, lineEntity, recommendations, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) {
|
|
356
356
|
return {
|
|
357
357
|
payload: {
|
|
358
358
|
selectedTab,
|
|
@@ -366,13 +366,14 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
366
366
|
selectedClassBase,
|
|
367
367
|
recommendations,
|
|
368
368
|
uncategorizedAccounts,
|
|
369
|
+
isAccountingClassesEnabled,
|
|
369
370
|
isUncategorizedExpenseCategoryEnabled,
|
|
370
371
|
},
|
|
371
372
|
};
|
|
372
373
|
},
|
|
373
374
|
},
|
|
374
375
|
setEntityRecommendationForLineIdsForCategorization: {
|
|
375
|
-
prepare(selectedTab, transactionId, transaction, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled) {
|
|
376
|
+
prepare(selectedTab, transactionId, transaction, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) {
|
|
376
377
|
return {
|
|
377
378
|
payload: {
|
|
378
379
|
selectedTab,
|
|
@@ -383,18 +384,19 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
383
384
|
amount,
|
|
384
385
|
recommendationWithCOTByLineId,
|
|
385
386
|
uncategorizedAccounts,
|
|
387
|
+
isAccountingClassesEnabled,
|
|
386
388
|
isUncategorizedExpenseCategoryEnabled,
|
|
387
389
|
},
|
|
388
390
|
};
|
|
389
391
|
},
|
|
390
392
|
reducer(draft, action) {
|
|
391
|
-
const { entity, transaction, transactionId, selectedTab, lineIds, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
393
|
+
const { entity, transaction, transactionId, selectedTab, lineIds, uncategorizedAccounts, isAccountingClassesEnabled, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
392
394
|
const transactionLocalData = (0, get_1.default)(draft.transactionCategorizationView[selectedTab]
|
|
393
395
|
.transactionReviewLocalDataById, transactionId.id, undefined);
|
|
394
396
|
if (transactionLocalData != null) {
|
|
395
397
|
draft.transactionCategorizationView[selectedTab].transactionReviewLocalDataById[transaction.id] = {
|
|
396
398
|
transactionId: transaction.id,
|
|
397
|
-
transactionReviewLocalData: (0, transactionCategorizationLocalDataHelper_1.setEntityRecommendationForLineIdInLocalData)(draft.transactionCategorizationView[selectedTab], transaction, transactionLocalData.transactionReviewLocalData, entity, lineIds, uncategorizedAccounts, action.payload.recommendationWithCOTByLineId, isUncategorizedExpenseCategoryEnabled),
|
|
399
|
+
transactionReviewLocalData: (0, transactionCategorizationLocalDataHelper_1.setEntityRecommendationForLineIdInLocalData)(draft.transactionCategorizationView[selectedTab], transaction, transactionLocalData.transactionReviewLocalData, entity, lineIds, uncategorizedAccounts, action.payload.recommendationWithCOTByLineId, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled),
|
|
398
400
|
};
|
|
399
401
|
// Mark transaction as dirty (autofill happened)
|
|
400
402
|
if (!draft.transactionCategorizationView[selectedTab].transactionIdsWithUnsavedData.includes(transaction.id)) {
|
|
@@ -449,7 +451,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
449
451
|
action.payload.status;
|
|
450
452
|
},
|
|
451
453
|
updateSelectedCustomerForTransaction(draft, action) {
|
|
452
|
-
const { transactionId, lineId, updatedCustomer, selectedTransaction, selectedTab, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
454
|
+
const { transactionId, lineId, updatedCustomer, selectedTransaction, selectedTab, uncategorizedAccounts, isAccountingClassesEnabled, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
453
455
|
const transactionLocalData = (0, get_1.default)(draft.transactionCategorizationView[selectedTab]
|
|
454
456
|
.transactionReviewLocalDataById, transactionId, undefined);
|
|
455
457
|
if (transactionLocalData != null) {
|
|
@@ -502,7 +504,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
502
504
|
.selectedCheckBoxTransactionIds;
|
|
503
505
|
if (newTransactionLocalData.customer != null &&
|
|
504
506
|
newTransactionLocalData.customer.id != null &&
|
|
505
|
-
(0, transactionCategorizationLocalDataHelper_1.checkIfAllLineItemsAreCategoryClassFilled)(selectedTransaction, newTransactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled) === true && // check if all line items are filled
|
|
507
|
+
(0, transactionCategorizationLocalDataHelper_1.checkIfAllLineItemsAreCategoryClassFilled)(selectedTransaction, newTransactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) === true && // check if all line items are filled
|
|
506
508
|
selectedCheckBoxTransactionIds.length < transactionCategorizationLocalDataHelper_1.MAX_SELECTION_LIMIT &&
|
|
507
509
|
selectedCheckBoxTransactionIds.includes(transactionId) === false) {
|
|
508
510
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
|
|
@@ -521,7 +523,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
521
523
|
}
|
|
522
524
|
},
|
|
523
525
|
updateSelectedVendorForTransaction(draft, action) {
|
|
524
|
-
const { transactionId, lineId, updatedVendor, selectedTransaction, selectedTab, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
526
|
+
const { transactionId, lineId, updatedVendor, selectedTransaction, selectedTab, uncategorizedAccounts, isAccountingClassesEnabled, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
525
527
|
const transactionLocalData = (0, get_1.default)(draft.transactionCategorizationView[selectedTab]
|
|
526
528
|
.transactionReviewLocalDataById, transactionId, undefined);
|
|
527
529
|
if (transactionLocalData != null) {
|
|
@@ -578,7 +580,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
578
580
|
.selectedCheckBoxTransactionIds;
|
|
579
581
|
if (newTransactionLocalData.vendor != null &&
|
|
580
582
|
newTransactionLocalData.vendor.id != null &&
|
|
581
|
-
(0, transactionCategorizationLocalDataHelper_1.checkIfAllLineItemsAreCategoryClassFilled)(selectedTransaction, newTransactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled) === true && // check if all line items are filled
|
|
583
|
+
(0, transactionCategorizationLocalDataHelper_1.checkIfAllLineItemsAreCategoryClassFilled)(selectedTransaction, newTransactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) === true && // check if all line items are filled
|
|
582
584
|
selectedCheckBoxTransactionIds.length < transactionCategorizationLocalDataHelper_1.MAX_SELECTION_LIMIT &&
|
|
583
585
|
selectedCheckBoxTransactionIds.includes(transactionId) === false) {
|
|
584
586
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
|
|
@@ -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
|
+
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toEntityTypeURL = exports.fetchEntityRecommendationsByTransactionIdEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
|
|
6
7
|
const transactionHelper_1 = require("../../entity/transaction/transactionHelper");
|
|
7
8
|
const responsePayload_1 = require("../../responsePayload");
|
|
8
9
|
const transactionsViewReducer_1 = require("../../view/expenseAutomationView/reducers/transactionsViewReducer");
|
|
@@ -54,7 +55,7 @@ const fetchEntityRecommendationsByTransactionIdEpic = (actions$, state$, zeniAPI
|
|
|
54
55
|
if (recommendationWithCOTByLineId != null) {
|
|
55
56
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(state$.value.accountState, state$.value.accountListState, 'accountList');
|
|
56
57
|
if (isTransactionCategorizationFlow === true) {
|
|
57
|
-
actions.push((0, transactionsViewReducer_1.setEntityRecommendationForLineIdsForCategorization)(selectedTransactionCategorizationTab, transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense, isUncategorizedExpenseCategoryEnabled));
|
|
58
|
+
actions.push((0, transactionsViewReducer_1.setEntityRecommendationForLineIdsForCategorization)(selectedTransactionCategorizationTab, transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense, isUncategorizedExpenseCategoryEnabled, (0, tenantSelector_1.getIsAccountingClassesEnabled)(state$.value)));
|
|
58
59
|
}
|
|
59
60
|
else {
|
|
60
61
|
actions.push((0, transactionDetailReducer_1.setEntityRecommendationForLineIdsForTransactionDetail)(transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense));
|
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.36-betaRD1",
|
|
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",
|