@tenancy.nz/reports 1.1.5 → 1.1.7
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.
|
@@ -5,53 +5,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var ui = require('@tenancy.nz/ui');
|
|
7
7
|
var featureUi = require('@tenancy.nz/feature-ui');
|
|
8
|
+
var ReportFooter = require('./ReportFooter.cjs');
|
|
9
|
+
var ReportHeader = require('./ReportHeader.cjs');
|
|
8
10
|
|
|
11
|
+
var propertyRent = function propertyRent(property) {
|
|
12
|
+
if (!property) {
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
var rentAmount = String(property.rent_amount).replace(".00", "");
|
|
16
|
+
var rentFrequency = String(property.rental_period).charAt(0).toLowerCase();
|
|
17
|
+
return !Number.isNaN(Number.parseInt(rentAmount, 10)) ? "$".concat(rentAmount, "/").concat(rentFrequency) : "";
|
|
18
|
+
};
|
|
9
19
|
function ViewingAnalyticsReport(_ref) {
|
|
10
20
|
var eventData = _ref.eventData;
|
|
11
21
|
var stats = eventData.stats || {};
|
|
12
22
|
var properties = eventData.properties || [];
|
|
13
23
|
return /* @__PURE__ */React.createElement(ui.ThemeProvider, null, /* @__PURE__ */React.createElement(ui.Box, {
|
|
14
|
-
|
|
15
|
-
}, /* @__PURE__ */React.createElement(
|
|
16
|
-
mb: 6,
|
|
17
|
-
display: "flex",
|
|
18
|
-
justify: "space-between",
|
|
19
|
-
align: "start"
|
|
20
|
-
}, /* @__PURE__ */React.createElement(ui.Box, null, /* @__PURE__ */React.createElement(ui.Heading, {
|
|
21
|
-
variant: "h1",
|
|
22
|
-
as: "h1",
|
|
23
|
-
gutterBottom: false
|
|
24
|
-
}, "Analytics Report")), /* @__PURE__ */React.createElement(ui.Box, {
|
|
25
|
-
display: "flex",
|
|
26
|
-
align: "flex-end",
|
|
27
|
-
direction: "column"
|
|
28
|
-
}, /* @__PURE__ */React.createElement(ui.Text, {
|
|
29
|
-
mt: 2
|
|
30
|
-
}, eventData.fromDate && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(ui.Text, {
|
|
31
|
-
weight: "700",
|
|
32
|
-
as: "span",
|
|
33
|
-
display: "inline"
|
|
34
|
-
}, "Report Range From"), " ", eventData.fromDate, " "), eventData.toDate && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(ui.Text, {
|
|
35
|
-
weight: "700",
|
|
36
|
-
as: "span",
|
|
37
|
-
display: "inline"
|
|
38
|
-
}, "To"), " ", eventData.toDate)), eventData.viewingAgent && /* @__PURE__ */React.createElement(ui.Text, {
|
|
39
|
-
color: "textPrimary",
|
|
40
|
-
weight: "700",
|
|
41
|
-
fontSize: 12
|
|
42
|
-
}, "Viewing agent:", " ", /* @__PURE__ */React.createElement(ui.Text, {
|
|
43
|
-
weight: "400",
|
|
44
|
-
as: "span",
|
|
45
|
-
display: "inline"
|
|
46
|
-
}, eventData.viewingAgent)), eventData.propertyAgent && /* @__PURE__ */React.createElement(ui.Text, {
|
|
47
|
-
color: "textPrimary",
|
|
48
|
-
weight: "700",
|
|
49
|
-
fontSize: 12
|
|
50
|
-
}, "Property agent:", " ", /* @__PURE__ */React.createElement(ui.Text, {
|
|
51
|
-
weight: "400",
|
|
52
|
-
as: "span",
|
|
53
|
-
display: "inline"
|
|
54
|
-
}, eventData.propertyAgent)))), /* @__PURE__ */React.createElement(featureUi.AnalyticsSection, {
|
|
24
|
+
width: "100%"
|
|
25
|
+
}, /* @__PURE__ */React.createElement(featureUi.AnalyticsSection, {
|
|
55
26
|
viewingsCount: stats.viewings_count,
|
|
56
27
|
bookingsCount: stats.bookings_count,
|
|
57
28
|
attendeesCount: stats.viewing_attendees_count,
|
|
@@ -65,13 +36,16 @@ function ViewingAnalyticsReport(_ref) {
|
|
|
65
36
|
agreementsCount: stats.agreements_count,
|
|
66
37
|
agreementsFinalisedCount: stats.agreements_finalised_count,
|
|
67
38
|
filterDaysCount: eventData.filterDaysCount
|
|
68
|
-
}), /* @__PURE__ */React.createElement(ui.Box,
|
|
69
|
-
|
|
39
|
+
}), /* @__PURE__ */React.createElement(ui.Box, {
|
|
40
|
+
sx: {
|
|
41
|
+
mt: "28px"
|
|
42
|
+
}
|
|
43
|
+
}, /* @__PURE__ */React.createElement(ui.Heading, {
|
|
70
44
|
as: "h4",
|
|
71
|
-
|
|
72
|
-
|
|
45
|
+
sx: {
|
|
46
|
+
mb: "16px"
|
|
47
|
+
}
|
|
73
48
|
}, "Top 5 properties"), /* @__PURE__ */React.createElement(featureUi.GridList, {
|
|
74
|
-
mt: "20px",
|
|
75
49
|
items: properties,
|
|
76
50
|
spacing: 5,
|
|
77
51
|
emptyComponent: /* @__PURE__ */React.createElement(ui.Text, null, "No results to show"),
|
|
@@ -80,19 +54,20 @@ function ViewingAnalyticsReport(_ref) {
|
|
|
80
54
|
item: true,
|
|
81
55
|
xs: 12
|
|
82
56
|
}, /* @__PURE__ */React.createElement(featureUi.PropertyCard, {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
daysOnMarket: "",
|
|
86
|
-
weeklyRent: property.rent_amount,
|
|
57
|
+
address: property.short_address,
|
|
58
|
+
rent: propertyRent(property),
|
|
87
59
|
viewingsCount: property.viewings_count,
|
|
88
60
|
enquiriesCount: property.enquiries_count,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
61
|
+
imgSrc: property.thumb_url,
|
|
62
|
+
noOfBedrooms: property.num_bedrooms,
|
|
63
|
+
noOfBathrooms: property.num_bathrooms,
|
|
64
|
+
noOfCarparks: property.num_cars,
|
|
65
|
+
outlined: true
|
|
93
66
|
}));
|
|
94
67
|
}
|
|
95
68
|
}))));
|
|
96
69
|
}
|
|
70
|
+
ViewingAnalyticsReport.Footer = ReportFooter.default;
|
|
71
|
+
ViewingAnalyticsReport.Header = ReportHeader.default;
|
|
97
72
|
|
|
98
73
|
exports.default = ViewingAnalyticsReport;
|
package/dist/esm/ReportFooter.js
CHANGED
|
@@ -1,53 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ThemeProvider, Box, Heading,
|
|
2
|
+
import { ThemeProvider, Box, Heading, Grid, Text } from '@tenancy.nz/ui';
|
|
3
3
|
import { AnalyticsSection, GridList, PropertyCard } from '@tenancy.nz/feature-ui';
|
|
4
|
+
import ReportFooter from './ReportFooter.js';
|
|
5
|
+
import ReportHeader from './ReportHeader.js';
|
|
4
6
|
|
|
7
|
+
var propertyRent = function propertyRent(property) {
|
|
8
|
+
if (!property) {
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
var rentAmount = String(property.rent_amount).replace(".00", "");
|
|
12
|
+
var rentFrequency = String(property.rental_period).charAt(0).toLowerCase();
|
|
13
|
+
return !Number.isNaN(Number.parseInt(rentAmount, 10)) ? "$".concat(rentAmount, "/").concat(rentFrequency) : "";
|
|
14
|
+
};
|
|
5
15
|
function ViewingAnalyticsReport(_ref) {
|
|
6
16
|
var eventData = _ref.eventData;
|
|
7
17
|
var stats = eventData.stats || {};
|
|
8
18
|
var properties = eventData.properties || [];
|
|
9
19
|
return /* @__PURE__ */React.createElement(ThemeProvider, null, /* @__PURE__ */React.createElement(Box, {
|
|
10
|
-
|
|
11
|
-
}, /* @__PURE__ */React.createElement(
|
|
12
|
-
mb: 6,
|
|
13
|
-
display: "flex",
|
|
14
|
-
justify: "space-between",
|
|
15
|
-
align: "start"
|
|
16
|
-
}, /* @__PURE__ */React.createElement(Box, null, /* @__PURE__ */React.createElement(Heading, {
|
|
17
|
-
variant: "h1",
|
|
18
|
-
as: "h1",
|
|
19
|
-
gutterBottom: false
|
|
20
|
-
}, "Analytics Report")), /* @__PURE__ */React.createElement(Box, {
|
|
21
|
-
display: "flex",
|
|
22
|
-
align: "flex-end",
|
|
23
|
-
direction: "column"
|
|
24
|
-
}, /* @__PURE__ */React.createElement(Text, {
|
|
25
|
-
mt: 2
|
|
26
|
-
}, eventData.fromDate && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(Text, {
|
|
27
|
-
weight: "700",
|
|
28
|
-
as: "span",
|
|
29
|
-
display: "inline"
|
|
30
|
-
}, "Report Range From"), " ", eventData.fromDate, " "), eventData.toDate && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(Text, {
|
|
31
|
-
weight: "700",
|
|
32
|
-
as: "span",
|
|
33
|
-
display: "inline"
|
|
34
|
-
}, "To"), " ", eventData.toDate)), eventData.viewingAgent && /* @__PURE__ */React.createElement(Text, {
|
|
35
|
-
color: "textPrimary",
|
|
36
|
-
weight: "700",
|
|
37
|
-
fontSize: 12
|
|
38
|
-
}, "Viewing agent:", " ", /* @__PURE__ */React.createElement(Text, {
|
|
39
|
-
weight: "400",
|
|
40
|
-
as: "span",
|
|
41
|
-
display: "inline"
|
|
42
|
-
}, eventData.viewingAgent)), eventData.propertyAgent && /* @__PURE__ */React.createElement(Text, {
|
|
43
|
-
color: "textPrimary",
|
|
44
|
-
weight: "700",
|
|
45
|
-
fontSize: 12
|
|
46
|
-
}, "Property agent:", " ", /* @__PURE__ */React.createElement(Text, {
|
|
47
|
-
weight: "400",
|
|
48
|
-
as: "span",
|
|
49
|
-
display: "inline"
|
|
50
|
-
}, eventData.propertyAgent)))), /* @__PURE__ */React.createElement(AnalyticsSection, {
|
|
20
|
+
width: "100%"
|
|
21
|
+
}, /* @__PURE__ */React.createElement(AnalyticsSection, {
|
|
51
22
|
viewingsCount: stats.viewings_count,
|
|
52
23
|
bookingsCount: stats.bookings_count,
|
|
53
24
|
attendeesCount: stats.viewing_attendees_count,
|
|
@@ -61,13 +32,16 @@ function ViewingAnalyticsReport(_ref) {
|
|
|
61
32
|
agreementsCount: stats.agreements_count,
|
|
62
33
|
agreementsFinalisedCount: stats.agreements_finalised_count,
|
|
63
34
|
filterDaysCount: eventData.filterDaysCount
|
|
64
|
-
}), /* @__PURE__ */React.createElement(Box,
|
|
65
|
-
|
|
35
|
+
}), /* @__PURE__ */React.createElement(Box, {
|
|
36
|
+
sx: {
|
|
37
|
+
mt: "28px"
|
|
38
|
+
}
|
|
39
|
+
}, /* @__PURE__ */React.createElement(Heading, {
|
|
66
40
|
as: "h4",
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
sx: {
|
|
42
|
+
mb: "16px"
|
|
43
|
+
}
|
|
69
44
|
}, "Top 5 properties"), /* @__PURE__ */React.createElement(GridList, {
|
|
70
|
-
mt: "20px",
|
|
71
45
|
items: properties,
|
|
72
46
|
spacing: 5,
|
|
73
47
|
emptyComponent: /* @__PURE__ */React.createElement(Text, null, "No results to show"),
|
|
@@ -76,19 +50,20 @@ function ViewingAnalyticsReport(_ref) {
|
|
|
76
50
|
item: true,
|
|
77
51
|
xs: 12
|
|
78
52
|
}, /* @__PURE__ */React.createElement(PropertyCard, {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
daysOnMarket: "",
|
|
82
|
-
weeklyRent: property.rent_amount,
|
|
53
|
+
address: property.short_address,
|
|
54
|
+
rent: propertyRent(property),
|
|
83
55
|
viewingsCount: property.viewings_count,
|
|
84
56
|
enquiriesCount: property.enquiries_count,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
57
|
+
imgSrc: property.thumb_url,
|
|
58
|
+
noOfBedrooms: property.num_bedrooms,
|
|
59
|
+
noOfBathrooms: property.num_bathrooms,
|
|
60
|
+
noOfCarparks: property.num_cars,
|
|
61
|
+
outlined: true
|
|
89
62
|
}));
|
|
90
63
|
}
|
|
91
64
|
}))));
|
|
92
65
|
}
|
|
66
|
+
ViewingAnalyticsReport.Footer = ReportFooter;
|
|
67
|
+
ViewingAnalyticsReport.Header = ReportHeader;
|
|
93
68
|
|
|
94
69
|
export { ViewingAnalyticsReport as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenancy.nz/reports",
|
|
3
3
|
"description": "React UI reporting components.",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.7",
|
|
5
5
|
"author": "TPS <https://www.tenancy.co.nz>",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"type": "module",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
16
16
|
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
17
|
-
"@tenancy.nz/ui": "1.1.
|
|
18
|
-
"@tenancy.nz/
|
|
17
|
+
"@tenancy.nz/feature-ui": "1.1.7",
|
|
18
|
+
"@tenancy.nz/ui": "1.1.7"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@tenancy.nz/feature-ui": "1.1.
|
|
22
|
-
"@tenancy.nz/ui": "1.1.
|
|
21
|
+
"@tenancy.nz/feature-ui": "1.1.7",
|
|
22
|
+
"@tenancy.nz/ui": "1.1.7"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"react-uid": "^2.4.0"
|