fleetmap-reports 2.0.4 → 2.0.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -11,7 +11,10 @@ require('jspdf-autotable')
11
11
  const traccarHelper = require('./util/traccar')
12
12
  const { headerFromUser, addTable } = require('./util/pdfDocument')
13
13
  const { getStyle } = require('./reportStyle')
14
- const { getUserPartner } = require('fleetmap-partners')
14
+ const {
15
+ getUserPartner,
16
+ newDomains
17
+ } = require('fleetmap-partners')
15
18
  const { devicesToProcess } = require('./util/device')
16
19
  const axios = require('axios')
17
20
  const {
@@ -33,8 +36,12 @@ async function createZoneReport (from, to, userData, traccar) {
33
36
  xpert: devices.filter(d => d.attributes.xpert).length > 0
34
37
  }
35
38
 
39
+ const serverHost = isClientSide() && newDomains.includes(window.location.hostname)
40
+ ? window.location.hostname
41
+ : process.env.SERVER_HOST
42
+
36
43
  if (isClientSide()) {
37
- const url = `https://${process.env.SERVER_HOST}/reports/zone-report`
44
+ const url = `https://${serverHost}/reports/zone-report`
38
45
  return axios.post(url, { from, to, userData }, { withCredentials: true })
39
46
  .then(d => d.data)
40
47
  }