@plusscommunities/pluss-core-aws 2.0.8 → 2.1.2-beta.0
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/notification/prepNotification.js +119 -149
- package/package.json +1 -1
|
@@ -3,155 +3,125 @@ const { getConfig } = require("../config");
|
|
|
3
3
|
|
|
4
4
|
module.exports = (noti) => {
|
|
5
5
|
const thisNoti = { ...noti };
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
thisNoti.Icon = "file-o";
|
|
126
|
-
break;
|
|
127
|
-
case "AppointmentAdded":
|
|
128
|
-
thisNoti.Text = noti.Data.message;
|
|
129
|
-
thisNoti.Icon = "calendar-plus-o";
|
|
130
|
-
break;
|
|
131
|
-
case "AppointmentUpdated":
|
|
132
|
-
thisNoti.Text = noti.Data.message;
|
|
133
|
-
thisNoti.Icon = "calendar-check-o";
|
|
134
|
-
break;
|
|
135
|
-
case "AppointmentCancelled":
|
|
136
|
-
thisNoti.Text = noti.Data.message;
|
|
137
|
-
thisNoti.Icon = "calendar-times-o";
|
|
138
|
-
break;
|
|
139
|
-
case "AppointmentReminder":
|
|
140
|
-
thisNoti.Text = noti.Data.message;
|
|
141
|
-
thisNoti.Icon = "bell-o";
|
|
142
|
-
break;
|
|
143
|
-
case "AppointmentFollowup":
|
|
144
|
-
thisNoti.Text = noti.Data.message;
|
|
145
|
-
thisNoti.Icon = "calendar-check-o";
|
|
146
|
-
break;
|
|
147
|
-
case "ScheduledAction":
|
|
148
|
-
thisNoti.Text = noti.Data.message;
|
|
149
|
-
thisNoti.Icon = "bell-o";
|
|
150
|
-
break;
|
|
151
|
-
default:
|
|
152
|
-
thisNoti.Text = "You have received a notification";
|
|
153
|
-
thisNoti.Icon = "bell-o";
|
|
154
|
-
break;
|
|
6
|
+
const type = noti.Type ?? "";
|
|
7
|
+
if (type.startsWith('"MaintenanceJobStatusChanged"')) {
|
|
8
|
+
thisNoti.Text = `Your request is ${noti.Data.status}`;
|
|
9
|
+
thisNoti.Subtext = noti.Data.title || noti.Data.description;
|
|
10
|
+
thisNoti.Icon = "wrench";
|
|
11
|
+
} else if (type.startsWith('"MaintenanceJobAssigned"')) {
|
|
12
|
+
thisNoti.Text = `You have been assigned a request`;
|
|
13
|
+
thisNoti.Subtext = noti.Data.title || noti.Data.description;
|
|
14
|
+
thisNoti.Icon = "wrench";
|
|
15
|
+
} else if (type.startsWith('"MaintenanceJobUnassigned"')) {
|
|
16
|
+
thisNoti.Text = `A request you were assigned has been reassigned`;
|
|
17
|
+
thisNoti.Subtext = noti.Data.title || noti.Data.description;
|
|
18
|
+
thisNoti.Icon = "wrench";
|
|
19
|
+
} else if (type.startsWith('"MaintenanceJobCommented"')) {
|
|
20
|
+
thisNoti.Text = noti.Data.comment;
|
|
21
|
+
thisNoti.Subtext = noti.Data.title || noti.Data.description;
|
|
22
|
+
thisNoti.Icon = "wrench";
|
|
23
|
+
} else if (type.startsWith('"EntityCommented"')) {
|
|
24
|
+
thisNoti.Text = noti.Data.comment;
|
|
25
|
+
thisNoti.Subtext = noti.Data.title || noti.Data.description;
|
|
26
|
+
thisNoti.Icon = "commenting";
|
|
27
|
+
} else if (type.startsWith('"EventRepChange"')) {
|
|
28
|
+
let eventChangeText = "";
|
|
29
|
+
if (noti.Data.LocationChanged && noti.Data.TimeChanged) {
|
|
30
|
+
eventChangeText = "time and location";
|
|
31
|
+
} else if (noti.Data.LocationChanged) {
|
|
32
|
+
eventChangeText = "location";
|
|
33
|
+
} else if (noti.Data.TimeChanged) {
|
|
34
|
+
eventChangeText = "time";
|
|
35
|
+
}
|
|
36
|
+
thisNoti.Text = `An event you are attending has changed ${eventChangeText}`;
|
|
37
|
+
thisNoti.Subtext = noti.Data.Title;
|
|
38
|
+
thisNoti.Icon = "calendar";
|
|
39
|
+
} else if (type.startsWith('"EventRepRemoved"')) {
|
|
40
|
+
thisNoti.Text = "An event you are attending has been cancelled";
|
|
41
|
+
thisNoti.Subtext = noti.Data.Title;
|
|
42
|
+
thisNoti.TimeText = noti.Data.Time;
|
|
43
|
+
thisNoti.Icon = "calendar-times-o";
|
|
44
|
+
} else if (type.startsWith('"ApproveNewsSubmission"')) {
|
|
45
|
+
thisNoti.Text = "A story you submitted has been approved";
|
|
46
|
+
thisNoti.Subtext = noti.Data.Title;
|
|
47
|
+
thisNoti.Icon = "newspaper-o";
|
|
48
|
+
} else if (type.startsWith('"ApproveEventSubmission"')) {
|
|
49
|
+
thisNoti.Text = "An event you submitted has been approved";
|
|
50
|
+
thisNoti.Subtext = noti.Data.Title;
|
|
51
|
+
thisNoti.Icon = "calendar-check-o";
|
|
52
|
+
} else if (type.startsWith('"EventRegisterFromWaitlist"')) {
|
|
53
|
+
thisNoti.Text =
|
|
54
|
+
"A spot has opened up on an event you were on the waitlist for";
|
|
55
|
+
thisNoti.Subtext = noti.Data.Title;
|
|
56
|
+
thisNoti.Icon = "calendar-plus-o";
|
|
57
|
+
} else if (type.startsWith('"NewsletterPublished"')) {
|
|
58
|
+
thisNoti.Text = `News: ${noti.Data.Title}`;
|
|
59
|
+
thisNoti.Subtext =
|
|
60
|
+
!_.isEmpty(noti.Data.Text) && noti.Data.Text.length > 100
|
|
61
|
+
? `${noti.Data.Text.substring(0, 100)}...`
|
|
62
|
+
: noti.Data.Text;
|
|
63
|
+
thisNoti.Icon = "newspaper-o";
|
|
64
|
+
} else if (type.startsWith('"FormLockoutFailure"')) {
|
|
65
|
+
thisNoti.Text =
|
|
66
|
+
"Someone answered yes to a question on the kiosk and was denied access";
|
|
67
|
+
thisNoti.Icon = "exclamation-triangle";
|
|
68
|
+
} else if (type.startsWith('"FormLockoutSuccess"')) {
|
|
69
|
+
thisNoti.Text =
|
|
70
|
+
"Someone answered no to all questions on the kiosk and was granted access";
|
|
71
|
+
thisNoti.Icon = "check";
|
|
72
|
+
} else if (type.startsWith('"InformationAdded"')) {
|
|
73
|
+
thisNoti.Text = `There is new important information available: ${noti.Data.title}`;
|
|
74
|
+
thisNoti.Icon = "info";
|
|
75
|
+
} else if (type.startsWith('"InformationUpdated"')) {
|
|
76
|
+
thisNoti.Text = `Important information updated: ${noti.Data.title}`;
|
|
77
|
+
thisNoti.Icon = "info";
|
|
78
|
+
} else if (type.startsWith('"PollAdded"')) {
|
|
79
|
+
thisNoti.Text = `There is a new survey available: ${noti.Data.Title}`;
|
|
80
|
+
thisNoti.Icon = "pie-chart";
|
|
81
|
+
} else if (type.startsWith('"OfferAdded"')) {
|
|
82
|
+
thisNoti.Text = `There is a new offer available: ${noti.Data.Title}`;
|
|
83
|
+
thisNoti.Icon = "shopping-bag";
|
|
84
|
+
} else if (type.startsWith('"ServiceAdded"')) {
|
|
85
|
+
thisNoti.Text = `There is a new service available: ${noti.Data.Title}`;
|
|
86
|
+
thisNoti.Icon = "stethoscope";
|
|
87
|
+
} else if (type.startsWith('"EventAdded"')) {
|
|
88
|
+
thisNoti.Text = `There is a new event: ${noti.Data.Title}`;
|
|
89
|
+
thisNoti.Icon = "calendar-plus-o";
|
|
90
|
+
} else if (type.startsWith('"FacilityAdded"')) {
|
|
91
|
+
thisNoti.Text = `There is a new ${getConfig().strings.FACILITY}: ${
|
|
92
|
+
noti.Data.Title
|
|
93
|
+
}`;
|
|
94
|
+
thisNoti.Icon = "building";
|
|
95
|
+
} else if (type.startsWith('"MapAdded"')) {
|
|
96
|
+
thisNoti.Text = `There is a new map: ${noti.Data.title}`;
|
|
97
|
+
thisNoti.Icon = "map-marker";
|
|
98
|
+
} else if (type.startsWith('"ImportantContactAdded"')) {
|
|
99
|
+
thisNoti.Text = `There is a new contact: ${noti.Data.title}`;
|
|
100
|
+
thisNoti.Icon = "address-card-o";
|
|
101
|
+
} else if (type.startsWith('"PersonalDocumentAdded"')) {
|
|
102
|
+
thisNoti.Text = `There is a new document: ${noti.Data.Name}`;
|
|
103
|
+
thisNoti.Icon = "file-o";
|
|
104
|
+
} else if (type.startsWith('"AppointmentAdded"')) {
|
|
105
|
+
thisNoti.Text = noti.Data.message;
|
|
106
|
+
thisNoti.Icon = "calendar-plus-o";
|
|
107
|
+
} else if (type.startsWith('"AppointmentUpdated"')) {
|
|
108
|
+
thisNoti.Text = noti.Data.message;
|
|
109
|
+
thisNoti.Icon = "calendar-check-o";
|
|
110
|
+
} else if (type.startsWith('"AppointmentCancelled"')) {
|
|
111
|
+
thisNoti.Text = noti.Data.message;
|
|
112
|
+
thisNoti.Icon = "calendar-times-o";
|
|
113
|
+
} else if (type.startsWith('"AppointmentReminder"')) {
|
|
114
|
+
thisNoti.Text = noti.Data.message;
|
|
115
|
+
thisNoti.Icon = "bell-o";
|
|
116
|
+
} else if (type.startsWith('"AppointmentFollowup"')) {
|
|
117
|
+
thisNoti.Text = noti.Data.message;
|
|
118
|
+
thisNoti.Icon = "calendar-check-o";
|
|
119
|
+
} else if (type.startsWith('"ScheduledAction"')) {
|
|
120
|
+
thisNoti.Text = noti.Data.message;
|
|
121
|
+
thisNoti.Icon = "bell-o";
|
|
122
|
+
} else {
|
|
123
|
+
thisNoti.Text = "You have received a notification";
|
|
124
|
+
thisNoti.Icon = "bell-o";
|
|
155
125
|
}
|
|
156
126
|
return thisNoti;
|
|
157
127
|
};
|
package/package.json
CHANGED