@tenancy.nz/reports 1.0.1

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,165 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ require('react');
8
+ var reactUid = require('react-uid');
9
+ var ui = require('@tenancy.nz/ui');
10
+ var featureUi = require('@tenancy.nz/feature-ui');
11
+
12
+ function OwnerBookingReport({
13
+ agent = {},
14
+ bookings = [],
15
+ chart = {},
16
+ footer = void 0,
17
+ header = void 0,
18
+ loading = false,
19
+ notes,
20
+ property = {},
21
+ stats
22
+ }) {
23
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { width: "100%", children: [
24
+ header,
25
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { container: true, spacing: 6, children: [
26
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 8, children: /* @__PURE__ */ jsxRuntime.jsx(
27
+ featureUi.PropertyCard,
28
+ {
29
+ address: property.address,
30
+ imgSrc: property.imgSrc,
31
+ noOfBedrooms: property.noOfBedrooms,
32
+ noOfBathrooms: property.noOfBathrooms,
33
+ noOfCarparks: property.noOfCarparks,
34
+ rent: property.rent,
35
+ loading,
36
+ compact: true,
37
+ outlined: true
38
+ }
39
+ ) }),
40
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Paper, { inset: "medium", outlined: true, sx: { height: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
41
+ featureUi.AgentDetailsCard,
42
+ {
43
+ email: agent.email,
44
+ logo: agent.logo,
45
+ loading,
46
+ name: agent.name,
47
+ phone: agent.phone
48
+ }
49
+ ) }) }),
50
+ stats && /* @__PURE__ */ jsxRuntime.jsxs(
51
+ ui.Grid,
52
+ {
53
+ item: true,
54
+ xs: 12,
55
+ sx: {
56
+ display: "flex",
57
+ gap: "36px",
58
+ justifyContent: "space-between"
59
+ },
60
+ children: [
61
+ /* @__PURE__ */ jsxRuntime.jsx(
62
+ featureUi.AnalyticsBox,
63
+ {
64
+ outlined: true,
65
+ width: "100%",
66
+ height: "125px",
67
+ label: "Viewings",
68
+ amount: stats.viewingsCount || 0
69
+ }
70
+ ),
71
+ /* @__PURE__ */ jsxRuntime.jsx(
72
+ featureUi.AnalyticsBox,
73
+ {
74
+ outlined: true,
75
+ width: "100%",
76
+ height: "125px",
77
+ label: "Bookings",
78
+ amount: stats.bookingsCount || 0
79
+ }
80
+ ),
81
+ /* @__PURE__ */ jsxRuntime.jsx(
82
+ featureUi.AnalyticsBox,
83
+ {
84
+ outlined: true,
85
+ width: "100%",
86
+ height: "125px",
87
+ label: "Attended",
88
+ amount: stats.attendedBookingsCount || 0
89
+ }
90
+ ),
91
+ /* @__PURE__ */ jsxRuntime.jsx(
92
+ featureUi.AnalyticsBox,
93
+ {
94
+ outlined: true,
95
+ width: "100%",
96
+ height: "125px",
97
+ label: "Cancelled",
98
+ amount: stats.cancelledBookingsCount || 0
99
+ }
100
+ ),
101
+ /* @__PURE__ */ jsxRuntime.jsx(
102
+ featureUi.AnalyticsBox,
103
+ {
104
+ outlined: true,
105
+ width: "100%",
106
+ height: "125px",
107
+ label: "No-shows",
108
+ amount: stats.noShowBookingsCount || 0
109
+ }
110
+ ),
111
+ /* @__PURE__ */ jsxRuntime.jsx(
112
+ featureUi.AnalyticsBox,
113
+ {
114
+ outlined: true,
115
+ width: "100%",
116
+ height: "125px",
117
+ label: "Enquiries",
118
+ amount: stats.enquiriesCount || 0
119
+ }
120
+ ),
121
+ /* @__PURE__ */ jsxRuntime.jsx(
122
+ featureUi.AnalyticsBox,
123
+ {
124
+ outlined: true,
125
+ width: "100%",
126
+ height: "125px",
127
+ label: "Application numbers",
128
+ amount: stats.applicationsCount || 0
129
+ }
130
+ )
131
+ ]
132
+ }
133
+ ),
134
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Paper, { inset: "medium", sx: { height: "100%" }, outlined: true, children: /* @__PURE__ */ jsxRuntime.jsx(featureUi.BookingChart, { data: chart.data || [], labels: chart.labels || [] }) }) }),
135
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { item: true, xs: 12, children: [
136
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { as: "h4", weight: "700", sx: { mb: "20px" }, children: "Bookings" }),
137
+ /* @__PURE__ */ jsxRuntime.jsx(featureUi.BookingTable, { data: bookings, loading })
138
+ ] }),
139
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { as: "h4", weight: "700", children: "Viewing notes" }) }),
140
+ loading && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
141
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsxRuntime.jsx(featureUi.NotesCard, { loading: true, text: "" }) }),
142
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsxRuntime.jsx(featureUi.NotesCard, { loading: true, text: "" }) })
143
+ ] })
144
+ ] }),
145
+ !loading && notes && notes.length && notes.map(({ label, data }, i) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { mt: "15px", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { container: true, xs: 12, spacing: 4, children: [
146
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { variant: "body2", weight: "600", children: [
147
+ "Date Recorded: ",
148
+ label
149
+ ] }) }),
150
+ data.map(({ tag, text }, j) => /* @__PURE__ */ jsxRuntime.jsx(
151
+ ui.Grid,
152
+ {
153
+ item: true,
154
+ xs: 6,
155
+ sx: { breakInside: "avoid" },
156
+ children: /* @__PURE__ */ jsxRuntime.jsx(featureUi.NotesCard, { tag, text, outlined: true })
157
+ },
158
+ reactUid.uid({ tag, text }, j)
159
+ ))
160
+ ] }) }, reactUid.uid({ label, data }, i))),
161
+ footer
162
+ ] });
163
+ }
164
+
165
+ exports.default = OwnerBookingReport;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ require('react');
8
+ var ui = require('@tenancy.nz/ui');
9
+
10
+ function ReportFooter({ text }) {
11
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { mt: "24px", color: "#595959", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "div", variant: "body2", weight: "300", italic: true, children: text || "This PDF is for - purposes." }) });
12
+ }
13
+
14
+ exports.default = ReportFooter;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ require('react');
8
+ var ui = require('@tenancy.nz/ui');
9
+
10
+ function ReportHeader({
11
+ heading,
12
+ subheading = void 0,
13
+ logo
14
+ }) {
15
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { mb: "24px", borderBottom: "1px solid #E0E0E0", paddingBottom: "8px", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { container: true, spacing: 6, children: [
16
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { item: true, xs: 8, children: [
17
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { as: "h1", weight: "700", sx: { mb: "8px" }, children: heading }),
18
+ subheading && /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { as: "h5", weight: "500", children: subheading })
19
+ ] }),
20
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 4, sx: { display: "flex", justifyContent: "flex-end" }, children: logo && /* @__PURE__ */ jsxRuntime.jsx(
21
+ ui.Box,
22
+ {
23
+ sx: {
24
+ width: "150px",
25
+ height: "35px",
26
+ "> img": {
27
+ maxWidth: "100%",
28
+ maxHeight: "100%"
29
+ }
30
+ },
31
+ children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: logo, alt: "Tenancy" })
32
+ }
33
+ ) })
34
+ ] }) });
35
+ }
36
+
37
+ exports.default = ReportHeader;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var ui = require('@tenancy.nz/ui');
8
+ var featureUi = require('@tenancy.nz/feature-ui');
9
+
10
+ function ViewingAnalyticsReport({ eventData }) {
11
+ const stats = eventData.stats || {};
12
+ const properties = eventData.properties || [];
13
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.ThemeProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { padding: "20px", children: [
14
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { mb: 6, display: "flex", justify: "space-between", align: "start", children: [
15
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { variant: "h1", as: "h1", gutterBottom: false, children: "Analytics Report" }) }),
16
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { display: "flex", align: "flex-end", direction: "column", children: [
17
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { mt: 2, children: [
18
+ eventData.fromDate && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
19
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "700", as: "span", display: "inline", children: "Report Range From" }),
20
+ " ",
21
+ eventData.fromDate,
22
+ " "
23
+ ] }),
24
+ eventData.toDate && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
25
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "700", as: "span", display: "inline", children: "To" }),
26
+ " ",
27
+ eventData.toDate
28
+ ] })
29
+ ] }),
30
+ eventData.viewingAgent && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { color: "textPrimary", weight: "700", fontSize: 12, children: [
31
+ "Viewing agent:",
32
+ " ",
33
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "400", as: "span", display: "inline", children: eventData.viewingAgent })
34
+ ] }),
35
+ eventData.propertyAgent && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { color: "textPrimary", weight: "700", fontSize: 12, children: [
36
+ "Property agent:",
37
+ " ",
38
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "400", as: "span", display: "inline", children: eventData.propertyAgent })
39
+ ] })
40
+ ] })
41
+ ] }),
42
+ /* @__PURE__ */ jsxRuntime.jsx(
43
+ featureUi.AnalyticsSection,
44
+ {
45
+ viewingsCount: stats.viewings_count,
46
+ bookingsCount: stats.bookings_count,
47
+ attendeesCount: stats.viewing_attendees_count,
48
+ cancellationsCount: stats.bookings_cancelled_count,
49
+ applicationsCount: stats.applications_count,
50
+ averageRent: stats.avg_rent,
51
+ textUsage: stats.sent_sms_count,
52
+ tradeMeEnquiriesCount: stats.trademe_enquiries_count,
53
+ bookMeEnquiriesCount: stats.bookme_enquiries_count,
54
+ manualEnquiryCount: stats.enquiries_count,
55
+ agreementsCount: stats.agreements_count,
56
+ agreementsFinalisedCount: stats.agreements_finalised_count,
57
+ filterDaysCount: eventData.filterDaysCount
58
+ }
59
+ ),
60
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
61
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { variant: "h4", as: "h4", mt: "20px", gutterBottom: false, children: "Top 5 properties" }),
62
+ /* @__PURE__ */ jsxRuntime.jsx(
63
+ featureUi.GridList,
64
+ {
65
+ mt: "20px",
66
+ items: properties,
67
+ spacing: 5,
68
+ emptyComponent: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "No results to show" }),
69
+ renderItem: (property) => /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
70
+ featureUi.PropertyCard,
71
+ {
72
+ propertyAddress: property.short_address,
73
+ listingDate: "",
74
+ daysOnMarket: "",
75
+ weeklyRent: property.rent_amount,
76
+ viewingsCount: property.viewings_count,
77
+ enquiriesCount: property.enquiries_count,
78
+ propertyImage: property.thumb_url,
79
+ beds: property.num_bedrooms,
80
+ baths: property.num_bathrooms,
81
+ carports: property.num_cars
82
+ }
83
+ ) })
84
+ }
85
+ )
86
+ ] })
87
+ ] }) });
88
+ }
89
+
90
+ exports.default = ViewingAnalyticsReport;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var OwnerBookingReport = require('./components/OwnerBookingReport.cjs');
5
+ var ViewingAnalyticsReport = require('./components/ViewingAnalyticsReport.cjs');
6
+ var ReportFooter = require('./components/ReportFooter.cjs');
7
+ var ReportHeader = require('./components/ReportHeader.cjs');
8
+
9
+
10
+
11
+ exports.OwnerBookingReport = OwnerBookingReport.default;
12
+ exports.ViewingAnalyticsReport = ViewingAnalyticsReport.default;
13
+ exports.ReportFooter = ReportFooter.default;
14
+ exports.ReportHeader = ReportHeader.default;
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
+ import 'react';
4
+ import { uid } from 'react-uid';
5
+ import { Box, Grid, Paper, Heading, Text } from '@tenancy.nz/ui';
6
+ import { PropertyCard, AgentDetailsCard, AnalyticsBox, BookingChart, BookingTable, NotesCard } from '@tenancy.nz/feature-ui';
7
+
8
+ function OwnerBookingReport({
9
+ agent = {},
10
+ bookings = [],
11
+ chart = {},
12
+ footer = void 0,
13
+ header = void 0,
14
+ loading = false,
15
+ notes,
16
+ property = {},
17
+ stats
18
+ }) {
19
+ return /* @__PURE__ */ jsxs(Box, { width: "100%", children: [
20
+ header,
21
+ /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 6, children: [
22
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 8, children: /* @__PURE__ */ jsx(
23
+ PropertyCard,
24
+ {
25
+ address: property.address,
26
+ imgSrc: property.imgSrc,
27
+ noOfBedrooms: property.noOfBedrooms,
28
+ noOfBathrooms: property.noOfBathrooms,
29
+ noOfCarparks: property.noOfCarparks,
30
+ rent: property.rent,
31
+ loading,
32
+ compact: true,
33
+ outlined: true
34
+ }
35
+ ) }),
36
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(Paper, { inset: "medium", outlined: true, sx: { height: "100%" }, children: /* @__PURE__ */ jsx(
37
+ AgentDetailsCard,
38
+ {
39
+ email: agent.email,
40
+ logo: agent.logo,
41
+ loading,
42
+ name: agent.name,
43
+ phone: agent.phone
44
+ }
45
+ ) }) }),
46
+ stats && /* @__PURE__ */ jsxs(
47
+ Grid,
48
+ {
49
+ item: true,
50
+ xs: 12,
51
+ sx: {
52
+ display: "flex",
53
+ gap: "36px",
54
+ justifyContent: "space-between"
55
+ },
56
+ children: [
57
+ /* @__PURE__ */ jsx(
58
+ AnalyticsBox,
59
+ {
60
+ outlined: true,
61
+ width: "100%",
62
+ height: "125px",
63
+ label: "Viewings",
64
+ amount: stats.viewingsCount || 0
65
+ }
66
+ ),
67
+ /* @__PURE__ */ jsx(
68
+ AnalyticsBox,
69
+ {
70
+ outlined: true,
71
+ width: "100%",
72
+ height: "125px",
73
+ label: "Bookings",
74
+ amount: stats.bookingsCount || 0
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsx(
78
+ AnalyticsBox,
79
+ {
80
+ outlined: true,
81
+ width: "100%",
82
+ height: "125px",
83
+ label: "Attended",
84
+ amount: stats.attendedBookingsCount || 0
85
+ }
86
+ ),
87
+ /* @__PURE__ */ jsx(
88
+ AnalyticsBox,
89
+ {
90
+ outlined: true,
91
+ width: "100%",
92
+ height: "125px",
93
+ label: "Cancelled",
94
+ amount: stats.cancelledBookingsCount || 0
95
+ }
96
+ ),
97
+ /* @__PURE__ */ jsx(
98
+ AnalyticsBox,
99
+ {
100
+ outlined: true,
101
+ width: "100%",
102
+ height: "125px",
103
+ label: "No-shows",
104
+ amount: stats.noShowBookingsCount || 0
105
+ }
106
+ ),
107
+ /* @__PURE__ */ jsx(
108
+ AnalyticsBox,
109
+ {
110
+ outlined: true,
111
+ width: "100%",
112
+ height: "125px",
113
+ label: "Enquiries",
114
+ amount: stats.enquiriesCount || 0
115
+ }
116
+ ),
117
+ /* @__PURE__ */ jsx(
118
+ AnalyticsBox,
119
+ {
120
+ outlined: true,
121
+ width: "100%",
122
+ height: "125px",
123
+ label: "Application numbers",
124
+ amount: stats.applicationsCount || 0
125
+ }
126
+ )
127
+ ]
128
+ }
129
+ ),
130
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Paper, { inset: "medium", sx: { height: "100%" }, outlined: true, children: /* @__PURE__ */ jsx(BookingChart, { data: chart.data || [], labels: chart.labels || [] }) }) }),
131
+ /* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
132
+ /* @__PURE__ */ jsx(Heading, { as: "h4", weight: "700", sx: { mb: "20px" }, children: "Bookings" }),
133
+ /* @__PURE__ */ jsx(BookingTable, { data: bookings, loading })
134
+ ] }),
135
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Heading, { as: "h4", weight: "700", children: "Viewing notes" }) }),
136
+ loading && /* @__PURE__ */ jsxs(Fragment, { children: [
137
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsx(NotesCard, { loading: true, text: "" }) }),
138
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsx(NotesCard, { loading: true, text: "" }) })
139
+ ] })
140
+ ] }),
141
+ !loading && notes && notes.length && notes.map(({ label, data }, i) => /* @__PURE__ */ jsx(Box, { mt: "15px", children: /* @__PURE__ */ jsxs(Grid, { container: true, xs: 12, spacing: 4, children: [
142
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(Text, { variant: "body2", weight: "600", children: [
143
+ "Date Recorded: ",
144
+ label
145
+ ] }) }),
146
+ data.map(({ tag, text }, j) => /* @__PURE__ */ jsx(
147
+ Grid,
148
+ {
149
+ item: true,
150
+ xs: 6,
151
+ sx: { breakInside: "avoid" },
152
+ children: /* @__PURE__ */ jsx(NotesCard, { tag, text, outlined: true })
153
+ },
154
+ uid({ tag, text }, j)
155
+ ))
156
+ ] }) }, uid({ label, data }, i))),
157
+ footer
158
+ ] });
159
+ }
160
+
161
+ export { OwnerBookingReport as default };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import 'react';
4
+ import { Box, Text } from '@tenancy.nz/ui';
5
+
6
+ function ReportFooter({ text }) {
7
+ return /* @__PURE__ */ jsx(Box, { mt: "24px", color: "#595959", children: /* @__PURE__ */ jsx(Text, { as: "div", variant: "body2", weight: "300", italic: true, children: text || "This PDF is for - purposes." }) });
8
+ }
9
+
10
+ export { ReportFooter as default };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import 'react';
4
+ import { Box, Grid, Heading } from '@tenancy.nz/ui';
5
+
6
+ function ReportHeader({
7
+ heading,
8
+ subheading = void 0,
9
+ logo
10
+ }) {
11
+ return /* @__PURE__ */ jsx(Box, { mb: "24px", borderBottom: "1px solid #E0E0E0", paddingBottom: "8px", children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 6, children: [
12
+ /* @__PURE__ */ jsxs(Grid, { item: true, xs: 8, children: [
13
+ /* @__PURE__ */ jsx(Heading, { as: "h1", weight: "700", sx: { mb: "8px" }, children: heading }),
14
+ subheading && /* @__PURE__ */ jsx(Heading, { as: "h5", weight: "500", children: subheading })
15
+ ] }),
16
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, sx: { display: "flex", justifyContent: "flex-end" }, children: logo && /* @__PURE__ */ jsx(
17
+ Box,
18
+ {
19
+ sx: {
20
+ width: "150px",
21
+ height: "35px",
22
+ "> img": {
23
+ maxWidth: "100%",
24
+ maxHeight: "100%"
25
+ }
26
+ },
27
+ children: /* @__PURE__ */ jsx("img", { src: logo, alt: "Tenancy" })
28
+ }
29
+ ) })
30
+ ] }) });
31
+ }
32
+
33
+ export { ReportHeader as default };
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { ThemeProvider, Box, Heading, Text, Grid } from '@tenancy.nz/ui';
4
+ import { AnalyticsSection, GridList, PropertyCard } from '@tenancy.nz/feature-ui';
5
+
6
+ function ViewingAnalyticsReport({ eventData }) {
7
+ const stats = eventData.stats || {};
8
+ const properties = eventData.properties || [];
9
+ return /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsxs(Box, { padding: "20px", children: [
10
+ /* @__PURE__ */ jsxs(Box, { mb: 6, display: "flex", justify: "space-between", align: "start", children: [
11
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Heading, { variant: "h1", as: "h1", gutterBottom: false, children: "Analytics Report" }) }),
12
+ /* @__PURE__ */ jsxs(Box, { display: "flex", align: "flex-end", direction: "column", children: [
13
+ /* @__PURE__ */ jsxs(Text, { mt: 2, children: [
14
+ eventData.fromDate && /* @__PURE__ */ jsxs(Fragment, { children: [
15
+ /* @__PURE__ */ jsx(Text, { weight: "700", as: "span", display: "inline", children: "Report Range From" }),
16
+ " ",
17
+ eventData.fromDate,
18
+ " "
19
+ ] }),
20
+ eventData.toDate && /* @__PURE__ */ jsxs(Fragment, { children: [
21
+ /* @__PURE__ */ jsx(Text, { weight: "700", as: "span", display: "inline", children: "To" }),
22
+ " ",
23
+ eventData.toDate
24
+ ] })
25
+ ] }),
26
+ eventData.viewingAgent && /* @__PURE__ */ jsxs(Text, { color: "textPrimary", weight: "700", fontSize: 12, children: [
27
+ "Viewing agent:",
28
+ " ",
29
+ /* @__PURE__ */ jsx(Text, { weight: "400", as: "span", display: "inline", children: eventData.viewingAgent })
30
+ ] }),
31
+ eventData.propertyAgent && /* @__PURE__ */ jsxs(Text, { color: "textPrimary", weight: "700", fontSize: 12, children: [
32
+ "Property agent:",
33
+ " ",
34
+ /* @__PURE__ */ jsx(Text, { weight: "400", as: "span", display: "inline", children: eventData.propertyAgent })
35
+ ] })
36
+ ] })
37
+ ] }),
38
+ /* @__PURE__ */ jsx(
39
+ AnalyticsSection,
40
+ {
41
+ viewingsCount: stats.viewings_count,
42
+ bookingsCount: stats.bookings_count,
43
+ attendeesCount: stats.viewing_attendees_count,
44
+ cancellationsCount: stats.bookings_cancelled_count,
45
+ applicationsCount: stats.applications_count,
46
+ averageRent: stats.avg_rent,
47
+ textUsage: stats.sent_sms_count,
48
+ tradeMeEnquiriesCount: stats.trademe_enquiries_count,
49
+ bookMeEnquiriesCount: stats.bookme_enquiries_count,
50
+ manualEnquiryCount: stats.enquiries_count,
51
+ agreementsCount: stats.agreements_count,
52
+ agreementsFinalisedCount: stats.agreements_finalised_count,
53
+ filterDaysCount: eventData.filterDaysCount
54
+ }
55
+ ),
56
+ /* @__PURE__ */ jsxs(Box, { children: [
57
+ /* @__PURE__ */ jsx(Heading, { variant: "h4", as: "h4", mt: "20px", gutterBottom: false, children: "Top 5 properties" }),
58
+ /* @__PURE__ */ jsx(
59
+ GridList,
60
+ {
61
+ mt: "20px",
62
+ items: properties,
63
+ spacing: 5,
64
+ emptyComponent: /* @__PURE__ */ jsx(Text, { children: "No results to show" }),
65
+ renderItem: (property) => /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
66
+ PropertyCard,
67
+ {
68
+ propertyAddress: property.short_address,
69
+ listingDate: "",
70
+ daysOnMarket: "",
71
+ weeklyRent: property.rent_amount,
72
+ viewingsCount: property.viewings_count,
73
+ enquiriesCount: property.enquiries_count,
74
+ propertyImage: property.thumb_url,
75
+ beds: property.num_bedrooms,
76
+ baths: property.num_bathrooms,
77
+ carports: property.num_cars
78
+ }
79
+ ) })
80
+ }
81
+ )
82
+ ] })
83
+ ] }) });
84
+ }
85
+
86
+ export { ViewingAnalyticsReport as default };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ export { default as OwnerBookingReport } from './components/OwnerBookingReport.js';
3
+ export { default as ViewingAnalyticsReport } from './components/ViewingAnalyticsReport.js';
4
+ export { default as ReportFooter } from './components/ReportFooter.js';
5
+ export { default as ReportHeader } from './components/ReportHeader.js';
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@tenancy.nz/reports",
3
+ "description": "React UI reporting components.",
4
+ "version": "1.0.1",
5
+ "author": "TPS <https://www.tenancy.co.nz>",
6
+ "license": "ISC",
7
+ "type": "module",
8
+ "main": "dist/cjs/index.cjs",
9
+ "module": "dist/esm/index.js",
10
+ "types": "dist/types/index.d.ts",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "peerDependencies": {
15
+ "react": ">= 16.0.0 <= 18.3.1",
16
+ "react-dom": ">= 16.0.0 <= 18.3.1",
17
+ "@tenancy.nz/ui": "1.0.1",
18
+ "@tenancy.nz/feature-ui": "1.0.1"
19
+ },
20
+ "devDependencies": {
21
+ "react": "^19.1.0",
22
+ "react-dom": "^19.1.0",
23
+ "@tenancy.nz/feature-ui": "1.0.1",
24
+ "@tenancy.nz/ui": "1.0.1"
25
+ },
26
+ "dependencies": {
27
+ "react-uid": "^2.4.0"
28
+ },
29
+ "scripts": {
30
+ "build": "tsx ../../scripts/build.js"
31
+ }
32
+ }