fleetmap-reports 2.0.49 → 2.0.50
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 +1 -1
- package/src/speeding-report.js +2 -2
- package/src/util/utils.js +16 -2
- package/src/zone-report.js +2 -2
- package/src/util/index.js +0 -13
package/package.json
CHANGED
package/src/speeding-report.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const jsPDF = require('jspdf')
|
|
2
2
|
const {
|
|
3
3
|
convertMS, convertToLocaleString, convertToFeature, convertPositionToFeature, getTranslations, getLanguage,
|
|
4
|
-
getCountry
|
|
4
|
+
getCountry,
|
|
5
|
+
getServerHost
|
|
5
6
|
} = require('./util/utils')
|
|
6
7
|
const { headerFromUser, AmiriRegular } = require('./util/pdfDocument')
|
|
7
8
|
require('jspdf-autotable')
|
|
@@ -20,7 +21,6 @@ const booleanPointInPolygon = require('@turf/boolean-point-in-polygon')
|
|
|
20
21
|
const automaticReports = require('./automaticReports')
|
|
21
22
|
const { default: axios } = require('axios')
|
|
22
23
|
const { getDriverName, getDriverData } = require('./util/driver')
|
|
23
|
-
const { getServerHost } = require('./util')
|
|
24
24
|
|
|
25
25
|
const fileName = 'SpeedingReport'
|
|
26
26
|
const eventTypes = ['deviceOverspeed']
|
package/src/util/utils.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
const turf = require('@turf/helpers')
|
|
2
|
-
const {
|
|
2
|
+
const {
|
|
3
|
+
getUserPartner,
|
|
4
|
+
newDomains
|
|
5
|
+
} = require('fleetmap-partners')
|
|
3
6
|
const messages = require('../../lang')
|
|
4
7
|
const distance = require('@turf/distance')
|
|
5
|
-
const {
|
|
8
|
+
const { devicesToProcess } = require('./device')
|
|
6
9
|
|
|
7
10
|
exports.getTranslations = (userData) => {
|
|
8
11
|
const lang = this.getLanguage(userData)
|
|
@@ -318,3 +321,14 @@ exports.getCountry = (position) => {
|
|
|
318
321
|
}
|
|
319
322
|
return country && country.code
|
|
320
323
|
}
|
|
324
|
+
|
|
325
|
+
exports.processServerSide = (userData) => {
|
|
326
|
+
const devices = devicesToProcess(userData)
|
|
327
|
+
return devices.length > 100 && isClientSide()
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const getServerHost = () =>
|
|
331
|
+
newDomains.includes(window.location.hostname)
|
|
332
|
+
? `${window.location.hostname}/pinmeapi`
|
|
333
|
+
: process.env.SERVER_HOST
|
|
334
|
+
exports.getServerHost = getServerHost
|
package/src/zone-report.js
CHANGED
|
@@ -4,7 +4,8 @@ const {
|
|
|
4
4
|
calculateDistance,
|
|
5
5
|
sortPositions, getDates, convertToLocaleDateString, convertToLocaleTimeString,
|
|
6
6
|
isClientSide,
|
|
7
|
-
getLanguage, convertFromUTC, convertFromLocal
|
|
7
|
+
getLanguage, convertFromUTC, convertFromLocal,
|
|
8
|
+
getServerHost
|
|
8
9
|
} = require('./util/utils')
|
|
9
10
|
const jsPDF = require('jspdf')
|
|
10
11
|
require('jspdf-autotable')
|
|
@@ -22,7 +23,6 @@ const {
|
|
|
22
23
|
const { checkGeofenceIn } = require('./util/geofence')
|
|
23
24
|
const { parallel } = require('./util/parallel')
|
|
24
25
|
const { getDataByDay } = require('./util/trips')
|
|
25
|
-
const { getServerHost } = require('./util')
|
|
26
26
|
const sliceSize = 100
|
|
27
27
|
const deviceChunk = 5
|
|
28
28
|
const fileName = 'ZoneReport'
|
package/src/util/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const { devicesToProcess } = require('./device')
|
|
2
|
-
const { isClientSide } = require('./utils')
|
|
3
|
-
const { newDomains } = require('fleetmap-partners')
|
|
4
|
-
|
|
5
|
-
exports.processServerSide = (userData) => {
|
|
6
|
-
const devices = devicesToProcess(userData)
|
|
7
|
-
return devices.length > 100 && isClientSide()
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
exports.getServerHost = () =>
|
|
11
|
-
newDomains.includes(window.location.hostname)
|
|
12
|
-
? `${window.location.hostname}/pinmeapi`
|
|
13
|
-
: process.env.SERVER_HOST
|