awing-library 2.1.21-beta → 2.1.21
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/ACM-AXN/Campaign/Container.js +1 -1
- package/lib/ACM-AXN/Campaign/CreateOrEdit/Recoils.js +1 -1
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabInfomation.js +3 -9
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/AdList.js +4 -4
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/AddOrEditRule/RuleForm/RetargetMacAddress/component.js +2 -1
- package/lib/ACM-AXN/Campaign/CreateOrEdit/index.js +6 -0
- package/lib/ACM-AXN/Campaign/Types.d.ts +8 -0
- package/lib/ACM-AXN/Campaign/Utils.js +1 -1
- package/lib/ACM-AXN/Campaign/index.js +2 -1
- package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/Filter.d.ts +2 -2
- package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/Filter.js +44 -42
- package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/GroupPanel.d.ts +1 -1
- package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/GroupPanel.js +38 -30
- package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/index.d.ts +2 -2
- package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/index.js +2 -2
- package/lib/ACM-AXN/CampaignSchedule/Components/EnhancedPagination/index.d.ts +1 -1
- package/lib/ACM-AXN/CampaignSchedule/Components/EnhancedPagination/index.js +4 -2
- package/lib/ACM-AXN/CampaignSchedule/Components/RowAdvance/component.js +69 -5
- package/lib/ACM-AXN/CampaignSchedule/Components/RowAdvance/container.d.ts +1 -1
- package/lib/ACM-AXN/CampaignSchedule/Components/RowAdvance/container.js +85 -36
- package/lib/ACM-AXN/CampaignSchedule/Components/TableHeaderDragable.d.ts +1 -1
- package/lib/ACM-AXN/CampaignSchedule/Components/TableHeaderDragable.js +38 -29
- package/lib/ACM-AXN/CampaignSchedule/DataConfigAXN.d.ts +4 -0
- package/lib/ACM-AXN/CampaignSchedule/DataConfigAXN.js +58 -0
- package/lib/ACM-AXN/CampaignSchedule/Enum.d.ts +14 -2
- package/lib/ACM-AXN/CampaignSchedule/Enum.js +12 -0
- package/lib/ACM-AXN/CampaignSchedule/component.d.ts +2 -2
- package/lib/ACM-AXN/CampaignSchedule/component.js +44 -15
- package/lib/ACM-AXN/CampaignSchedule/container.d.ts +1 -1
- package/lib/ACM-AXN/CampaignSchedule/container.js +100 -99
- package/lib/ACM-AXN/CampaignSchedule/interface.d.ts +19 -3
- package/lib/ACM-AXN/Directory/DomainDirectory/DomainDirectory.test.js +1 -0
- package/lib/ACM-AXN/Directory/DomainDirectory/FolderDetail.test.js +1 -0
- package/lib/ACM-AXN/Directory/MenuDirectory/MenuDirectory.test.js +1 -0
- package/lib/ACM-AXN/Directory/MenuDirectory/index.js +7 -21
- package/lib/ACM-AXN/Directory/SystemDirectory/SystemDirectory.test.js +1 -0
- package/lib/ACM-AXN/Directory/SystemDirectory/index.js +6 -5
- package/lib/ACM-AXN/Directory/components/CreateOrEditFolder.test.js +1 -0
- package/lib/ACM-AXN/Directory/components/Permission/AddAuthen.test.js +2 -0
- package/lib/ACM-AXN/Directory/components/Permission/CreateOrEditPermission.test.js +2 -0
- package/lib/ACM-AXN/Directory/components/Permission/Management.js +7 -5
- package/lib/ACM-AXN/Directory/components/Permission/ManagementPermission.test.js +3 -0
- package/lib/ACM-AXN/Directory/components/Permission/MenuPermissions/MenuPermissionManagement.js +9 -7
- package/lib/ACM-AXN/Directory/components/Permission/MenuPermissions/MenuPermissionManagement.test.js +2 -0
- package/lib/ACM-AXN/Directory/function.d.ts +1 -0
- package/lib/ACM-AXN/Directory/function.js +15 -1
- package/lib/ACM-AXN/DomainPreview/PreviewButton.js +57 -34
- package/lib/ACM-AXN/GroupUser/Container.js +1 -1
- package/lib/ACM-AXN/GroupUser/CreateOrEdit.js +25 -10
- package/lib/ACM-AXN/GroupUser/User/UserComponent.d.ts +2 -1
- package/lib/ACM-AXN/GroupUser/User/UserComponent.js +10 -4
- package/lib/ACM-AXN/Notifications/Constant.d.ts +146 -0
- package/lib/ACM-AXN/Notifications/Constant.js +136 -0
- package/lib/ACM-AXN/Notifications/Context.d.ts +8 -0
- package/lib/ACM-AXN/Notifications/Context.js +10 -0
- package/lib/ACM-AXN/Notifications/Hooks.d.ts +7 -0
- package/lib/ACM-AXN/Notifications/Hooks.js +17 -0
- package/lib/ACM-AXN/Notifications/NotificationDetail/HeaderInfo/ButtonTabs.d.ts +3 -3
- package/lib/ACM-AXN/Notifications/NotificationDetail/HeaderInfo/ButtonTabs.js +31 -30
- package/lib/ACM-AXN/Notifications/NotificationDetail/HeaderInfo/MenuNotification.d.ts +1 -1
- package/lib/ACM-AXN/Notifications/NotificationDetail/HeaderInfo/MenuNotification.js +30 -39
- package/lib/ACM-AXN/Notifications/NotificationDetail/HeaderInfo/index.d.ts +3 -5
- package/lib/ACM-AXN/Notifications/NotificationDetail/HeaderInfo/index.js +18 -17
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationEmpty.d.ts +1 -1
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationEmpty.js +15 -15
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationEmpty.test.d.ts +0 -6
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationEmpty.test.js +29 -28
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/Message.d.ts +11 -0
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/Message.js +291 -0
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/NotificationAvatar.d.ts +1 -1
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/NotificationAvatar.js +3 -3
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/NotificationAvatar.test.d.ts +0 -6
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/NotificationAvatar.test.js +38 -48
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/NotificationContent.d.ts +2 -2
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/NotificationContent.js +38 -35
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/NotificationContent.test.d.ts +0 -6
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/NotificationContent.test.js +65 -73
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/index.d.ts +4 -11
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/index.js +48 -36
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/index.test.d.ts +0 -6
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/index.test.js +56 -50
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationLoading.js +30 -30
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/index.d.ts +3 -15
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/index.js +35 -4
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/index.test.d.ts +0 -6
- package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/index.test.js +88 -83
- package/lib/ACM-AXN/Notifications/NotificationDetail/index.d.ts +5 -2
- package/lib/ACM-AXN/Notifications/NotificationDetail/index.js +115 -101
- package/lib/ACM-AXN/Notifications/{NotificationPopover.d.ts → NotificationPopover/Container.d.ts} +2 -2
- package/lib/ACM-AXN/Notifications/NotificationPopover/Container.js +149 -0
- package/lib/ACM-AXN/Notifications/{NotificationPopover.test.d.ts → NotificationPopover/Container.test.d.ts} +1 -1
- package/lib/ACM-AXN/Notifications/{NotificationPopover.test.js → NotificationPopover/Container.test.js} +5 -5
- package/lib/ACM-AXN/Notifications/NotificationPopover/index.d.ts +8 -0
- package/lib/ACM-AXN/Notifications/NotificationPopover/index.js +13 -0
- package/lib/ACM-AXN/Notifications/NotificationScreen.d.ts +1 -1
- package/lib/ACM-AXN/Notifications/NotificationScreen.js +4 -4
- package/lib/ACM-AXN/Notifications/Types.d.ts +84 -0
- package/lib/ACM-AXN/Notifications/Types.js +13 -0
- package/lib/ACM-AXN/Notifications/index.d.ts +2 -2
- package/lib/ACM-AXN/Notifications/index.js +5 -5
- package/lib/ACM-AXN/Page/Container.js +5 -4
- package/lib/ACM-AXN/Page/CreateOrEdit/Components/useListPageView.js +9 -4
- package/lib/ACM-AXN/Page/CreateOrEdit/DrawerAction.js +6 -1
- package/lib/ACM-AXN/Page/CreateOrEdit/Recoil.d.ts +2 -1
- package/lib/ACM-AXN/Page/CreateOrEdit/Recoil.js +14 -1
- package/lib/ACM-AXN/Page/CreateOrEdit/TabFile/FileUtils.d.ts +3 -1
- package/lib/ACM-AXN/Page/CreateOrEdit/TabFile/FileUtils.js +1 -6
- package/lib/ACM-AXN/Page/CreateOrEdit/TabFile/index.d.ts +7 -0
- package/lib/ACM-AXN/Page/CreateOrEdit/TabFile/index.js +13 -15
- package/lib/ACM-AXN/Page/CreateOrEdit/Tabview/ViewContent.js +24 -2
- package/lib/ACM-AXN/Page/CreateOrEdit/Tabview/ViewInfo.d.ts +3 -2
- package/lib/ACM-AXN/Page/CreateOrEdit/Tabview/ViewInfo.js +1 -0
- package/lib/ACM-AXN/Page/CreateOrEdit/Tabview/index.js +2 -1
- package/lib/ACM-AXN/Page/CreateOrEdit/Tabview/index.test.js +2 -1
- package/lib/ACM-AXN/Page/CreateOrEdit/Utils.d.ts +4 -4
- package/lib/ACM-AXN/Page/CreateOrEdit/Utils.js +19 -8
- package/lib/ACM-AXN/Page/Types.d.ts +11 -37
- package/lib/ACM-AXN/Page/enums.d.ts +6 -0
- package/lib/ACM-AXN/Page/enums.js +8 -1
- package/lib/ACM-AXN/Page/index.js +2 -1
- package/lib/ACM-AXN/PlaceFilter/DataTable/container.js +1 -2
- package/lib/ACM-AXN/PlaceFilter/Input/container.js +12 -2
- package/lib/ACM-AXN/PlaceFilter/common.d.ts +1 -0
- package/lib/ACM-AXN/PlaceFilter/common.js +27 -1
- package/lib/ACM-AXN/PlaceGroup/Container.js +1 -1
- package/lib/ACM-AXN/PlaceGroup/ContentCreateOrEdit.d.ts +0 -7
- package/lib/ACM-AXN/PlaceGroup/ContentCreateOrEdit.js +0 -135
- package/lib/ACM-AXN/PlaceGroup/ContentCreateOrEdit.test.js +2 -2
- package/lib/ACM-AXN/PlaceGroup/Context.d.ts +1 -1
- package/lib/ACM-AXN/PlaceGroup/CreateOrEdit.js +103 -3
- package/lib/ACM-AXN/Statistics/ControlPanel.js +27 -39
- package/lib/ACM-AXN/Statistics/interface.d.ts +2 -2
- package/lib/ACM-AXN/StatisticsAudienceDemographic/container.d.ts +1 -1
- package/lib/ACM-AXN/StatisticsAudienceDemographic/container.js +2 -3
- package/lib/ACM-AXN/StatisticsAudienceDemographic/interfaces.d.ts +1 -0
- package/lib/ACM-AXN/StatisticsByProvince/container.d.ts +1 -1
- package/lib/ACM-AXN/StatisticsByProvince/container.js +2 -2
- package/lib/ACM-AXN/TaskScheduler/Components/TriggerInput.js +4 -2
- package/lib/ACM-AXN/TaskScheduler/Constant.d.ts +0 -107
- package/lib/ACM-AXN/TaskScheduler/Constant.js +1 -105
- package/lib/ACM-AXN/TaskScheduler/Container.js +1 -1
- package/lib/ACM-AXN/TaskScheduler/CreateOrEdit.js +6 -8
- package/lib/ACM-AXN/TaskScheduler/Utils.js +6 -1
- package/lib/ACM-AXN/Template/Constants.d.ts +0 -0
- package/lib/ACM-AXN/Template/Constants.js +1 -0
- package/lib/ACM-AXN/Template/Container.d.ts +2 -0
- package/lib/ACM-AXN/Template/Container.js +74 -0
- package/lib/ACM-AXN/Template/Container.test.d.ts +1 -0
- package/lib/ACM-AXN/Template/Container.test.js +259 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/CreateOrEdit.test.d.ts +1 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/CreateOrEdit.test.js +370 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Infomation.d.ts +9 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Infomation.js +78 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Infomation.test.d.ts +1 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Infomation.test.js +150 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Recoils.d.ts +6 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Recoils.js +79 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Script.d.ts +3 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Script.js +58 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Script.test.d.ts +1 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Script.test.js +162 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Template/Events.d.ts +5 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Template/Events.js +41 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Template/Parameter.d.ts +20 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Template/Parameter.js +283 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Template/Parameter.test.d.ts +1 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Template/Parameter.test.js +220 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Template/Utils.d.ts +25 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Template/Utils.js +138 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Template/index.d.ts +3 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/Template/index.js +46 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/index.d.ts +3 -0
- package/lib/ACM-AXN/Template/CreateOrEdit/index.js +215 -0
- package/lib/ACM-AXN/Template/Hooks.d.ts +5 -0
- package/lib/ACM-AXN/Template/Hooks.js +13 -0
- package/lib/ACM-AXN/Template/Import.d.ts +2 -0
- package/lib/ACM-AXN/Template/Import.js +123 -0
- package/lib/ACM-AXN/Template/Import.test.d.ts +1 -0
- package/lib/ACM-AXN/Template/Import.test.js +188 -0
- package/lib/ACM-AXN/Template/Types.d.ts +84 -0
- package/lib/ACM-AXN/Template/Types.js +2 -0
- package/lib/ACM-AXN/Template/UploadButton.d.ts +2 -0
- package/lib/ACM-AXN/Template/UploadButton.js +14 -0
- package/lib/ACM-AXN/Template/index.d.ts +5 -0
- package/lib/ACM-AXN/Template/index.js +44 -0
- package/lib/ACM-AXN/TransactionLog/Container.js +7 -5
- package/lib/ACM-AXN/TransactionLog/Detail.js +3 -1
- package/lib/ACM-AXN/TransactionLog/Types.d.ts +1 -107
- package/lib/ACM-AXN/TransactionLog/Types.js +1 -109
- package/lib/ACM-AXN/TransactionLog/Utils.d.ts +0 -103
- package/lib/ACM-AXN/TransactionLog/Utils.js +1 -104
- package/lib/ACM-AXN/User/Container.js +1 -1
- package/lib/ACM-AXN/ViewTemplate/TemplateField/Fields/BasicField/index.js +1 -1
- package/lib/ACM-AXN/ViewTemplate/TemplateField/Fields/ObjectField.d.ts +2 -0
- package/lib/ACM-AXN/ViewTemplate/TemplateField/Fields/ObjectField.js +19 -3
- package/lib/ACM-AXN/ViewTemplate/container.js +2 -1
- package/lib/ACM-AXN/ViewTemplate/index.d.ts +2 -1
- package/lib/ACM-AXN/ViewTemplate/interface.d.ts +6 -1
- package/lib/AWING/AdvancedSearch/component.js +1 -1
- package/lib/AWING/AdvancedSearch/interface.d.ts +1 -0
- package/lib/AWING/BasicDataForm/index.js +3 -1
- package/lib/AWING/BasicDataForm/interface.d.ts +2 -2
- package/lib/AWING/ButtonDateRangePicker/ButtonDateRangePicker.js +2 -2
- package/lib/AWING/ButtonDateRangePicker/interface.d.ts +1 -0
- package/lib/AWING/ButtonSelect/index.js +2 -2
- package/lib/AWING/Chart/BarLineComponent.d.ts +8 -5
- package/lib/AWING/Chart/BarLineComponent.js +34 -28
- package/lib/AWING/Chart/PieComponent.d.ts +8 -7
- package/lib/AWING/Chart/PieComponent.js +1 -2
- package/lib/AWING/Chart/Styles.d.ts +6 -2
- package/lib/AWING/Chart/Styles.js +6 -2
- package/lib/AWING/Chart/index.d.ts +3 -0
- package/lib/AWING/Chart/index.js +10 -0
- package/lib/AWING/DataForm/DataInput.js +19 -10
- package/lib/AWING/DataForm/interface.d.ts +8 -4
- package/lib/AWING/DataGrid/index.js +17 -5
- package/lib/AWING/DataGrid/interface.d.ts +1 -1
- package/lib/AWING/DateRangePicker/component.js +101 -132
- package/lib/AWING/DateRangePicker/configDate.d.ts +8 -0
- package/lib/AWING/DateRangePicker/configDate.js +71 -0
- package/lib/AWING/DateRangePicker/interface.d.ts +1 -0
- package/lib/AWING/Directory/CreateDirectory.d.ts +3 -0
- package/lib/AWING/Directory/CreateDirectory.js +27 -10
- package/lib/AWING/HOC/Wrapper.d.ts +6 -0
- package/lib/AWING/HOC/Wrapper.js +10 -0
- package/lib/AWING/LogicExpression/script.js +0 -1
- package/lib/AWING/PageManagement/PageManagement.js +1 -1
- package/lib/AWING/index.d.ts +1 -0
- package/lib/AWING/index.js +1 -0
- package/lib/AWING/ultis/validation.d.ts +1 -1
- package/lib/AWING/ultis/validation.js +4 -2
- package/lib/Commons/Components/ClassicBaseDrawer.d.ts +1 -0
- package/lib/Commons/Components/ClassicBaseDrawer.js +7 -3
- package/lib/Commons/Components/ClassicDrawer.js +1 -1
- package/lib/Context/index.js +1 -0
- package/lib/Context/interface.d.ts +1 -0
- package/lib/Utils/Helpers.d.ts +1 -0
- package/lib/Utils/Helpers.js +17 -9
- package/lib/translate/en/translation.json +102 -3
- package/lib/translate/vi/translation.json +102 -3
- package/package.json +3 -1
- package/lib/ACM-AXN/Notifications/NotificationDetail/Common.d.ts +0 -39
- package/lib/ACM-AXN/Notifications/NotificationDetail/Common.js +0 -304
- package/lib/ACM-AXN/Notifications/NotificationPopover.js +0 -69
- package/lib/ACM-AXN/Page/CreateOrEdit/TabFile/index.test.d.ts +0 -1
- package/lib/ACM-AXN/Page/CreateOrEdit/TabFile/index.test.js +0 -326
- package/lib/ACM-AXN/Page/ViewDomain/index.d.ts +0 -9
- package/lib/ACM-AXN/Page/ViewDomain/index.js +0 -148
|
@@ -1,84 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
2
|
+
// /**
|
|
3
|
+
// *
|
|
4
|
+
// * @author dauquan1108@gmail.com on 12/7/2023.
|
|
5
|
+
// *
|
|
6
|
+
// **/
|
|
7
|
+
// import React from "react";
|
|
8
|
+
// import { render } from "@testing-library/react";
|
|
9
|
+
// import "@testing-library/jest-dom";
|
|
10
|
+
// // Component
|
|
11
|
+
// import NotificationList from ".";
|
|
12
|
+
// jest.mock('./NotificationItem', () => (props:any) => {
|
|
13
|
+
// const { data, onUpdateStatus } = props;
|
|
14
|
+
// return (
|
|
15
|
+
// <div data-testid="notification-item" onClick={() => onUpdateStatus(data.id)}>
|
|
16
|
+
// <span>{data.content}</span>
|
|
17
|
+
// </div>
|
|
18
|
+
// );
|
|
19
|
+
// });
|
|
20
|
+
// jest.mock("./NotificationLoading", () => () => {
|
|
21
|
+
// return <div>icon Loading</div>;
|
|
22
|
+
// });
|
|
23
|
+
// describe("NotificationList component", () => {
|
|
24
|
+
// it("Hiển thị thông báo đối với trường hợp 'notifications' chưa có dữ liệu", () => {
|
|
25
|
+
// const props = {
|
|
26
|
+
// isLoading: false,
|
|
27
|
+
// notifications: [],
|
|
28
|
+
// onUpdateStatus: () => null,
|
|
29
|
+
// valueFilter: { textSearch: "", tabs: "" },
|
|
30
|
+
// };
|
|
31
|
+
// const { getByText } = render(<NotificationList {...props} />);
|
|
32
|
+
// const noNotificationsText = getByText("Notifications.TitleNoNotifications");
|
|
33
|
+
// expect(noNotificationsText).toBeInTheDocument();
|
|
34
|
+
// });
|
|
35
|
+
// it("Hiện thị danh sách thông báo khi notifications có dữ liệu", () => {
|
|
36
|
+
// const props = {
|
|
37
|
+
// isLoading: false,
|
|
38
|
+
// notifications: [
|
|
39
|
+
// {
|
|
40
|
+
// id: "1",
|
|
41
|
+
// content:
|
|
42
|
+
// '<p>Chiến dịch <a href="https://github.com/dauquan1108" target="_blank" style="text-decoration: none; color: blue;" title="Đậu Xuân Quân">Đậu Xuân Quân</a> đã được cập nhật.</p>',
|
|
43
|
+
// url: "https://awing.vn/",
|
|
44
|
+
// status: true,
|
|
45
|
+
// userName: "Đậu Xuân Quân",
|
|
46
|
+
// avatarUrl:
|
|
47
|
+
// "https://i.pinimg.com/564x/7d/be/68/7dbe686677277a06de561b16c1e2740b.jpg",
|
|
48
|
+
// time: "2023-12-06 10:30",
|
|
49
|
+
// },
|
|
50
|
+
// ],
|
|
51
|
+
// onUpdateStatus: () => null,
|
|
52
|
+
// valueFilter: { textSearch: "", tabs: "" },
|
|
53
|
+
// };
|
|
54
|
+
// const notifications = [
|
|
55
|
+
// {
|
|
56
|
+
// id: "1",
|
|
57
|
+
// content:
|
|
58
|
+
// '<p>Chiến dịch <a href="https://github.com/dauquan1108" target="_blank" style="text-decoration: none; color: blue;" title="Đậu Xuân Quân">Đậu Xuân Quân</a> đã được cập nhật.</p>',
|
|
59
|
+
// url: "https://awing.vn/",
|
|
60
|
+
// status: true,
|
|
61
|
+
// userName: "Đậu Xuân Quân",
|
|
62
|
+
// avatarUrl:
|
|
63
|
+
// "https://i.pinimg.com/564x/7d/be/68/7dbe686677277a06de561b16c1e2740b.jpg",
|
|
64
|
+
// time: "2023-12-06 10:30",
|
|
65
|
+
// },
|
|
66
|
+
// ];
|
|
67
|
+
// const { getAllByTestId } = render(
|
|
68
|
+
// <NotificationList
|
|
69
|
+
// valueFilter={{ textSearch: "", tabs: "" }}
|
|
70
|
+
// onUpdateStatus={() => null}
|
|
71
|
+
// isLoading={false}
|
|
72
|
+
// notifications={notifications}
|
|
73
|
+
// />
|
|
74
|
+
// );
|
|
75
|
+
// const notificationItems = getAllByTestId('notification-item');
|
|
76
|
+
// expect(notificationItems).toHaveLength(notifications.length);
|
|
77
|
+
// });
|
|
78
|
+
// it("Hiển thị trạng thái Loading khi 'isLoading=true'.", () => {
|
|
79
|
+
// const props = {
|
|
80
|
+
// isLoading: true,
|
|
81
|
+
// notifications: [],
|
|
82
|
+
// onUpdateStatus: () => null,
|
|
83
|
+
// valueFilter: { textSearch: "", tabs: "" },
|
|
84
|
+
// };
|
|
85
|
+
// const { getByText } = render(<NotificationList {...props} />);
|
|
86
|
+
// const iconLoading = getByText("icon Loading");
|
|
87
|
+
// expect(iconLoading).toBeInTheDocument();
|
|
88
|
+
// });
|
|
89
|
+
// });
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
* @author dauquan1108@gmail.com on 11/27/2023.
|
|
4
4
|
*
|
|
5
5
|
**/
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/// <reference types="react" />
|
|
7
|
+
interface NotificationDetailProps {
|
|
8
|
+
onClosePopover?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const NotificationDetail: (props: NotificationDetailProps) => JSX.Element;
|
|
8
11
|
export default NotificationDetail;
|
|
@@ -10,41 +10,37 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
21
35
|
};
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
37
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
38
|
+
if (ar || !(i in from)) {
|
|
39
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
40
|
+
ar[i] = from[i];
|
|
41
|
+
}
|
|
47
42
|
}
|
|
43
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
48
44
|
};
|
|
49
45
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
46
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -56,63 +52,30 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
56
52
|
* @author dauquan1108@gmail.com on 11/27/2023.
|
|
57
53
|
*
|
|
58
54
|
**/
|
|
59
|
-
var react_1 =
|
|
55
|
+
var react_1 = __importStar(require("react"));
|
|
60
56
|
var Box_1 = __importDefault(require("@mui/material/Box"));
|
|
57
|
+
var react_i18next_1 = require("react-i18next");
|
|
58
|
+
var i18n_1 = __importDefault(require("../../../i18n"));
|
|
61
59
|
var HeaderInfo_1 = __importDefault(require("./HeaderInfo"));
|
|
60
|
+
var Constant_1 = require("../Constant");
|
|
61
|
+
var Hooks_1 = __importDefault(require("../Hooks"));
|
|
62
62
|
var NotificationList_1 = __importDefault(require("./NotificationList"));
|
|
63
|
-
var
|
|
64
|
-
var NotificationDetail = function () {
|
|
65
|
-
var
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return [2 /*return*/];
|
|
78
|
-
}
|
|
79
|
-
// Thực hiện Call API ở đoạn này và thêm 1 số ĐK nữa để xử lý trong đoạn code sau ("Chưa hoàn thành").
|
|
80
|
-
// 1: Nếu gặp lỗi, data trả về rộng tắt trạng thái loading.
|
|
81
|
-
setIsLoading(true);
|
|
82
|
-
_a.label = 1;
|
|
83
|
-
case 1:
|
|
84
|
-
_a.trys.push([1, 4, 5, 6]);
|
|
85
|
-
return [4 /*yield*/, fetch(apiUrl)];
|
|
86
|
-
case 2:
|
|
87
|
-
response = _a.sent();
|
|
88
|
-
if (!response.ok) {
|
|
89
|
-
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
90
|
-
}
|
|
91
|
-
return [4 /*yield*/, response.json()];
|
|
92
|
-
case 3:
|
|
93
|
-
data = (_a.sent()) || [];
|
|
94
|
-
setNotifications(data);
|
|
95
|
-
return [3 /*break*/, 6];
|
|
96
|
-
case 4:
|
|
97
|
-
error_1 = _a.sent();
|
|
98
|
-
console.error('Error fetching data:', error_1);
|
|
99
|
-
return [3 /*break*/, 6];
|
|
100
|
-
case 5:
|
|
101
|
-
setIsLoading(false);
|
|
102
|
-
return [7 /*endfinally*/];
|
|
103
|
-
case 6: return [2 /*return*/];
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}); };
|
|
107
|
-
var handleIntersection = react_1.default.useCallback(function (entries) {
|
|
108
|
-
var firsEntry = entries[0];
|
|
109
|
-
if (firsEntry.isIntersecting) {
|
|
110
|
-
handleCallApi('https://run.mocky.io/v3/68ae1ad5-8e13-4d00-a8ef-134215e61978');
|
|
111
|
-
}
|
|
112
|
-
}, []);
|
|
113
|
-
react_1.default.useEffect(function () {
|
|
63
|
+
var Types_1 = require("../Types");
|
|
64
|
+
var NotificationDetail = function (props) {
|
|
65
|
+
var service = (0, Hooks_1.default)().service;
|
|
66
|
+
var onClosePopover = props.onClosePopover;
|
|
67
|
+
var _a = (0, react_1.useState)({
|
|
68
|
+
textSearch: '',
|
|
69
|
+
tabs: Constant_1.Constants.ALL,
|
|
70
|
+
status: Constant_1.Constants.ALL_STATUS,
|
|
71
|
+
}), valueFilter = _a[0], setValueFilter = _a[1];
|
|
72
|
+
var _b = react_1.default.useState(false), isLoading = _b[0], setIsLoading = _b[1];
|
|
73
|
+
var _c = react_1.default.useState(-1), count = _c[0], setCount = _c[1];
|
|
74
|
+
var _d = (0, react_1.useState)([]), notificationMessage = _d[0], setNotificationMessage = _d[1];
|
|
75
|
+
var totalItemCount = (0, react_1.useRef)(0);
|
|
76
|
+
(0, react_1.useEffect)(function () {
|
|
114
77
|
var observer = new IntersectionObserver(handleIntersection);
|
|
115
|
-
var lastItem = document.getElementById(
|
|
78
|
+
var lastItem = document.getElementById('last-Item');
|
|
116
79
|
if (observer && lastItem) {
|
|
117
80
|
setIsLoading(true);
|
|
118
81
|
observer.observe(lastItem);
|
|
@@ -123,28 +86,79 @@ var NotificationDetail = function () {
|
|
|
123
86
|
}
|
|
124
87
|
};
|
|
125
88
|
}, []);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
89
|
+
(0, react_1.useEffect)(function () {
|
|
90
|
+
if (count >= 0 &&
|
|
91
|
+
(totalItemCount.current > notificationMessage.length ||
|
|
92
|
+
notificationMessage.length === 0)) {
|
|
93
|
+
setIsLoading(true);
|
|
94
|
+
service
|
|
95
|
+
.notificationsPaging(count, Constant_1.Constants.PAGE_SIZE_DEFAULT, valueFilter.textSearch, valueFilter.status, [])
|
|
96
|
+
.then(function (res) {
|
|
97
|
+
setNotificationMessage(function (prevMessages) {
|
|
98
|
+
var newItems = res.items.filter(function (newItem) {
|
|
99
|
+
return !prevMessages.some(function (prevItem) { return prevItem.id === newItem.id; });
|
|
100
|
+
});
|
|
101
|
+
return __spreadArray(__spreadArray([], prevMessages, true), newItems, true);
|
|
102
|
+
});
|
|
103
|
+
totalItemCount.current = res.totalItemCount;
|
|
104
|
+
})
|
|
105
|
+
.finally(function () {
|
|
106
|
+
setIsLoading(false);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
110
|
+
}, [count, valueFilter.textSearch, valueFilter.status]);
|
|
111
|
+
var handleIntersection = (0, react_1.useCallback)(function (entries) {
|
|
112
|
+
var firsEntry = entries[0];
|
|
113
|
+
if (firsEntry.isIntersecting) {
|
|
114
|
+
setCount(function (old) { return old + 1; });
|
|
115
|
+
}
|
|
129
116
|
}, []);
|
|
130
|
-
var
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
117
|
+
var handleValueFilter = function (textSearch, tabs) {
|
|
118
|
+
textSearch.length === 0 ? setCount(0) : setCount(-1);
|
|
119
|
+
setNotificationMessage([]);
|
|
120
|
+
totalItemCount.current = 0;
|
|
121
|
+
setValueFilter({
|
|
122
|
+
textSearch: textSearch,
|
|
123
|
+
tabs: tabs,
|
|
124
|
+
status: tabs === Constant_1.Constants.ALL
|
|
125
|
+
? Constant_1.Constants.ALL_STATUS
|
|
126
|
+
: Constant_1.Constants.UNREAD_STATUS,
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
var handleUpdateStatus = (0, react_1.useCallback)(function (dataSent) {
|
|
130
|
+
if (typeof dataSent === 'string') {
|
|
131
|
+
var isCheckStatus = notificationMessage.some(function (item) {
|
|
132
|
+
return item.status === Types_1.NotificationMessageStatus.Unread;
|
|
133
|
+
});
|
|
134
134
|
if (isCheckStatus) {
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
service.notificationsReadAll().then(function () {
|
|
136
|
+
setNotificationMessage(function (prevNotifications) {
|
|
137
|
+
return prevNotifications.map(function (item) { return (__assign(__assign({}, item), { status: Types_1.NotificationMessageStatus.Read })); });
|
|
138
|
+
});
|
|
137
139
|
});
|
|
138
140
|
}
|
|
139
141
|
}
|
|
140
142
|
else {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return
|
|
143
|
+
var handleUpdateStatusItem_1 = function () {
|
|
144
|
+
setNotificationMessage(function (prevNotifications) {
|
|
145
|
+
return prevNotifications.map(function (item) { return (__assign(__assign({}, item), { status: item.id === dataSent.id
|
|
146
|
+
? item.status ===
|
|
147
|
+
Types_1.NotificationMessageStatus.Read
|
|
148
|
+
? Types_1.NotificationMessageStatus.Unread
|
|
149
|
+
: Types_1.NotificationMessageStatus.Read
|
|
150
|
+
: item.status })); });
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
dataSent.status === Types_1.NotificationMessageStatus.Unread
|
|
154
|
+
? service.notificationsRead([dataSent.id]).then(function () {
|
|
155
|
+
handleUpdateStatusItem_1();
|
|
156
|
+
})
|
|
157
|
+
: service.notificationsUnread([dataSent.id]).then(function () {
|
|
158
|
+
handleUpdateStatusItem_1();
|
|
144
159
|
});
|
|
145
|
-
});
|
|
146
160
|
}
|
|
147
|
-
}, [
|
|
148
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
161
|
+
}, [notificationMessage, service]);
|
|
162
|
+
return ((0, jsx_runtime_1.jsxs)(react_i18next_1.I18nextProvider, { i18n: i18n_1.default, children: [(0, jsx_runtime_1.jsx)(Box_1.default, { pt: 2, pl: 2, pr: 2, pb: 1, component: "div", children: (0, jsx_runtime_1.jsx)(HeaderInfo_1.default, { valueFilter: valueFilter, onClosePopover: onClosePopover, onValueFilter: handleValueFilter, onUpdateStatus: handleUpdateStatus }) }), (0, jsx_runtime_1.jsx)(Box_1.default, { pl: 1, pr: 1, pb: 1, component: "div", children: (0, jsx_runtime_1.jsx)(NotificationList_1.default, { isLoading: isLoading, valueFilter: valueFilter, notificationMessage: notificationMessage, onUpdateStatus: handleUpdateStatus }) }), (0, jsx_runtime_1.jsx)(Box_1.default, { id: "last-Item", component: "div", sx: { height: '20px' } })] }));
|
|
149
163
|
};
|
|
150
164
|
exports.default = NotificationDetail;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @author dauquan1108@gmail.com on 12/1/2023.
|
|
46
|
+
*
|
|
47
|
+
**/
|
|
48
|
+
var react_1 = require("react");
|
|
49
|
+
var material_1 = require("@mui/material");
|
|
50
|
+
var Notifications_1 = __importDefault(require("@mui/icons-material/Notifications"));
|
|
51
|
+
var signalr_1 = require("@microsoft/signalr");
|
|
52
|
+
var Constant_1 = require("../Constant");
|
|
53
|
+
var Hooks_1 = __importDefault(require("../Hooks"));
|
|
54
|
+
var NotificationDetail_1 = __importDefault(require("../NotificationDetail"));
|
|
55
|
+
var Container = function () {
|
|
56
|
+
var service = (0, Hooks_1.default)().service;
|
|
57
|
+
var _a = (0, react_1.useState)(null), anchorEl = _a[0], setAnchorEl = _a[1];
|
|
58
|
+
var _b = (0, react_1.useState)(0), totalNotification = _b[0], setTotalNotification = _b[1];
|
|
59
|
+
var _c = (0, react_1.useState)(null), signalRConnection = _c[0], setSignalRConnection = _c[1];
|
|
60
|
+
(0, react_1.useEffect)(function () {
|
|
61
|
+
service.notificationsCountUnreadMessages().then(setTotalNotification);
|
|
62
|
+
setUpSignalRConnection().then(function (connection) { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
|
+
return __generator(this, function (_a) {
|
|
64
|
+
setSignalRConnection(connection);
|
|
65
|
+
return [2 /*return*/];
|
|
66
|
+
});
|
|
67
|
+
}); });
|
|
68
|
+
return function () {
|
|
69
|
+
if (signalRConnection)
|
|
70
|
+
signalRConnection.stop();
|
|
71
|
+
};
|
|
72
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
|
+
}, []);
|
|
74
|
+
var setUpSignalRConnection = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
|
+
var connection, err_1;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
connection = new signalr_1.HubConnectionBuilder()
|
|
80
|
+
.withUrl("".concat(Constant_1.Constants.API_ENDPOINT, "/api/hubs/notification"))
|
|
81
|
+
.configureLogging(signalr_1.LogLevel.None)
|
|
82
|
+
.withAutomaticReconnect([0, 5000, 10000, 15000])
|
|
83
|
+
.build();
|
|
84
|
+
connection.on('ReceiveMessage', function (message) {
|
|
85
|
+
setTotalNotification(function (prev) { return prev + 1; });
|
|
86
|
+
});
|
|
87
|
+
_a.label = 1;
|
|
88
|
+
case 1:
|
|
89
|
+
_a.trys.push([1, 3, , 4]);
|
|
90
|
+
return [4 /*yield*/, connection.start()];
|
|
91
|
+
case 2:
|
|
92
|
+
_a.sent();
|
|
93
|
+
return [3 /*break*/, 4];
|
|
94
|
+
case 3:
|
|
95
|
+
err_1 = _a.sent();
|
|
96
|
+
console.log(err_1);
|
|
97
|
+
return [3 /*break*/, 4];
|
|
98
|
+
case 4: return [2 /*return*/, connection];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}); };
|
|
102
|
+
var handleClick = function (event) {
|
|
103
|
+
var href = window.location.href;
|
|
104
|
+
// nếu đang ở notifications thì click vào quả chuông sẽ không mở popover nữa.
|
|
105
|
+
if (!href.includes(Constant_1.Constants.NOTIFICATIONS_PATH)) {
|
|
106
|
+
setTotalNotification(0);
|
|
107
|
+
setAnchorEl(event.currentTarget);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
var handleClose = function () {
|
|
111
|
+
setAnchorEl(null);
|
|
112
|
+
};
|
|
113
|
+
var open = Boolean(anchorEl);
|
|
114
|
+
var id = open ? 'simple-popover' : undefined;
|
|
115
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { component: "div", children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-describedby": id, onClick: handleClick, sx: { backgroundColor: open ? '#F98D9C' : 'inherit' }, children: (0, jsx_runtime_1.jsx)(material_1.Badge, { badgeContent: totalNotification, color: "error", children: (0, jsx_runtime_1.jsx)(Notifications_1.default, { "data-testid": "notification-icon", sx: { color: open ? '#DD040C' : 'inherit' } }) }) }), (0, jsx_runtime_1.jsx)(material_1.Popover, { id: id, open: open, anchorEl: anchorEl, onClose: handleClose, sx: { zIndex: 1100 }, anchorOrigin: {
|
|
116
|
+
vertical: 'bottom',
|
|
117
|
+
horizontal: 'center',
|
|
118
|
+
}, transformOrigin: {
|
|
119
|
+
vertical: 'top',
|
|
120
|
+
horizontal: 'center',
|
|
121
|
+
}, PaperProps: {
|
|
122
|
+
style: {
|
|
123
|
+
borderRadius: '8px',
|
|
124
|
+
},
|
|
125
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.Box, { "data-testid": "popover", component: "div", sx: [
|
|
126
|
+
{
|
|
127
|
+
width: '400px',
|
|
128
|
+
overflowY: 'auto',
|
|
129
|
+
maxHeight: 'calc(90vh - 8px)',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
'&::-webkit-scrollbar': {
|
|
133
|
+
width: '10px',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
'&::-webkit-scrollbar-track': {
|
|
138
|
+
backgroundColor: '#f1f1f1',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
'&::-webkit-scrollbar-thumb': {
|
|
143
|
+
borderRadius: '4px',
|
|
144
|
+
backgroundColor: '#c1c1c1',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
], children: (0, jsx_runtime_1.jsx)(NotificationDetail_1.default, { onClosePopover: handleClose }) }) })] }));
|
|
148
|
+
};
|
|
149
|
+
exports.default = Container;
|
|
@@ -7,11 +7,11 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
require("@testing-library/jest-dom");
|
|
8
8
|
var react_1 = require("@testing-library/react");
|
|
9
9
|
// Component
|
|
10
|
-
var
|
|
11
|
-
describe(
|
|
12
|
-
it(
|
|
13
|
-
var getByTestId = (0, react_1.render)((0, jsx_runtime_1.jsx)(
|
|
14
|
-
var notificationsIcon = getByTestId(
|
|
10
|
+
var Container_1 = __importDefault(require("./Container"));
|
|
11
|
+
describe('NotificationPopover', function () {
|
|
12
|
+
it('renders the component', function () {
|
|
13
|
+
var getByTestId = (0, react_1.render)((0, jsx_runtime_1.jsx)(Container_1.default, {})).getByTestId;
|
|
14
|
+
var notificationsIcon = getByTestId('notification-icon');
|
|
15
15
|
expect(notificationsIcon).toBeInTheDocument();
|
|
16
16
|
});
|
|
17
17
|
// it("Mở dao diện 'NotificationPopover' khi click vào quả chuông.", async () => {
|