@tenancy.nz/reports 1.1.5 → 1.1.6
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,23 +5,27 @@ 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
|
-
return /* @__PURE__ */React.createElement(ui.ThemeProvider, null, /* @__PURE__ */React.createElement(ui.Box, {
|
|
14
|
-
padding: "20px"
|
|
15
|
-
}, /* @__PURE__ */React.createElement(ui.Box, {
|
|
23
|
+
return /* @__PURE__ */React.createElement(ui.ThemeProvider, null, /* @__PURE__ */React.createElement(ui.Box, null, /* @__PURE__ */React.createElement(ui.Box, {
|
|
16
24
|
mb: 6,
|
|
17
25
|
display: "flex",
|
|
18
26
|
justify: "space-between",
|
|
19
27
|
align: "start"
|
|
20
|
-
}, /* @__PURE__ */React.createElement(ui.Box,
|
|
21
|
-
variant: "h1",
|
|
22
|
-
as: "h1",
|
|
23
|
-
gutterBottom: false
|
|
24
|
-
}, "Analytics Report")), /* @__PURE__ */React.createElement(ui.Box, {
|
|
28
|
+
}, /* @__PURE__ */React.createElement(ui.Box, {
|
|
25
29
|
display: "flex",
|
|
26
30
|
align: "flex-end",
|
|
27
31
|
direction: "column"
|
|
@@ -65,13 +69,16 @@ function ViewingAnalyticsReport(_ref) {
|
|
|
65
69
|
agreementsCount: stats.agreements_count,
|
|
66
70
|
agreementsFinalisedCount: stats.agreements_finalised_count,
|
|
67
71
|
filterDaysCount: eventData.filterDaysCount
|
|
68
|
-
}), /* @__PURE__ */React.createElement(ui.Box,
|
|
69
|
-
|
|
72
|
+
}), /* @__PURE__ */React.createElement(ui.Box, {
|
|
73
|
+
sx: {
|
|
74
|
+
mt: "28px"
|
|
75
|
+
}
|
|
76
|
+
}, /* @__PURE__ */React.createElement(ui.Heading, {
|
|
70
77
|
as: "h4",
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
sx: {
|
|
79
|
+
mb: "16px"
|
|
80
|
+
}
|
|
73
81
|
}, "Top 5 properties"), /* @__PURE__ */React.createElement(featureUi.GridList, {
|
|
74
|
-
mt: "20px",
|
|
75
82
|
items: properties,
|
|
76
83
|
spacing: 5,
|
|
77
84
|
emptyComponent: /* @__PURE__ */React.createElement(ui.Text, null, "No results to show"),
|
|
@@ -80,19 +87,20 @@ function ViewingAnalyticsReport(_ref) {
|
|
|
80
87
|
item: true,
|
|
81
88
|
xs: 12
|
|
82
89
|
}, /* @__PURE__ */React.createElement(featureUi.PropertyCard, {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
daysOnMarket: "",
|
|
86
|
-
weeklyRent: property.rent_amount,
|
|
90
|
+
address: property.short_address,
|
|
91
|
+
rent: propertyRent(property),
|
|
87
92
|
viewingsCount: property.viewings_count,
|
|
88
93
|
enquiriesCount: property.enquiries_count,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
imgSrc: property.thumb_url,
|
|
95
|
+
noOfBedrooms: property.num_bedrooms,
|
|
96
|
+
noOfBathrooms: property.num_bathrooms,
|
|
97
|
+
noOfCarparks: property.num_cars,
|
|
98
|
+
outlined: true
|
|
93
99
|
}));
|
|
94
100
|
}
|
|
95
101
|
}))));
|
|
96
102
|
}
|
|
103
|
+
ViewingAnalyticsReport.Footer = ReportFooter.default;
|
|
104
|
+
ViewingAnalyticsReport.Header = ReportHeader.default;
|
|
97
105
|
|
|
98
106
|
exports.default = ViewingAnalyticsReport;
|
package/dist/esm/ReportFooter.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ThemeProvider, Box,
|
|
2
|
+
import { ThemeProvider, Box, Text, Heading, Grid } 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
|
-
return /* @__PURE__ */React.createElement(ThemeProvider, null, /* @__PURE__ */React.createElement(Box, {
|
|
10
|
-
padding: "20px"
|
|
11
|
-
}, /* @__PURE__ */React.createElement(Box, {
|
|
19
|
+
return /* @__PURE__ */React.createElement(ThemeProvider, null, /* @__PURE__ */React.createElement(Box, null, /* @__PURE__ */React.createElement(Box, {
|
|
12
20
|
mb: 6,
|
|
13
21
|
display: "flex",
|
|
14
22
|
justify: "space-between",
|
|
15
23
|
align: "start"
|
|
16
|
-
}, /* @__PURE__ */React.createElement(Box,
|
|
17
|
-
variant: "h1",
|
|
18
|
-
as: "h1",
|
|
19
|
-
gutterBottom: false
|
|
20
|
-
}, "Analytics Report")), /* @__PURE__ */React.createElement(Box, {
|
|
24
|
+
}, /* @__PURE__ */React.createElement(Box, {
|
|
21
25
|
display: "flex",
|
|
22
26
|
align: "flex-end",
|
|
23
27
|
direction: "column"
|
|
@@ -61,13 +65,16 @@ function ViewingAnalyticsReport(_ref) {
|
|
|
61
65
|
agreementsCount: stats.agreements_count,
|
|
62
66
|
agreementsFinalisedCount: stats.agreements_finalised_count,
|
|
63
67
|
filterDaysCount: eventData.filterDaysCount
|
|
64
|
-
}), /* @__PURE__ */React.createElement(Box,
|
|
65
|
-
|
|
68
|
+
}), /* @__PURE__ */React.createElement(Box, {
|
|
69
|
+
sx: {
|
|
70
|
+
mt: "28px"
|
|
71
|
+
}
|
|
72
|
+
}, /* @__PURE__ */React.createElement(Heading, {
|
|
66
73
|
as: "h4",
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
sx: {
|
|
75
|
+
mb: "16px"
|
|
76
|
+
}
|
|
69
77
|
}, "Top 5 properties"), /* @__PURE__ */React.createElement(GridList, {
|
|
70
|
-
mt: "20px",
|
|
71
78
|
items: properties,
|
|
72
79
|
spacing: 5,
|
|
73
80
|
emptyComponent: /* @__PURE__ */React.createElement(Text, null, "No results to show"),
|
|
@@ -76,19 +83,20 @@ function ViewingAnalyticsReport(_ref) {
|
|
|
76
83
|
item: true,
|
|
77
84
|
xs: 12
|
|
78
85
|
}, /* @__PURE__ */React.createElement(PropertyCard, {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
daysOnMarket: "",
|
|
82
|
-
weeklyRent: property.rent_amount,
|
|
86
|
+
address: property.short_address,
|
|
87
|
+
rent: propertyRent(property),
|
|
83
88
|
viewingsCount: property.viewings_count,
|
|
84
89
|
enquiriesCount: property.enquiries_count,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
imgSrc: property.thumb_url,
|
|
91
|
+
noOfBedrooms: property.num_bedrooms,
|
|
92
|
+
noOfBathrooms: property.num_bathrooms,
|
|
93
|
+
noOfCarparks: property.num_cars,
|
|
94
|
+
outlined: true
|
|
89
95
|
}));
|
|
90
96
|
}
|
|
91
97
|
}))));
|
|
92
98
|
}
|
|
99
|
+
ViewingAnalyticsReport.Footer = ReportFooter;
|
|
100
|
+
ViewingAnalyticsReport.Header = ReportHeader;
|
|
93
101
|
|
|
94
102
|
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.6",
|
|
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.6",
|
|
18
|
+
"@tenancy.nz/ui": "1.1.6"
|
|
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.6",
|
|
22
|
+
"@tenancy.nz/ui": "1.1.6"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"react-uid": "^2.4.0"
|