@zeniai/client-epic-state 4.10.6 → 4.10.8
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/commonPayloadTypes/agingReportPayloadTypes.d.ts +1 -0
- package/lib/commonPayloadTypes/commonPayload.d.ts +8 -0
- package/lib/commonPayloadTypes/commonPayload.js +20 -0
- package/lib/commonPayloadTypes/subAccountView/subAccountPayloadHelper.js +2 -2
- package/lib/commonStateTypes/accountView/{getNestedAccountIDHeirarchyForReport.d.ts → getNestedAccountIDHierarchyForReport.d.ts} +2 -2
- package/lib/commonStateTypes/accountView/nestedAccountID.d.ts +2 -2
- package/lib/commonStateTypes/agingBalance/agingBalance.d.ts +4 -0
- package/lib/commonStateTypes/agingBalance/agingBalance.js +4 -1
- package/lib/commonStateTypes/classesView/getNestedClassIDHierarchyForReport.d.ts +2 -2
- package/lib/commonStateTypes/classesView/nestedClassID.d.ts +2 -2
- package/lib/commonStateTypes/customerView/getNestedCustomerHierarchy.d.ts +9 -0
- package/lib/commonStateTypes/customerView/getNestedCustomerHierarchy.js +46 -0
- package/lib/commonStateTypes/customerView/nestedCustomerID.d.ts +42 -0
- package/lib/commonStateTypes/customerView/nestedCustomerID.js +9 -0
- package/lib/commonStateTypes/selectorTypes/classesViewSelectorReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/agingReportStateTypes.d.ts +4 -7
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/account/subAccountSelector.d.ts +1 -1
- package/lib/entity/account/subAccountSelector.js +7 -7
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/accountGroup/accountGroupV2Selector.js +3 -3
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classSelectorV2.d.ts +1 -1
- package/lib/entity/class/classSelectorV2.js +10 -10
- package/lib/entity/class/classState.d.ts +1 -1
- package/lib/entity/customer/customerPayload.d.ts +1 -1
- package/lib/entity/customer/customerPayload.js +1 -1
- package/lib/entity/customer/customerReducer.d.ts +1 -1
- package/lib/entity/customer/customerSelector.d.ts +1 -1
- package/lib/entity/customerIncome/customerIncomeTrend.d.ts +1 -1
- package/lib/entity/customerIncome/customerIncomeTrendReducer.d.ts +1 -1
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/notification/notificationPayload.d.ts +46 -0
- package/lib/entity/notification/notificationPayload.js +144 -0
- package/lib/entity/notification/notificationReducer.d.ts +20 -0
- package/lib/entity/notification/notificationReducer.js +118 -0
- package/lib/entity/notification/notificationSelector.d.ts +9 -0
- package/lib/entity/notification/notificationSelector.js +36 -0
- package/lib/entity/notification/notificationState.d.ts +7 -0
- package/lib/entity/notification/notificationState.js +2 -0
- package/lib/entity/notification/types/notificationSelectorTypes.d.ts +8 -0
- package/lib/entity/notification/types/notificationSelectorTypes.js +2 -0
- package/lib/entity/notification/types/notificationStateTypes.d.ts +50 -0
- package/lib/entity/notification/types/notificationStateTypes.js +2 -0
- package/lib/entity/notification/types/notificationTypes.d.ts +24 -0
- package/lib/entity/notification/types/notificationTypes.js +58 -0
- package/lib/entity/sectionAccountsView/getNestedAccountIDHierarchyForSection.js +9 -9
- package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
- package/lib/entity/sectionAccountsView/sectionAccountsViewEpic.js +2 -2
- package/lib/entity/sectionAccountsView/sectionAccountsViewSelector.js +3 -3
- package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewEpic.js +2 -2
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
- package/lib/entity/sectionClassesViewV2/sectionClassesViewSelector.js +7 -7
- package/lib/entity/sectionClassesViewV2/selectorHelpers/getNestedClassIDHierarchyForSection.js +7 -7
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +4 -2
- package/lib/entity/tenant/clearAllEpic.js +5 -1
- package/lib/entity/transaction/stateTypes/customerTransaction.d.ts +1 -1
- package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
- package/lib/epic.d.ts +7 -3
- package/lib/epic.js +5 -1
- package/lib/index.d.ts +24 -14
- package/lib/index.js +35 -13
- package/lib/reducer.d.ts +7 -1
- package/lib/reducer.js +6 -0
- package/lib/view/accountList/accountListReducer.js +2 -2
- package/lib/view/accountList/accountListSelector.d.ts +3 -3
- package/lib/view/accountList/accountListSelector.js +3 -3
- package/lib/view/accountList/accountListState.d.ts +2 -2
- package/lib/view/accountMappingView/accountMappingReducer.js +19 -19
- package/lib/view/accountMappingView/accountMappingState.d.ts +8 -8
- package/lib/view/accountMappingView/accountMappingViewSelector.d.ts +8 -8
- package/lib/view/accountMappingView/accountMappingViewSelector.js +7 -7
- package/lib/view/apAgingView/apAgingReport/apAgingReducer.d.ts +7 -5
- package/lib/view/apAgingView/apAgingReport/apAgingReducer.js +34 -15
- package/lib/view/apAgingView/apAgingReport/apAgingSelector.d.ts +1 -1
- package/lib/view/apAgingView/apAgingReport/apAgingSelector.js +29 -16
- package/lib/view/apAgingView/apAgingReport/apAgingState.d.ts +6 -3
- package/lib/view/apAgingView/apAgingReport/fetchApAgingEpic.js +11 -7
- package/lib/view/arAgingView/arAgingDetail/arAgingDetailSelector.d.ts +1 -1
- package/lib/view/arAgingView/arAgingReport/arAgingPayload.js +8 -1
- package/lib/view/arAgingView/arAgingReport/arAgingReducer.d.ts +13 -7
- package/lib/view/arAgingView/arAgingReport/arAgingReducer.js +49 -15
- package/lib/view/arAgingView/arAgingReport/arAgingSelector.d.ts +12 -6
- package/lib/view/arAgingView/arAgingReport/arAgingSelector.js +68 -35
- package/lib/view/arAgingView/arAgingReport/arAgingState.d.ts +12 -4
- package/lib/view/arAgingView/arAgingReport/fetchArAgingEpic.js +10 -7
- package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
- package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/classList/classListSelector.d.ts +3 -3
- package/lib/view/classList/classListSelector.js +3 -3
- package/lib/view/classList/classListState.d.ts +2 -2
- package/lib/view/commonVendorView/transactionVendorView/transactionVendorViewSelector.d.ts +4 -4
- package/lib/view/commonVendorView/transactionVendorView/transactionVendorViewSelector.js +4 -4
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +4 -4
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +4 -4
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +4 -4
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +4 -4
- package/lib/view/dashboard/dashboardEpic.js +6 -4
- package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer.js +3 -3
- package/lib/view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewSelector.js +3 -3
- package/lib/view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewState.d.ts +2 -2
- package/lib/view/notificationView/epics/fetchNotificationUnreadCountEpic.d.ts +10 -0
- package/lib/view/notificationView/epics/fetchNotificationUnreadCountEpic.js +39 -0
- package/lib/view/notificationView/epics/fetchNotificationViewEpic.d.ts +9 -0
- package/lib/view/notificationView/epics/fetchNotificationViewEpic.js +56 -0
- package/lib/view/notificationView/epics/updateNotificationViewAllNotificationsStatusEpic.d.ts +9 -0
- package/lib/view/notificationView/epics/updateNotificationViewAllNotificationsStatusEpic.js +50 -0
- package/lib/view/notificationView/epics/updateNotificationViewNotificationStatusEpic.d.ts +9 -0
- package/lib/view/notificationView/epics/updateNotificationViewNotificationStatusEpic.js +86 -0
- package/lib/view/notificationView/notificationView.helpers.d.ts +2 -0
- package/lib/view/notificationView/notificationView.helpers.js +11 -0
- package/lib/view/notificationView/notificationViewPayload.d.ts +48 -0
- package/lib/view/notificationView/notificationViewPayload.js +2 -0
- package/lib/view/notificationView/notificationViewReducer.d.ts +64 -0
- package/lib/view/notificationView/notificationViewReducer.js +372 -0
- package/lib/view/notificationView/notificationViewSelector.d.ts +29 -0
- package/lib/view/notificationView/notificationViewSelector.js +89 -0
- package/lib/view/notificationView/notificationViewState.d.ts +31 -0
- package/lib/view/notificationView/notificationViewState.js +19 -0
- package/lib/view/opExClassesView/opExClassesViewReducer.js +3 -3
- package/lib/view/opExClassesView/opExClassesViewSelector.js +3 -3
- package/lib/view/opExClassesView/opExClassesViewState.d.ts +2 -2
- 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/profitAndLossClassesView/profitAndLossClassesViewReducer.js +3 -3
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +2 -2
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/revenueClassesView/revenueClassesViewReducer.js +3 -3
- package/lib/view/revenueClassesView/revenueClassesViewSelector.js +3 -3
- package/lib/view/revenueClassesView/revenueClassesViewState.d.ts +2 -2
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.d.ts +5 -5
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.js +5 -5
- package/lib/view/scheduleView/scheduleListView/scheduleListHelper.d.ts +2 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListSelector.d.ts +2 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListSelector.js +1 -1
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +4 -4
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -4
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.d.ts +4 -4
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +4 -4
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.d.ts +2 -1
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.js +37 -5
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +4 -4
- package/lib/view/transactionDetail/transactionDetailSelector.js +4 -4
- package/lib/view/transactionDetail/transactionDetailState.d.ts +1 -1
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +1 -1
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +1 -1
- package/lib/zeniAPI.d.ts +2 -0
- package/lib/zeniAPI.js +8 -0
- package/package.json +2 -1
- package/lib/commonStateTypes/accountView/{getNestedAccountIDHeirarchyForReport.js → getNestedAccountIDHierarchyForReport.js} +0 -0
- package/lib/entity/customer/{customer.d.ts → customerState.d.ts} +4 -4
- /package/lib/entity/customer/{customer.js → customerState.js} +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AllowedValueWithCodeOptionalPayload } from '../../commonPayloadTypes/commonPayload';
|
|
2
|
+
import { UserPayload } from '../user/userPayload';
|
|
3
|
+
import { Notification } from './types/notificationStateTypes';
|
|
4
|
+
interface NotificationUpdatesPayload {
|
|
5
|
+
field: string;
|
|
6
|
+
type: string;
|
|
7
|
+
old_value: string | string[] | AllowedValueWithCodeOptionalPayload | null;
|
|
8
|
+
new_value: string | string[] | AllowedValueWithCodeOptionalPayload | null;
|
|
9
|
+
}
|
|
10
|
+
interface NotificationAdditionalInfoPayload {
|
|
11
|
+
due_date: string;
|
|
12
|
+
}
|
|
13
|
+
interface NotificationMetaDataPayload {
|
|
14
|
+
tags: string[];
|
|
15
|
+
event_description: string;
|
|
16
|
+
event_title: string;
|
|
17
|
+
event_status: AllowedValueWithCodeOptionalPayload | null;
|
|
18
|
+
updates: NotificationUpdatesPayload[];
|
|
19
|
+
additional_info: NotificationAdditionalInfoPayload | null;
|
|
20
|
+
}
|
|
21
|
+
interface NotificationActivityPayload {
|
|
22
|
+
activity_type: string;
|
|
23
|
+
metadata: NotificationMetaDataPayload;
|
|
24
|
+
}
|
|
25
|
+
interface NotificationEventDataPayload {
|
|
26
|
+
entity_id: string;
|
|
27
|
+
create_timestamp: string;
|
|
28
|
+
title: string;
|
|
29
|
+
description: string | null;
|
|
30
|
+
authors: UserPayload[];
|
|
31
|
+
activities: NotificationActivityPayload[];
|
|
32
|
+
}
|
|
33
|
+
export interface NotificationPayload {
|
|
34
|
+
notification_identifier: string;
|
|
35
|
+
user_notification_id: string;
|
|
36
|
+
update_time: string;
|
|
37
|
+
create_time: string;
|
|
38
|
+
status: string;
|
|
39
|
+
mode: string;
|
|
40
|
+
tenant_id: string;
|
|
41
|
+
user_id: string;
|
|
42
|
+
notification_group: string;
|
|
43
|
+
data: NotificationEventDataPayload;
|
|
44
|
+
}
|
|
45
|
+
export declare const mapNotificationPayloadToNotification: (payload: NotificationPayload) => Notification;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapNotificationPayloadToNotification = void 0;
|
|
4
|
+
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
5
|
+
const commonPayload_1 = require("../../commonPayloadTypes/commonPayload");
|
|
6
|
+
const notificationTypes_1 = require("./types/notificationTypes");
|
|
7
|
+
/**
|
|
8
|
+
* Helpers
|
|
9
|
+
*/
|
|
10
|
+
const toNotificationUpdates = (payload) => {
|
|
11
|
+
const { field, type, old_value, new_value } = payload;
|
|
12
|
+
const oldValue = {
|
|
13
|
+
text: '',
|
|
14
|
+
list: [],
|
|
15
|
+
codeNamePair: null,
|
|
16
|
+
};
|
|
17
|
+
const newValue = {
|
|
18
|
+
text: '',
|
|
19
|
+
list: [],
|
|
20
|
+
codeNamePair: null,
|
|
21
|
+
};
|
|
22
|
+
const updateType = (0, notificationTypes_1.toNotificationUpdateValueType)(type);
|
|
23
|
+
const oldValuePayload = old_value;
|
|
24
|
+
const newValuePayload = new_value;
|
|
25
|
+
switch (updateType) {
|
|
26
|
+
case 'list':
|
|
27
|
+
if (oldValuePayload != null && Array.isArray(oldValuePayload) === false) {
|
|
28
|
+
console.warn(`Invalid old_value - ${oldValuePayload} for type - ${type}`);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
oldValue[updateType] = Array.isArray(oldValuePayload)
|
|
32
|
+
? oldValuePayload
|
|
33
|
+
: [];
|
|
34
|
+
}
|
|
35
|
+
if (newValuePayload != null && Array.isArray(newValuePayload) === false) {
|
|
36
|
+
console.warn(`Invalid new_value - ${newValuePayload} for type - ${type}`);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
newValue[updateType] = Array.isArray(newValuePayload)
|
|
40
|
+
? newValuePayload
|
|
41
|
+
: [];
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
case 'code_name_pair':
|
|
45
|
+
if (oldValuePayload != null &&
|
|
46
|
+
(0, commonPayload_1.isAllowedValueWithCodeOptionalPayload)(oldValuePayload) === false) {
|
|
47
|
+
console.warn(`Invalid old_value - ${oldValuePayload} for type - ${type}`);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
oldValue['codeNamePair'] =
|
|
51
|
+
oldValuePayload != null &&
|
|
52
|
+
(0, commonPayload_1.isAllowedValueWithCodePayload)(oldValuePayload)
|
|
53
|
+
? (0, commonPayload_1.toAllowedValueWithCode)(oldValuePayload)
|
|
54
|
+
: null;
|
|
55
|
+
}
|
|
56
|
+
if (newValuePayload != null &&
|
|
57
|
+
(0, commonPayload_1.isAllowedValueWithCodeOptionalPayload)(newValuePayload) === false) {
|
|
58
|
+
console.warn(`Invalid new_value - ${newValuePayload} for type - ${type}`);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
newValue['codeNamePair'] =
|
|
62
|
+
newValuePayload != null &&
|
|
63
|
+
(0, commonPayload_1.isAllowedValueWithCodePayload)(newValuePayload)
|
|
64
|
+
? (0, commonPayload_1.toAllowedValueWithCode)(newValuePayload)
|
|
65
|
+
: null;
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
case 'string':
|
|
69
|
+
default:
|
|
70
|
+
if (oldValuePayload != null && typeof oldValuePayload !== 'string') {
|
|
71
|
+
console.warn(`Invalid old_value - ${oldValuePayload} for type - ${type}`);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
oldValue['text'] = oldValuePayload == null ? '' : oldValuePayload;
|
|
75
|
+
}
|
|
76
|
+
if (newValuePayload != null && typeof newValuePayload !== 'string') {
|
|
77
|
+
console.warn(`Invalid new_value - ${newValuePayload} for type - ${type}`);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
newValue['text'] = newValuePayload == null ? '' : newValuePayload;
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
field,
|
|
86
|
+
type: updateType,
|
|
87
|
+
oldValue,
|
|
88
|
+
newValue,
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
const toNotificationAdditionalInfo = (payload) => {
|
|
92
|
+
if (payload == null) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
const { due_date } = payload;
|
|
96
|
+
return { dueDate: (0, zeniDayJS_1.dateInUTC)(due_date) };
|
|
97
|
+
};
|
|
98
|
+
const toNotificationMetaData = (payload) => {
|
|
99
|
+
const { tags, event_description, event_title, event_status, updates, additional_info, } = payload;
|
|
100
|
+
return {
|
|
101
|
+
tags,
|
|
102
|
+
eventDescription: event_description,
|
|
103
|
+
eventTitle: event_title,
|
|
104
|
+
eventStatus: event_status != null && (0, commonPayload_1.isAllowedValueWithCodePayload)(event_status)
|
|
105
|
+
? (0, commonPayload_1.toAllowedValueWithCode)(event_status)
|
|
106
|
+
: undefined,
|
|
107
|
+
updates: updates.map((update) => toNotificationUpdates(update)),
|
|
108
|
+
additionalInfo: toNotificationAdditionalInfo(additional_info),
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
const toNotificationActivity = (payload) => {
|
|
112
|
+
const { activity_type, metadata } = payload;
|
|
113
|
+
return {
|
|
114
|
+
activityType: (0, notificationTypes_1.toNotificationActivityType)(activity_type),
|
|
115
|
+
metadata: toNotificationMetaData(metadata),
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
const toNotificationEventData = (payload) => {
|
|
119
|
+
const { entity_id, create_timestamp, title, description, authors, activities } = payload;
|
|
120
|
+
return {
|
|
121
|
+
entitiyId: entity_id,
|
|
122
|
+
createTimestamp: (0, zeniDayJS_1.dateInUTC)(create_timestamp),
|
|
123
|
+
title,
|
|
124
|
+
description: description !== null && description !== void 0 ? description : '',
|
|
125
|
+
authorIds: authors.map((author) => author.user_id),
|
|
126
|
+
activities: activities.map((activity) => toNotificationActivity(activity)),
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
const mapNotificationPayloadToNotification = (payload) => {
|
|
130
|
+
const { notification_identifier, user_notification_id, create_time, update_time, status, mode, tenant_id, user_id, notification_group, data, } = payload;
|
|
131
|
+
return {
|
|
132
|
+
notificationId: user_notification_id,
|
|
133
|
+
notificationIdentifier: (0, notificationTypes_1.toNotificationIdentifier)(notification_identifier),
|
|
134
|
+
updateTime: (0, zeniDayJS_1.dateInUTC)(update_time),
|
|
135
|
+
createTime: (0, zeniDayJS_1.dateInUTC)(create_time),
|
|
136
|
+
status: (0, notificationTypes_1.toNotificationStatus)(status),
|
|
137
|
+
mode: (0, notificationTypes_1.toNotificationMode)(mode),
|
|
138
|
+
tenantId: tenant_id,
|
|
139
|
+
userId: user_id,
|
|
140
|
+
notificationGroup: (0, notificationTypes_1.toNotificationGroup)(notification_group),
|
|
141
|
+
eventData: toNotificationEventData(data),
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
exports.mapNotificationPayloadToNotification = mapNotificationPayloadToNotification;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CoreNotificationData } from '@cord-sdk/types';
|
|
2
|
+
import { UpdateType } from '../../commonStateTypes/common';
|
|
3
|
+
import { NotificationPayload } from './notificationPayload';
|
|
4
|
+
import { NotificationState } from './notificationState';
|
|
5
|
+
export declare const initialState: NotificationState;
|
|
6
|
+
export declare const updateAllNotifications: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notifications: NotificationPayload[], updateType?: UpdateType | undefined], {
|
|
7
|
+
notifications: NotificationPayload[];
|
|
8
|
+
updateType: UpdateType;
|
|
9
|
+
}, string, never, never>, updateNotificationsStatuses: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationIds: string[], newStatus: "unread" | "read"], {
|
|
10
|
+
notificationIds: string[];
|
|
11
|
+
newStatus: "unread" | "read";
|
|
12
|
+
}, string, never, never>, updateCommentsNotifications: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notifications: CoreNotificationData[], updateType?: UpdateType | undefined], {
|
|
13
|
+
notifications: CoreNotificationData[];
|
|
14
|
+
updateType: UpdateType;
|
|
15
|
+
}, string, never, never>, updateCommentsNotificationsStatuses: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationIds: string[], newStatus: "unread" | "read"], {
|
|
16
|
+
notificationIds: string[];
|
|
17
|
+
newStatus: "unread" | "read";
|
|
18
|
+
}, string, never, never>, removeNotification: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, removeCommentNotification: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, clearAllNotifications: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
19
|
+
declare const _default: import("@reduxjs/toolkit").Reducer<NotificationState, import("@reduxjs/toolkit").AnyAction>;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
var _a;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.clearAllNotifications = exports.removeCommentNotification = exports.removeNotification = exports.updateCommentsNotificationsStatuses = exports.updateCommentsNotifications = exports.updateNotificationsStatuses = exports.updateAllNotifications = exports.initialState = void 0;
|
|
8
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
|
+
const assignWith_1 = __importDefault(require("lodash/assignWith"));
|
|
10
|
+
const notificationPayload_1 = require("./notificationPayload");
|
|
11
|
+
exports.initialState = {
|
|
12
|
+
notificationById: {},
|
|
13
|
+
commentsNotificationById: {},
|
|
14
|
+
};
|
|
15
|
+
const notification = (0, toolkit_1.createSlice)({
|
|
16
|
+
name: 'notification',
|
|
17
|
+
initialState: exports.initialState,
|
|
18
|
+
reducers: {
|
|
19
|
+
updateAllNotifications: {
|
|
20
|
+
reducer(draft, action) {
|
|
21
|
+
doUpdateNotifications(draft.notificationById, action.payload.notifications, action.payload.updateType);
|
|
22
|
+
},
|
|
23
|
+
prepare(notifications, updateType = 'merge') {
|
|
24
|
+
return {
|
|
25
|
+
payload: {
|
|
26
|
+
notifications,
|
|
27
|
+
updateType,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
updateNotificationsStatuses: {
|
|
33
|
+
reducer(draft, action) {
|
|
34
|
+
const { notificationIds, newStatus } = action.payload;
|
|
35
|
+
notificationIds.forEach((notificationId) => {
|
|
36
|
+
if (draft.notificationById[notificationId] != null) {
|
|
37
|
+
draft.notificationById[notificationId].status = newStatus;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
prepare(notificationIds, newStatus) {
|
|
42
|
+
return {
|
|
43
|
+
payload: {
|
|
44
|
+
notificationIds,
|
|
45
|
+
newStatus,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
updateCommentsNotifications: {
|
|
51
|
+
reducer(draft, action) {
|
|
52
|
+
doUpdateCommentsNotifications(draft.commentsNotificationById, action.payload.notifications, action.payload.updateType);
|
|
53
|
+
},
|
|
54
|
+
prepare(notifications, updateType = 'merge') {
|
|
55
|
+
return {
|
|
56
|
+
payload: {
|
|
57
|
+
notifications,
|
|
58
|
+
updateType,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
updateCommentsNotificationsStatuses: {
|
|
64
|
+
reducer(draft, action) {
|
|
65
|
+
const { notificationIds, newStatus } = action.payload;
|
|
66
|
+
notificationIds.forEach((notificationId) => {
|
|
67
|
+
if (draft.commentsNotificationById[notificationId] != null) {
|
|
68
|
+
draft.commentsNotificationById[notificationId].readStatus =
|
|
69
|
+
newStatus;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
prepare(notificationIds, newStatus) {
|
|
74
|
+
return {
|
|
75
|
+
payload: {
|
|
76
|
+
notificationIds,
|
|
77
|
+
newStatus,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
removeNotification(draft, action) {
|
|
83
|
+
delete draft.notificationById[action.payload];
|
|
84
|
+
},
|
|
85
|
+
removeCommentNotification(draft, action) {
|
|
86
|
+
delete draft.commentsNotificationById[action.payload];
|
|
87
|
+
},
|
|
88
|
+
clearAllNotifications(draft) {
|
|
89
|
+
Object.assign(draft, exports.initialState);
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
_a = notification.actions, exports.updateAllNotifications = _a.updateAllNotifications, exports.updateNotificationsStatuses = _a.updateNotificationsStatuses, exports.updateCommentsNotifications = _a.updateCommentsNotifications, exports.updateCommentsNotificationsStatuses = _a.updateCommentsNotificationsStatuses, exports.removeNotification = _a.removeNotification, exports.removeCommentNotification = _a.removeCommentNotification, exports.clearAllNotifications = _a.clearAllNotifications;
|
|
94
|
+
exports.default = notification.reducer;
|
|
95
|
+
/**
|
|
96
|
+
* Helpers
|
|
97
|
+
*/
|
|
98
|
+
const doUpdateNotifications = (draft, notifications, updateType) => {
|
|
99
|
+
notifications.forEach((notification) => {
|
|
100
|
+
const latestNotification = (0, notificationPayload_1.mapNotificationPayloadToNotification)(notification);
|
|
101
|
+
if (latestNotification.notificationId in draft && updateType === 'merge') {
|
|
102
|
+
(0, assignWith_1.default)(draft[latestNotification.notificationId], latestNotification, (objValue, srcValue) => srcValue !== null && srcValue !== void 0 ? srcValue : objValue); // IMPORTANT: replace the value only when source has valid value. Otherwise keep the existing value!);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
draft[latestNotification.notificationId] = latestNotification;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
const doUpdateCommentsNotifications = (draft, notifications, updateType) => {
|
|
110
|
+
notifications.forEach((notification) => {
|
|
111
|
+
if (notification.id in draft && updateType === 'merge') {
|
|
112
|
+
(0, assignWith_1.default)(draft[notification.id], notification, (objValue, srcValue) => srcValue !== null && srcValue !== void 0 ? srcValue : objValue); // IMPORTANT: replace the value only when source has valid value. Otherwise keep the existing value!);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
draft[notification.id] = notification;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CoreNotificationData } from '@cord-sdk/types';
|
|
2
|
+
import { ID } from '../../commonStateTypes/common';
|
|
3
|
+
import { NotificationState } from './notificationState';
|
|
4
|
+
import { NotificationWithAuthors } from './types/notificationSelectorTypes';
|
|
5
|
+
import { UserState } from '../user/userState';
|
|
6
|
+
export declare function getNotificationsByNotificationIds(notificationState: NotificationState, userState: UserState, notificationIds: ID[]): NotificationWithAuthors[];
|
|
7
|
+
export declare function getNotificationByNotificationId(notificationState: NotificationState, userState: UserState, notificationId: ID): NotificationWithAuthors | undefined;
|
|
8
|
+
export declare function getCommentsNotificationsByNotificationIds(notificationState: NotificationState, notificationIds: ID[]): CoreNotificationData[];
|
|
9
|
+
export declare function getCommentsNotificationByNotificationId(notificationState: NotificationState, notificationId: ID): CoreNotificationData | undefined;
|
|
@@ -0,0 +1,36 @@
|
|
|
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.getCommentsNotificationByNotificationId = exports.getCommentsNotificationsByNotificationIds = exports.getNotificationByNotificationId = exports.getNotificationsByNotificationIds = void 0;
|
|
7
|
+
const omit_1 = __importDefault(require("lodash/omit"));
|
|
8
|
+
const userSelector_1 = require("../user/userSelector");
|
|
9
|
+
function getNotificationsByNotificationIds(notificationState, userState, notificationIds) {
|
|
10
|
+
const notifications = notificationIds
|
|
11
|
+
.map((notificationId) => getNotificationByNotificationId(notificationState, userState, notificationId))
|
|
12
|
+
.filter((value) => value != null);
|
|
13
|
+
return notifications;
|
|
14
|
+
}
|
|
15
|
+
exports.getNotificationsByNotificationIds = getNotificationsByNotificationIds;
|
|
16
|
+
function getNotificationByNotificationId(notificationState, userState, notificationId) {
|
|
17
|
+
const notification = notificationState.notificationById[notificationId];
|
|
18
|
+
if (notification != null) {
|
|
19
|
+
const notificationWithAuthors = Object.assign(Object.assign({}, notification), { eventData: Object.assign(Object.assign({}, (0, omit_1.default)(notification.eventData, ['authorIds'])), { authors: (0, userSelector_1.getUsersByUserIds)(userState, notification.eventData.authorIds) }) });
|
|
20
|
+
return notificationWithAuthors;
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
exports.getNotificationByNotificationId = getNotificationByNotificationId;
|
|
25
|
+
function getCommentsNotificationsByNotificationIds(notificationState, notificationIds) {
|
|
26
|
+
const notifications = notificationIds
|
|
27
|
+
.map((notificationId) => getCommentsNotificationByNotificationId(notificationState, notificationId))
|
|
28
|
+
.filter((value) => value != null);
|
|
29
|
+
return notifications;
|
|
30
|
+
}
|
|
31
|
+
exports.getCommentsNotificationsByNotificationIds = getCommentsNotificationsByNotificationIds;
|
|
32
|
+
function getCommentsNotificationByNotificationId(notificationState, notificationId) {
|
|
33
|
+
var _a;
|
|
34
|
+
return ((_a = notificationState.commentsNotificationById[notificationId]) !== null && _a !== void 0 ? _a : undefined);
|
|
35
|
+
}
|
|
36
|
+
exports.getCommentsNotificationByNotificationId = getCommentsNotificationByNotificationId;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CoreNotificationData } from '@cord-sdk/types';
|
|
2
|
+
import { ID } from '../../commonStateTypes/common';
|
|
3
|
+
import { Notification } from './types/notificationStateTypes';
|
|
4
|
+
export interface NotificationState {
|
|
5
|
+
notificationById: Record<ID, Notification>;
|
|
6
|
+
commentsNotificationById: Record<ID, CoreNotificationData>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { User } from '../../user/userState';
|
|
2
|
+
import { NotificationEventData, Notification } from './notificationStateTypes';
|
|
3
|
+
export interface NotificationEventDataWithAuthors extends Omit<NotificationEventData, 'authorIds'> {
|
|
4
|
+
authors: User[];
|
|
5
|
+
}
|
|
6
|
+
export interface NotificationWithAuthors extends Omit<Notification, 'eventData'> {
|
|
7
|
+
eventData: NotificationEventDataWithAuthors;
|
|
8
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ZeniDate } from '../../../zeniDayJS';
|
|
2
|
+
import { NotificationIdentifierType, NotificationStatus, NotificationMode, NotificationGroup, NotificationActivityType, NotificationUpdateValue } from './notificationTypes';
|
|
3
|
+
import { AllowedValueWithCode } from '../../../commonStateTypes/allowedValue';
|
|
4
|
+
import { ID } from '../../../commonStateTypes/common';
|
|
5
|
+
export interface NotificationValueFormat {
|
|
6
|
+
text: string;
|
|
7
|
+
list: string[];
|
|
8
|
+
codeNamePair: AllowedValueWithCode | null;
|
|
9
|
+
}
|
|
10
|
+
export interface NotificationUpdates {
|
|
11
|
+
field: string;
|
|
12
|
+
type: NotificationUpdateValue;
|
|
13
|
+
oldValue: NotificationValueFormat;
|
|
14
|
+
newValue: NotificationValueFormat;
|
|
15
|
+
}
|
|
16
|
+
export interface NotificationAdditionalInfo {
|
|
17
|
+
dueDate: ZeniDate;
|
|
18
|
+
}
|
|
19
|
+
export interface NotificationMetaData {
|
|
20
|
+
tags: string[];
|
|
21
|
+
eventDescription: string;
|
|
22
|
+
eventTitle: string;
|
|
23
|
+
eventStatus?: AllowedValueWithCode;
|
|
24
|
+
updates: NotificationUpdates[];
|
|
25
|
+
additionalInfo: NotificationAdditionalInfo | null;
|
|
26
|
+
}
|
|
27
|
+
export interface NotificationActivity {
|
|
28
|
+
activityType: NotificationActivityType;
|
|
29
|
+
metadata: NotificationMetaData;
|
|
30
|
+
}
|
|
31
|
+
export interface NotificationEventData {
|
|
32
|
+
entitiyId: ID;
|
|
33
|
+
createTimestamp: ZeniDate;
|
|
34
|
+
title: string;
|
|
35
|
+
description: string;
|
|
36
|
+
authorIds: ID[];
|
|
37
|
+
activities: NotificationActivity[];
|
|
38
|
+
}
|
|
39
|
+
export interface Notification {
|
|
40
|
+
notificationId: ID;
|
|
41
|
+
notificationIdentifier: NotificationIdentifierType;
|
|
42
|
+
updateTime: ZeniDate;
|
|
43
|
+
createTime: ZeniDate;
|
|
44
|
+
status: NotificationStatus;
|
|
45
|
+
mode: NotificationMode;
|
|
46
|
+
tenantId: ID;
|
|
47
|
+
userId: ID;
|
|
48
|
+
notificationGroup: NotificationGroup;
|
|
49
|
+
eventData: NotificationEventData;
|
|
50
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const ALL_NOTIFICATION_GROUPS: readonly ["task_manager"];
|
|
2
|
+
export declare const toNotificationGroup: (v: string) => "task_manager";
|
|
3
|
+
export declare const toNotificationGroupStrict: (v: string) => "task_manager" | undefined;
|
|
4
|
+
export declare type NotificationGroup = ReturnType<typeof toNotificationGroup>;
|
|
5
|
+
export declare const ALL_NOTIFICATION_STATUSES: readonly ["read", "unread"];
|
|
6
|
+
export declare const toNotificationStatus: (v: string) => "unread" | "read";
|
|
7
|
+
export declare const toNotificationStatusStrict: (v: string) => "unread" | "read" | undefined;
|
|
8
|
+
export declare type NotificationStatus = ReturnType<typeof toNotificationStatus>;
|
|
9
|
+
export declare const ALL_NOTIFICATION_MODES: readonly ["dashboard", "email"];
|
|
10
|
+
export declare const toNotificationMode: (v: string) => "dashboard" | "email";
|
|
11
|
+
export declare const toNotificationModeStrict: (v: string) => "dashboard" | "email" | undefined;
|
|
12
|
+
export declare type NotificationMode = ReturnType<typeof toNotificationMode>;
|
|
13
|
+
export declare const ALL_TASK_MANAGER_NOTIFICATION_ACTIVITY_TYPES: readonly ["task_assigned", "task_status_updated", "task_activities", "task_created", "task_deleted", "task_archived", "task_due", "task_overdue"];
|
|
14
|
+
export declare const ALL_NOTIFICATION_ACTIVITY_TYPES: readonly ["task_assigned", "task_status_updated", "task_activities", "task_created", "task_deleted", "task_archived", "task_due", "task_overdue"];
|
|
15
|
+
export declare const toNotificationActivityType: (v: string) => "task_assigned" | "task_status_updated" | "task_activities" | "task_created" | "task_deleted" | "task_archived" | "task_due" | "task_overdue";
|
|
16
|
+
export declare const toNotificationActivityTypeStrict: (v: string) => "task_assigned" | "task_status_updated" | "task_activities" | "task_created" | "task_deleted" | "task_archived" | "task_due" | "task_overdue" | undefined;
|
|
17
|
+
export declare type NotificationActivityType = ReturnType<typeof toNotificationActivityType>;
|
|
18
|
+
export declare const ALL_NOTIFICATION_UPDATE_VALUE_TYPES: readonly ["string", "list", "code_name_pair"];
|
|
19
|
+
export declare const toNotificationUpdateValueType: (v: string) => "string" | "list" | "code_name_pair";
|
|
20
|
+
export declare const toNotificationUpdateValueTypeStrict: (v: string) => "string" | "list" | "code_name_pair" | undefined;
|
|
21
|
+
export declare type NotificationUpdateValue = ReturnType<typeof toNotificationUpdateValueType>;
|
|
22
|
+
export declare const getNotificationIdentifier: (notificationGroup: NotificationGroup, notificationType: NotificationActivityType) => "task_manager.task_assigned.notification" | "task_manager.task_status_updated.notification" | "task_manager.task_activities.notification" | "task_manager.task_created.notification" | "task_manager.task_deleted.notification" | "task_manager.task_archived.notification" | "task_manager.task_due.notification" | "task_manager.task_overdue.notification";
|
|
23
|
+
export declare type NotificationIdentifierType = ReturnType<typeof getNotificationIdentifier>;
|
|
24
|
+
export declare const toNotificationIdentifier: (notification_identifier: string) => NotificationIdentifierType;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toNotificationIdentifier = exports.getNotificationIdentifier = exports.toNotificationUpdateValueTypeStrict = exports.toNotificationUpdateValueType = exports.ALL_NOTIFICATION_UPDATE_VALUE_TYPES = exports.toNotificationActivityTypeStrict = exports.toNotificationActivityType = exports.ALL_NOTIFICATION_ACTIVITY_TYPES = exports.ALL_TASK_MANAGER_NOTIFICATION_ACTIVITY_TYPES = exports.toNotificationModeStrict = exports.toNotificationMode = exports.ALL_NOTIFICATION_MODES = exports.toNotificationStatusStrict = exports.toNotificationStatus = exports.ALL_NOTIFICATION_STATUSES = exports.toNotificationGroupStrict = exports.toNotificationGroup = exports.ALL_NOTIFICATION_GROUPS = void 0;
|
|
4
|
+
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
|
+
exports.ALL_NOTIFICATION_GROUPS = ['task_manager'];
|
|
6
|
+
const toNotificationGroup = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_NOTIFICATION_GROUPS);
|
|
7
|
+
exports.toNotificationGroup = toNotificationGroup;
|
|
8
|
+
const toNotificationGroupStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_NOTIFICATION_GROUPS);
|
|
9
|
+
exports.toNotificationGroupStrict = toNotificationGroupStrict;
|
|
10
|
+
exports.ALL_NOTIFICATION_STATUSES = ['read', 'unread'];
|
|
11
|
+
const toNotificationStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_NOTIFICATION_STATUSES);
|
|
12
|
+
exports.toNotificationStatus = toNotificationStatus;
|
|
13
|
+
const toNotificationStatusStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_NOTIFICATION_STATUSES);
|
|
14
|
+
exports.toNotificationStatusStrict = toNotificationStatusStrict;
|
|
15
|
+
exports.ALL_NOTIFICATION_MODES = ['dashboard', 'email'];
|
|
16
|
+
const toNotificationMode = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_NOTIFICATION_MODES);
|
|
17
|
+
exports.toNotificationMode = toNotificationMode;
|
|
18
|
+
const toNotificationModeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_NOTIFICATION_MODES);
|
|
19
|
+
exports.toNotificationModeStrict = toNotificationModeStrict;
|
|
20
|
+
exports.ALL_TASK_MANAGER_NOTIFICATION_ACTIVITY_TYPES = [
|
|
21
|
+
'task_assigned',
|
|
22
|
+
'task_status_updated',
|
|
23
|
+
'task_activities',
|
|
24
|
+
'task_created',
|
|
25
|
+
'task_deleted',
|
|
26
|
+
'task_archived',
|
|
27
|
+
'task_due',
|
|
28
|
+
'task_overdue',
|
|
29
|
+
];
|
|
30
|
+
exports.ALL_NOTIFICATION_ACTIVITY_TYPES = [
|
|
31
|
+
...exports.ALL_TASK_MANAGER_NOTIFICATION_ACTIVITY_TYPES, // We'll add more feature based lists here
|
|
32
|
+
];
|
|
33
|
+
const toNotificationActivityType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_NOTIFICATION_ACTIVITY_TYPES);
|
|
34
|
+
exports.toNotificationActivityType = toNotificationActivityType;
|
|
35
|
+
const toNotificationActivityTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_NOTIFICATION_ACTIVITY_TYPES);
|
|
36
|
+
exports.toNotificationActivityTypeStrict = toNotificationActivityTypeStrict;
|
|
37
|
+
exports.ALL_NOTIFICATION_UPDATE_VALUE_TYPES = [
|
|
38
|
+
'string',
|
|
39
|
+
'list',
|
|
40
|
+
'code_name_pair',
|
|
41
|
+
];
|
|
42
|
+
const toNotificationUpdateValueType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_NOTIFICATION_UPDATE_VALUE_TYPES);
|
|
43
|
+
exports.toNotificationUpdateValueType = toNotificationUpdateValueType;
|
|
44
|
+
const toNotificationUpdateValueTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_NOTIFICATION_UPDATE_VALUE_TYPES);
|
|
45
|
+
exports.toNotificationUpdateValueTypeStrict = toNotificationUpdateValueTypeStrict;
|
|
46
|
+
const getNotificationIdentifier = (notificationGroup, notificationType) => `${notificationGroup}.${notificationType}.notification`;
|
|
47
|
+
exports.getNotificationIdentifier = getNotificationIdentifier;
|
|
48
|
+
const toNotificationIdentifier = (notification_identifier // Expected format from platform is - {notification_group}.{notification_type}.notification
|
|
49
|
+
) => {
|
|
50
|
+
const notificationIdentifiers = notification_identifier.split('.');
|
|
51
|
+
if (notificationIdentifiers.length < 3 ||
|
|
52
|
+
notificationIdentifiers[2] !== 'notification') {
|
|
53
|
+
throw new Error(`Invalid notificationIdentifier received - ${notification_identifier}`);
|
|
54
|
+
}
|
|
55
|
+
const [notification_group, notification_type] = notificationIdentifiers;
|
|
56
|
+
return (0, exports.getNotificationIdentifier)((0, exports.toNotificationGroup)(notification_group), (0, exports.toNotificationActivityType)(notification_type));
|
|
57
|
+
};
|
|
58
|
+
exports.toNotificationIdentifier = toNotificationIdentifier;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNestedAccountIDHierarchyForAccounts = void 0;
|
|
4
|
-
const
|
|
4
|
+
const getNestedAccountIDHierarchyForReport_1 = require("../../commonStateTypes/accountView/getNestedAccountIDHierarchyForReport");
|
|
5
5
|
/**
|
|
6
6
|
* Given section class names, generate the nested class hierarchy.
|
|
7
7
|
* @param _accountNames
|
|
8
8
|
* @param _accountsMetadata
|
|
9
9
|
*/
|
|
10
10
|
function getNestedAccountIDHierarchyForAccounts(accountNames, accountsMetadata) {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const nestedHierarchy = [];
|
|
12
|
+
const pushIntoParentNodeHierarchy = (accountMeta, nestedAccounts) => {
|
|
13
13
|
for (let index = 0; index < nestedAccounts.length; index++) {
|
|
14
14
|
if (nestedAccounts[index].id[0] === accountMeta.parentAccountId) {
|
|
15
15
|
nestedAccounts[index].children.push({
|
|
@@ -23,7 +23,7 @@ function getNestedAccountIDHierarchyForAccounts(accountNames, accountsMetadata)
|
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
25
|
if (nestedAccounts[index].children.length > 0) {
|
|
26
|
-
|
|
26
|
+
pushIntoParentNodeHierarchy(accountMeta, nestedAccounts[index].children);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -32,20 +32,20 @@ function getNestedAccountIDHierarchyForAccounts(accountNames, accountsMetadata)
|
|
|
32
32
|
orderedAccountnames.forEach((eachAccount) => {
|
|
33
33
|
if (eachAccount.parentAccountId != null &&
|
|
34
34
|
orderedAccountnames.find((accountMeta) => accountMeta.accountId === eachAccount.parentAccountId) != null) {
|
|
35
|
-
|
|
35
|
+
pushIntoParentNodeHierarchy(eachAccount, nestedHierarchy);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
|
|
39
|
-
id: (0,
|
|
38
|
+
nestedHierarchy.push({
|
|
39
|
+
id: (0, getNestedAccountIDHierarchyForReport_1.getNestedAccountIDForAccount)(eachAccount.accountId, accountsMetadata),
|
|
40
40
|
children: [],
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
return
|
|
44
|
+
return nestedHierarchy;
|
|
45
45
|
}
|
|
46
46
|
exports.getNestedAccountIDHierarchyForAccounts = getNestedAccountIDHierarchyForAccounts;
|
|
47
47
|
/**
|
|
48
|
-
* This function will return an ordered list of all the section names that need to be part of the
|
|
48
|
+
* This function will return an ordered list of all the section names that need to be part of the hierarchy
|
|
49
49
|
* @param sectionNames
|
|
50
50
|
* @param accountMetadata
|
|
51
51
|
* @returns
|
|
@@ -10,5 +10,5 @@ export interface SectionAccountsView {
|
|
|
10
10
|
nestedAccountIds: NestedAccountIDHierarchy[];
|
|
11
11
|
accountGroupKeys: AccountGroupKey[];
|
|
12
12
|
}
|
|
13
|
-
export declare function getSectionAccountViewKey(sectionId: ID, reportId: ReportIDPlusForecastID): `${string}-cash_balance` | `${string}-card_balance` | `${string}-operating_expenses` | `${string}-operating_expenses_by_classes` | `${string}-revenue` | `${string}-revenue_by_classes` | `${string}-net_burn_or_income` | `${string}-net_burn_or_income_story_card` | `${string}-net_burn_or_income_by_classes` | `${string}-cash_position` | `${string}-top_expenses` | `${string}-profit_and_loss` | `${string}-profit_and_loss_by_classes` | `${string}-balance_sheet` | `${string}-cash_flow` | `${string}-dashboard` | `${string}-finance_statement` | `${string}-transaction_list_of_account` | `${string}-transaction_list_missing_receipt` | `${string}-transaction_list_of_account_by_class` | `${string}-transaction_detail` | `${string}-cash_in_cash_out` | `${string}-insights_dashboard` | `${string}-company_details` | `${string}-class_list` | `${string}-account_list` | `${string}-account_list_by_type` | `${string}-vendor` | `${string}-task_card` | `${string}-bill_pay` | `${string}-reimbursement` | `${string}-bill_pay_card` | `${string}-reimbursement_card` | `${string}-bill_pay_promo_card` | `${string}-zeni_accounts` | `${string}-zeni_accounts_promo_card` | `${string}-charge_cards` | `${string}-reimbursement_promo_card` | `${string}-onboarding` | `${string}-operating_expenses_by_vendor` | `${string}-operating_expenses_by_vendor_summary` | `${string}-vendors_tab` | `${string}-accounts_payable_aging` | `${string}-accounts_receivable_aging` | `${string}-vendor_global_review` | `${string}-prepaid_expenses` | `${string}-fixed_assets` | `${string}-cash_balance+${string}` | `${string}-card_balance+${string}` | `${string}-operating_expenses+${string}` | `${string}-operating_expenses_by_classes+${string}` | `${string}-revenue+${string}` | `${string}-revenue_by_classes+${string}` | `${string}-net_burn_or_income+${string}` | `${string}-net_burn_or_income_story_card+${string}` | `${string}-net_burn_or_income_by_classes+${string}` | `${string}-cash_position+${string}` | `${string}-top_expenses+${string}` | `${string}-profit_and_loss+${string}` | `${string}-profit_and_loss_by_classes+${string}` | `${string}-balance_sheet+${string}` | `${string}-cash_flow+${string}` | `${string}-dashboard+${string}` | `${string}-finance_statement+${string}` | `${string}-transaction_list_of_account+${string}` | `${string}-transaction_list_missing_receipt+${string}` | `${string}-transaction_list_of_account_by_class+${string}` | `${string}-transaction_detail+${string}` | `${string}-cash_in_cash_out+${string}` | `${string}-insights_dashboard+${string}` | `${string}-company_details+${string}` | `${string}-class_list+${string}` | `${string}-account_list+${string}` | `${string}-account_list_by_type+${string}` | `${string}-vendor+${string}` | `${string}-task_card+${string}` | `${string}-bill_pay+${string}` | `${string}-reimbursement+${string}` | `${string}-bill_pay_card+${string}` | `${string}-reimbursement_card+${string}` | `${string}-bill_pay_promo_card+${string}` | `${string}-zeni_accounts+${string}` | `${string}-zeni_accounts_promo_card+${string}` | `${string}-charge_cards+${string}` | `${string}-reimbursement_promo_card+${string}` | `${string}-onboarding+${string}` | `${string}-operating_expenses_by_vendor+${string}` | `${string}-operating_expenses_by_vendor_summary+${string}` | `${string}-vendors_tab+${string}` | `${string}-accounts_payable_aging+${string}` | `${string}-accounts_receivable_aging+${string}` | `${string}-vendor_global_review+${string}` | `${string}-prepaid_expenses+${string}` | `${string}-fixed_assets+${string}`;
|
|
13
|
+
export declare function getSectionAccountViewKey(sectionId: ID, reportId: ReportIDPlusForecastID): `${string}-cash_balance` | `${string}-card_balance` | `${string}-operating_expenses` | `${string}-operating_expenses_by_classes` | `${string}-revenue` | `${string}-revenue_by_classes` | `${string}-net_burn_or_income` | `${string}-net_burn_or_income_story_card` | `${string}-net_burn_or_income_by_classes` | `${string}-cash_position` | `${string}-top_expenses` | `${string}-profit_and_loss` | `${string}-profit_and_loss_by_classes` | `${string}-balance_sheet` | `${string}-cash_flow` | `${string}-dashboard` | `${string}-finance_statement` | `${string}-transaction_list_of_account` | `${string}-transaction_list_missing_receipt` | `${string}-transaction_list_of_account_by_class` | `${string}-transaction_detail` | `${string}-cash_in_cash_out` | `${string}-insights_dashboard` | `${string}-company_details` | `${string}-class_list` | `${string}-account_list` | `${string}-account_list_by_type` | `${string}-vendor` | `${string}-task_card` | `${string}-bill_pay` | `${string}-reimbursement` | `${string}-bill_pay_card` | `${string}-reimbursement_card` | `${string}-bill_pay_promo_card` | `${string}-zeni_accounts` | `${string}-zeni_accounts_promo_card` | `${string}-charge_cards` | `${string}-reimbursement_promo_card` | `${string}-onboarding` | `${string}-operating_expenses_by_vendor` | `${string}-operating_expenses_by_vendor_summary` | `${string}-vendors_tab` | `${string}-accounts_payable_aging` | `${string}-accounts_receivable_aging` | `${string}-vendor_global_review` | `${string}-prepaid_expenses` | `${string}-fixed_assets` | `${string}-notification` | `${string}-cash_balance+${string}` | `${string}-card_balance+${string}` | `${string}-operating_expenses+${string}` | `${string}-operating_expenses_by_classes+${string}` | `${string}-revenue+${string}` | `${string}-revenue_by_classes+${string}` | `${string}-net_burn_or_income+${string}` | `${string}-net_burn_or_income_story_card+${string}` | `${string}-net_burn_or_income_by_classes+${string}` | `${string}-cash_position+${string}` | `${string}-top_expenses+${string}` | `${string}-profit_and_loss+${string}` | `${string}-profit_and_loss_by_classes+${string}` | `${string}-balance_sheet+${string}` | `${string}-cash_flow+${string}` | `${string}-dashboard+${string}` | `${string}-finance_statement+${string}` | `${string}-transaction_list_of_account+${string}` | `${string}-transaction_list_missing_receipt+${string}` | `${string}-transaction_list_of_account_by_class+${string}` | `${string}-transaction_detail+${string}` | `${string}-cash_in_cash_out+${string}` | `${string}-insights_dashboard+${string}` | `${string}-company_details+${string}` | `${string}-class_list+${string}` | `${string}-account_list+${string}` | `${string}-account_list_by_type+${string}` | `${string}-vendor+${string}` | `${string}-task_card+${string}` | `${string}-bill_pay+${string}` | `${string}-reimbursement+${string}` | `${string}-bill_pay_card+${string}` | `${string}-reimbursement_card+${string}` | `${string}-bill_pay_promo_card+${string}` | `${string}-zeni_accounts+${string}` | `${string}-zeni_accounts_promo_card+${string}` | `${string}-charge_cards+${string}` | `${string}-reimbursement_promo_card+${string}` | `${string}-onboarding+${string}` | `${string}-operating_expenses_by_vendor+${string}` | `${string}-operating_expenses_by_vendor_summary+${string}` | `${string}-vendors_tab+${string}` | `${string}-accounts_payable_aging+${string}` | `${string}-accounts_receivable_aging+${string}` | `${string}-vendor_global_review+${string}` | `${string}-prepaid_expenses+${string}` | `${string}-fixed_assets+${string}` | `${string}-notification+${string}`;
|
|
14
14
|
export declare type SectionAccountKey = ReturnType<typeof getSectionAccountViewKey>;
|
|
@@ -4,7 +4,7 @@ exports.updateSectionAccountsViewEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const sectionAccountsViewReducer_1 = require("./sectionAccountsViewReducer");
|
|
7
|
-
const
|
|
7
|
+
const getNestedAccountIDHierarchyForReport_1 = require("../../commonStateTypes/accountView/getNestedAccountIDHierarchyForReport");
|
|
8
8
|
const getNestedAccountIDHierarchyForSection_1 = require("./getNestedAccountIDHierarchyForSection");
|
|
9
9
|
const accountPayload_1 = require("../account/accountPayload");
|
|
10
10
|
const accountGroupReducer_1 = require("../accountGroup/accountGroupReducer");
|
|
@@ -20,7 +20,7 @@ const updateSectionAccountsViewEpic = (actions$) => actions$.pipe((0, operators_
|
|
|
20
20
|
const accountGroupMetadataPayload = action.payload.accountGroupMetadataPayload;
|
|
21
21
|
const currencyPayload = action.payload.currencyPayload;
|
|
22
22
|
const accountsMetadata = accountsMetadataPayload.map((eachAccount) => (0, accountPayload_1.mapAccountMetadataPayloadToAccountMetadata)(eachAccount));
|
|
23
|
-
const accountMetadataRecordsByID = (0,
|
|
23
|
+
const accountMetadataRecordsByID = (0, getNestedAccountIDHierarchyForReport_1.getAllAccountMetadataRecordsByID)(accountsMetadataPayload);
|
|
24
24
|
// This would mean a non-zeni COA
|
|
25
25
|
if (sectionPayload.accounts != null) {
|
|
26
26
|
const accounts = sectionPayload.accounts;
|