@plusscommunities/pluss-core-aws 2.0.17-beta.0 → 2.0.18

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.
@@ -0,0 +1,25 @@
1
+ const moment = require("moment-timezone");
2
+
3
+ module.exports = (dateString, timeOfDay, timezone, resultFormat = "value") => {
4
+ // Parse the date string into a moment object in the given timezone
5
+ const dateMoment = moment.tz(dateString, "DD-MM-YYYY", timezone);
6
+
7
+ // Calculate the hours and minutes from the timeOfDay in minutes
8
+ const hours = Math.floor(timeOfDay / 60);
9
+ const minutes = timeOfDay % 60;
10
+
11
+ // Set the hours and minutes to the dateMoment
12
+ dateMoment.hours(hours).minutes(minutes).seconds(0).milliseconds(0);
13
+
14
+ switch (resultFormat) {
15
+ case "string":
16
+ // return the timestamp in string format
17
+ return dateMoment.format();
18
+ case "value":
19
+ // Return the timestamp in milliseconds
20
+ return dateMoment.valueOf();
21
+ default:
22
+ // return the timestamp in a formatted string
23
+ return dateMoment.format(resultFormat);
24
+ }
25
+ };
@@ -0,0 +1,17 @@
1
+ const _ = require("lodash");
2
+ const { getRowId } = require("../");
3
+ const getRef = require("../../db/common/getRef");
4
+
5
+ module.exports = async (site) => {
6
+ if (site) {
7
+ const timezone = await getRef(
8
+ "strings",
9
+ "RowId",
10
+ getRowId(site, "timezone")
11
+ );
12
+ if (timezone && !_.isEmpty(timezone.Value)) {
13
+ return timezone.Value;
14
+ }
15
+ }
16
+ return "Australia/Brisbane";
17
+ };
@@ -8,18 +8,33 @@ module.exports = (noti) => {
8
8
  thisNoti.Text = `Your request is ${noti.Data.status}`;
9
9
  thisNoti.Subtext = noti.Data.title || noti.Data.description;
10
10
  thisNoti.Icon = "wrench";
11
+ if (type.indexOf("Forms") > -1) {
12
+ thisNoti.Icon = "file-text-o";
13
+ thisNoti.Text = `Your form is ${noti.Data.status}`;
14
+ }
11
15
  } else if (type.startsWith("MaintenanceJobAssigned")) {
12
16
  thisNoti.Text = `You have been assigned a request`;
13
17
  thisNoti.Subtext = noti.Data.title || noti.Data.description;
14
18
  thisNoti.Icon = "wrench";
19
+ if (type.indexOf("Forms") > -1) {
20
+ thisNoti.Icon = "file-text-o";
21
+ thisNoti.Text = `You have been assigned a form`;
22
+ }
15
23
  } else if (type.startsWith("MaintenanceJobUnassigned")) {
16
24
  thisNoti.Text = `A request you were assigned has been reassigned`;
17
25
  thisNoti.Subtext = noti.Data.title || noti.Data.description;
18
26
  thisNoti.Icon = "wrench";
27
+ if (type.indexOf("Forms") > -1) {
28
+ thisNoti.Icon = "file-text-o";
29
+ thisNoti.Text = `A form you were assigned has been reassigned`;
30
+ }
19
31
  } else if (type.startsWith("MaintenanceJobCommented")) {
20
32
  thisNoti.Text = noti.Data.comment;
21
33
  thisNoti.Subtext = noti.Data.title || noti.Data.description;
22
34
  thisNoti.Icon = "wrench";
35
+ if (type.indexOf("Forms") > -1) {
36
+ thisNoti.Icon = "file-text-o";
37
+ }
23
38
  } else if (type.startsWith("EntityCommented")) {
24
39
  thisNoti.Text = noti.Data.comment;
25
40
  thisNoti.Subtext = noti.Data.title || noti.Data.description;
@@ -120,9 +135,12 @@ module.exports = (noti) => {
120
135
  thisNoti.Text = noti.Data.message;
121
136
  thisNoti.Icon = "bell-o";
122
137
  } else if (type.startsWith("FeedPostApproved")) {
123
- thisNoti.Text = `You have a new post`;
138
+ thisNoti.Text = `You have a new post for ${noti.Data.user.displayName}`;
124
139
  thisNoti.Subtext = noti.Data.title;
125
- thisNoti.Icon = "commenting";
140
+ thisNoti.Icon = "bars";
141
+ } else if (type.startsWith("FeedPostToday")) {
142
+ thisNoti.Text = `Review today's posts for ${noti.Data.displayName}`;
143
+ thisNoti.Icon = "bars";
126
144
  } else {
127
145
  thisNoti.Text = "You have received a notification";
128
146
  thisNoti.Icon = "bell-o";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-core-aws",
3
- "version": "2.0.17-beta.0",
3
+ "version": "2.0.18",
4
4
  "description": "Core extension package for Pluss Communities platform",
5
5
  "scripts": {
6
6
  "betapatch": "npm version prepatch --preid=beta",
@@ -22,6 +22,7 @@
22
22
  "https": "^1.0.0",
23
23
  "lodash": "^4.17.10",
24
24
  "moment": "^2.30.1",
25
+ "moment-timezone": "^0.5.41",
25
26
  "node-fetch": "^2.2.0",
26
27
  "node-jose": "^1.0.0",
27
28
  "nodemailer": "^6.9.12",