@tenancy.nz/feature-ui 1.10.7 → 1.10.8

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.
@@ -1,59 +0,0 @@
1
- import { objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
2
- import React from 'react';
3
- import Stack from '@mui/material/Stack';
4
- import { Box, Text } from '@tenancy.nz/ui';
5
-
6
- function ChartLegend(_ref) {
7
- var _ref$color = _ref.color,
8
- color = _ref$color === void 0 ? void 0 : _ref$color,
9
- _ref$count = _ref.count,
10
- count = _ref$count === void 0 ? void 0 : _ref$count,
11
- label = _ref.label,
12
- _ref$sx = _ref.sx,
13
- sx = _ref$sx === void 0 ? {} : _ref$sx;
14
- return /* @__PURE__ */React.createElement(Stack, {
15
- flexDirection: "row",
16
- alignItems: "center",
17
- gap: 1.5,
18
- sx: _objectSpread2(_objectSpread2({}, sx), {}, {
19
- userSelect: "none",
20
- fontSize: {
21
- xs: "8px",
22
- md: "12px"
23
- }
24
- })
25
- }, /* @__PURE__ */React.createElement(Box, {
26
- bgcolor: color || "#D9D9D9",
27
- sx: {
28
- width: {
29
- xs: "20px",
30
- md: "32px"
31
- },
32
- height: {
33
- xs: "12px",
34
- md: "18px"
35
- },
36
- borderRadius: {
37
- xs: "2px",
38
- md: "4px"
39
- }
40
- }
41
- }), /* @__PURE__ */React.createElement(Box, {
42
- xs: {
43
- minWidth: {
44
- xs: "20px",
45
- md: "24px"
46
- }
47
- }
48
- }, count !== void 0 && count >= 0 && /* @__PURE__ */React.createElement(Text, {
49
- align: "center",
50
- weight: "700",
51
- variant: "inherit"
52
- }, count)), typeof label !== "string" ? label : /* @__PURE__ */React.createElement(Text, {
53
- weight: "500",
54
- variant: "inherit",
55
- color: "primary"
56
- }, label));
57
- }
58
-
59
- export { ChartLegend as default };
@@ -1,112 +0,0 @@
1
- import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
2
- import React from 'react';
3
- import DoughnutChart from './doughnut-chart.js';
4
- import PartnerLogo from './partner-logo.js';
5
- import { parseChartCount } from '../utils/helpers/general.js';
6
-
7
- var _excluded = ["bookMeCount", "oneRoofCount", "realEstateCount", "tradeMeCount", "manualCount", "websiteCount", "heading"];
8
- function AnalyticsDoughnutChart(_ref) {
9
- var _ref$bookMeCount = _ref.bookMeCount,
10
- bookMeCount = _ref$bookMeCount === void 0 ? 0 : _ref$bookMeCount,
11
- _ref$oneRoofCount = _ref.oneRoofCount,
12
- oneRoofCount = _ref$oneRoofCount === void 0 ? 0 : _ref$oneRoofCount,
13
- _ref$realEstateCount = _ref.realEstateCount,
14
- realEstateCount = _ref$realEstateCount === void 0 ? 0 : _ref$realEstateCount,
15
- _ref$tradeMeCount = _ref.tradeMeCount,
16
- tradeMeCount = _ref$tradeMeCount === void 0 ? 0 : _ref$tradeMeCount,
17
- _ref$manualCount = _ref.manualCount,
18
- manualCount = _ref$manualCount === void 0 ? 0 : _ref$manualCount,
19
- _ref$websiteCount = _ref.websiteCount,
20
- websiteCount = _ref$websiteCount === void 0 ? 0 : _ref$websiteCount,
21
- _ref$heading = _ref.heading,
22
- heading = _ref$heading === void 0 ? void 0 : _ref$heading,
23
- rest = _objectWithoutProperties(_ref, _excluded);
24
- var data = [{
25
- color: "#0CC1A3",
26
- count: parseChartCount(bookMeCount),
27
- slug: "bookme",
28
- title: "Tenant Portal"
29
- },
30
- // {
31
- // color: '#000000',
32
- // count: parseChartCount(allhouseCount),
33
- // slug: 'allhouse',
34
- // title: 'Allhouse',
35
- // logo: (
36
- // <PartnerLogo
37
- // name="allhouse"
38
- // width={{xs: '48px', md: '59px'}}
39
- // height={{xs: '12px', md: '14px'}}
40
- // />
41
- // ),
42
- // },
43
- {
44
- color: "#FF8500",
45
- count: parseChartCount(oneRoofCount),
46
- slug: "oneroof",
47
- title: "OneRoof",
48
- logo: /* @__PURE__ */React.createElement(PartnerLogo, {
49
- name: "oneroof",
50
- width: {
51
- xs: "52px",
52
- md: "66px"
53
- },
54
- height: {
55
- xs: "",
56
- md: "12px"
57
- }
58
- })
59
- }, {
60
- color: "#0098FF",
61
- count: parseChartCount(realEstateCount),
62
- slug: "realestate",
63
- title: "realestate.co.nz",
64
- logo: /* @__PURE__ */React.createElement(PartnerLogo, {
65
- name: "realestate",
66
- width: {
67
- xs: "72px",
68
- md: "92px"
69
- },
70
- height: {
71
- xs: "12px",
72
- md: "14px"
73
- }
74
- })
75
- }, {
76
- color: "#4854D3",
77
- count: parseChartCount(tradeMeCount),
78
- slug: "trademe",
79
- title: "Trade Me",
80
- logo: /* @__PURE__ */React.createElement(PartnerLogo, {
81
- name: "trademe",
82
- width: {
83
- xs: "64px",
84
- md: "90px"
85
- },
86
- height: {
87
- xs: "12px",
88
- md: "12px"
89
- }
90
- })
91
- }, {
92
- color: "#6D6D6D",
93
- count: parseChartCount(websiteCount),
94
- slug: "website",
95
- title: "Office Website"
96
- }, {
97
- color: "#D9D9D9",
98
- count: parseChartCount(manualCount),
99
- slug: "manual",
100
- title: "Manually Generated"
101
- }];
102
- return /* @__PURE__ */React.createElement(DoughnutChart, _objectSpread2({
103
- data: data,
104
- heading: heading,
105
- size: {
106
- xs: "100px",
107
- md: "165px"
108
- }
109
- }, rest));
110
- }
111
-
112
- export { AnalyticsDoughnutChart as default };
@@ -1,126 +0,0 @@
1
- import { objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
2
- import React from 'react';
3
- import { uid } from 'react-uid';
4
- import Stack from '@mui/material/Stack';
5
- import { Heading, Box } from '@tenancy.nz/ui';
6
- import { Chart } from 'primereact/chart.js';
7
- import ChartLegend from './ChartLegend.js';
8
-
9
- function DoughnutChart(_ref) {
10
- var data = _ref.data,
11
- _ref$heading = _ref.heading,
12
- heading = _ref$heading === void 0 ? void 0 : _ref$heading,
13
- _ref$chartProps = _ref.chartProps,
14
- chartProps = _ref$chartProps === void 0 ? {} : _ref$chartProps,
15
- _ref$size = _ref.size,
16
- size = _ref$size === void 0 ? "164px" : _ref$size;
17
- if (!Array.isArray(data) || data.length === 0) {
18
- return null;
19
- }
20
- var chartLabels = data.map(function (d) {
21
- return d.title;
22
- });
23
- var chartValues = data.map(function (d) {
24
- return d.count;
25
- });
26
- var chartColors = data.map(function (d) {
27
- return d.color;
28
- });
29
- return /* @__PURE__ */React.createElement(Stack, {
30
- sx: {
31
- position: "relative"
32
- },
33
- alignItems: "center",
34
- gap: 4
35
- }, heading && /* @__PURE__ */React.createElement(Heading, {
36
- as: "h4",
37
- color: "primary"
38
- }, heading), /* @__PURE__ */React.createElement(Stack, {
39
- flexDirection: "row",
40
- gap: {
41
- xs: 4,
42
- md: 12
43
- },
44
- alignItems: "center"
45
- }, /* @__PURE__ */React.createElement(Box, {
46
- overflow: "hidden",
47
- position: "relative",
48
- maxWidth: "100%",
49
- sx: {
50
- width: size,
51
- height: size,
52
- "&& > canvas": {
53
- width: "100%",
54
- height: "100%"
55
- }
56
- }
57
- }, /* @__PURE__ */React.createElement(Chart, _objectSpread2({
58
- type: "doughnut",
59
- data: {
60
- labels: chartLabels,
61
- datasets: [{
62
- data: chartValues,
63
- backgroundColor: chartColors,
64
- hoverBackgroundColor: chartColors,
65
- borderWidth: 0
66
- }]
67
- },
68
- options: {
69
- responsive: true,
70
- maintainAspectRatio: false,
71
- cutoutPercentage: 64,
72
- legend: {
73
- display: false
74
- },
75
- animation: {
76
- duration: 0
77
- },
78
- tooltips: {
79
- backgroundColor: "#0E0044",
80
- titleFontColor: "#fff",
81
- bodyFontColor: "#fff",
82
- xPadding: 8,
83
- yPadding: 8,
84
- bodyFontFamily: "Montserrat, sans-serif",
85
- bodyFontStyle: "semibold",
86
- bodyFontSize: 14,
87
- borderColor: "transparent",
88
- callbacks: {
89
- labelColor: function labelColor(tooltipItem, chart) {
90
- var dataset = chart.config.data.datasets[tooltipItem.datasetIndex];
91
- var color = dataset.backgroundColor[tooltipItem.index];
92
- return {
93
- borderColor: color,
94
- backgroundColor: color,
95
- borderWidth: 0,
96
- borderRadius: 5
97
- };
98
- },
99
- label: function label(_ref2) {
100
- var index = _ref2.index;
101
- return " ".concat(chartLabels[index], ": ").concat(parseInt(String(chartValues[index]), 10));
102
- }
103
- }
104
- }
105
- },
106
- style: {
107
- width: "100%",
108
- height: "100%"
109
- }
110
- }, chartProps))), /* @__PURE__ */React.createElement(Stack, {
111
- gap: 2
112
- }, data.map(function (item) {
113
- var color = item.color,
114
- count = item.count,
115
- title = item.title,
116
- logo = item.logo;
117
- return /* @__PURE__ */React.createElement(ChartLegend, {
118
- key: uid(item),
119
- color: color,
120
- count: parseInt(String(count), 10),
121
- label: logo || title
122
- });
123
- }))));
124
- }
125
-
126
- export { DoughnutChart as default };
@@ -1,169 +0,0 @@
1
- import React from 'react';
2
- import { uid } from 'react-uid';
3
- import Stack from '@mui/material/Stack';
4
- import useMediaQuery from '@mui/material/useMediaQuery';
5
- import { Grid, Paper, Text } from '@tenancy.nz/ui';
6
- import AnalyticsBox from './AnalyticsBox.js';
7
- import AnalyticsDoughnutChart from './analytics-doughnut-chart.js';
8
-
9
- var styles = {
10
- chartPaper: {
11
- height: "100%",
12
- width: "100%",
13
- alignItems: "center",
14
- justifyContent: "center",
15
- display: "flex"
16
- }
17
- };
18
- function PDFAnalyticsSection(_ref) {
19
- var viewingsCount = _ref.viewingsCount,
20
- bookingsCount = _ref.bookingsCount,
21
- attendeesCount = _ref.attendeesCount,
22
- cancellationsCount = _ref.cancellationsCount,
23
- applicationsCount = _ref.applicationsCount,
24
- averageRent = _ref.averageRent,
25
- textUsage = _ref.textUsage,
26
- agreementsCount = _ref.agreementsCount,
27
- agreementsFinalisedCount = _ref.agreementsFinalisedCount,
28
- filterDaysCount = _ref.filterDaysCount,
29
- allHouseEnquiriesCount = _ref.allHouseEnquiriesCount,
30
- bookMeEnquiriesCount = _ref.bookMeEnquiriesCount,
31
- oneRoofEnquiriesCount = _ref.oneRoofEnquiriesCount,
32
- realestateEnquiriesCount = _ref.realestateEnquiriesCount,
33
- tradeMeEnquiriesCount = _ref.tradeMeEnquiriesCount,
34
- manualEnquiryCount = _ref.manualEnquiryCount,
35
- websiteEnquiryCount = _ref.websiteEnquiryCount,
36
- allHouseBookingsCount = _ref.allHouseBookingsCount,
37
- bookMeBookingsCount = _ref.bookMeBookingsCount,
38
- oneRoofBookingsCount = _ref.oneRoofBookingsCount,
39
- realestateBookingsCount = _ref.realestateBookingsCount,
40
- tradeMeBookingsCount = _ref.tradeMeBookingsCount,
41
- manualBookingsCount = _ref.manualBookingsCount,
42
- websiteBookingsCount = _ref.websiteBookingsCount;
43
- var isXlUp = useMediaQuery(function (theme) {
44
- return theme.breakpoints.up("xl");
45
- });
46
- var stats = [{
47
- label: "Viewings",
48
- value: viewingsCount
49
- }, {
50
- label: "Bookings",
51
- value: bookingsCount
52
- }, {
53
- label: "Attendees",
54
- value: attendeesCount
55
- }, {
56
- label: "Cancellations",
57
- value: cancellationsCount
58
- }, {
59
- label: "Applications",
60
- value: applicationsCount
61
- }, {
62
- label: "Average Rent",
63
- value: "$".concat(averageRent)
64
- }, {
65
- label: "Text Usage Total",
66
- value: textUsage
67
- }];
68
- return /* @__PURE__ */React.createElement(Stack, {
69
- gap: 6
70
- }, /* @__PURE__ */React.createElement(Grid, {
71
- container: true,
72
- spacing: 6
73
- }, /* @__PURE__ */React.createElement(Grid, {
74
- container: true,
75
- item: true,
76
- spacing: 6,
77
- xs: 12
78
- }, /* @__PURE__ */React.createElement(Grid, {
79
- item: true,
80
- xs: 6
81
- }, /* @__PURE__ */React.createElement(Paper, {
82
- outlined: true,
83
- inset: "medium",
84
- overflow: false,
85
- sx: styles.chartPaper
86
- }, /* @__PURE__ */React.createElement(AnalyticsDoughnutChart, {
87
- tradeMeCount: tradeMeEnquiriesCount,
88
- bookMeCount: bookMeEnquiriesCount,
89
- manualCount: manualEnquiryCount,
90
- allhouseCount: allHouseEnquiriesCount,
91
- oneRoofCount: oneRoofEnquiriesCount,
92
- realEstateCount: realestateEnquiriesCount,
93
- websiteCount: websiteEnquiryCount,
94
- heading: "Number of enquiries"
95
- }))), /* @__PURE__ */React.createElement(Grid, {
96
- item: true,
97
- xs: 6
98
- }, /* @__PURE__ */React.createElement(Paper, {
99
- outlined: true,
100
- inset: "medium",
101
- overflow: false,
102
- sx: styles.chartPaper
103
- }, /* @__PURE__ */React.createElement(AnalyticsDoughnutChart, {
104
- tradeMeCount: tradeMeBookingsCount,
105
- bookMeCount: bookMeBookingsCount,
106
- manualCount: manualBookingsCount,
107
- allhouseCount: allHouseBookingsCount,
108
- oneRoofCount: oneRoofBookingsCount,
109
- realEstateCount: realestateBookingsCount,
110
- websiteCount: websiteBookingsCount,
111
- heading: "Number of bookings"
112
- })))), /* @__PURE__ */React.createElement(Grid, {
113
- item: true,
114
- container: true,
115
- xs: 12,
116
- spacing: 6
117
- }, /* @__PURE__ */React.createElement(Grid, {
118
- item: true,
119
- xs: 6
120
- }, /* @__PURE__ */React.createElement(AnalyticsBox, {
121
- outlined: true,
122
- label: /* @__PURE__ */React.createElement("strong", null, "Converted Properties"),
123
- amount: agreementsCount,
124
- width: "100%",
125
- height: isXlUp ? "157px" : "auto",
126
- text: /* @__PURE__ */React.createElement(Text, {
127
- as: "span",
128
- variant: "inherit"
129
- }, "Properties that have had a viewing in the last", " ", /* @__PURE__ */React.createElement("strong", null, filterDaysCount), " days where an agreement has been ", /* @__PURE__ */React.createElement("strong", null, "created"))
130
- })), /* @__PURE__ */React.createElement(Grid, {
131
- item: true,
132
- xs: 6,
133
- sx: {
134
- display: "flex",
135
- alignItems: "flex-end"
136
- }
137
- }, /* @__PURE__ */React.createElement(AnalyticsBox, {
138
- outlined: true,
139
- label: /* @__PURE__ */React.createElement("strong", null, "Converted Properties"),
140
- amount: agreementsFinalisedCount,
141
- width: "100%",
142
- height: isXlUp ? "157px" : "auto",
143
- text: /* @__PURE__ */React.createElement(Text, {
144
- as: "span",
145
- variant: "inherit"
146
- }, "Properties that have had a viewing in the last", " ", /* @__PURE__ */React.createElement("strong", null, " ", filterDaysCount), " days where an agreement has been ", /* @__PURE__ */React.createElement("strong", null, "finalised"))
147
- })))), /* @__PURE__ */React.createElement(Grid, {
148
- container: true,
149
- spacing: {
150
- xs: 3,
151
- md: 6
152
- }
153
- }, stats.map(function (stat, i) {
154
- return /* @__PURE__ */React.createElement(Grid, {
155
- item: true,
156
- key: uid(stat, i),
157
- xs: 3,
158
- md: 2
159
- }, /* @__PURE__ */React.createElement(AnalyticsBox, {
160
- outlined: true,
161
- label: stat.label,
162
- amount: stat.value,
163
- width: "100%",
164
- height: isXlUp ? "157px" : "124px"
165
- }));
166
- })));
167
- }
168
-
169
- export { PDFAnalyticsSection as default };
@@ -1,8 +0,0 @@
1
- var parseChartCount = function parseChartCount(value) {
2
- if (Number.isNaN(Number.parseInt(String(value), 10))) {
3
- return 0;
4
- }
5
- return Math.max(Number(value), 1e-3);
6
- };
7
-
8
- export { parseChartCount };