@go-avro/avro-js 0.0.110 → 0.0.111
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/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/presence.d.ts +6 -0
- package/dist/presence.js +10 -0
- package/dist/types/api/Device.d.ts +4 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,8 @@ import './client/hooks/email';
|
|
|
40
40
|
export { defaultPassOnFeeMethod } from './billing/fees';
|
|
41
41
|
export { reverseGeocode } from './geocode';
|
|
42
42
|
export { fetchCensusFeatures } from './census';
|
|
43
|
-
export { LOCATION_STALE_MINUTES, LOCATION_RECENT_HOURS, isLocationRecent, REPORTING_STATUSES, locationAgeMinutes, isLocationStale, isReportingStatus, isMobileDevice, mobileDevices, } from './presence';
|
|
43
|
+
export { LOCATION_STALE_MINUTES, LOCATION_RECENT_HOURS, isLocationRecent, REPORTING_STATUSES, locationAgeMinutes, isLocationStale, isReportingStatus, isMobileDevice, mobileDevices, userPresence, } from './presence';
|
|
44
|
+
export type { UserPresence } from './presence';
|
|
44
45
|
export type { ReverseGeocodeResult } from './geocode';
|
|
45
46
|
export * from './types/api';
|
|
46
47
|
export * from './types/auth';
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ import './client/hooks/email';
|
|
|
38
38
|
export { defaultPassOnFeeMethod } from './billing/fees';
|
|
39
39
|
export { reverseGeocode } from './geocode';
|
|
40
40
|
export { fetchCensusFeatures } from './census';
|
|
41
|
-
export { LOCATION_STALE_MINUTES, LOCATION_RECENT_HOURS, isLocationRecent, REPORTING_STATUSES, locationAgeMinutes, isLocationStale, isReportingStatus, isMobileDevice, mobileDevices, } from './presence';
|
|
41
|
+
export { LOCATION_STALE_MINUTES, LOCATION_RECENT_HOURS, isLocationRecent, REPORTING_STATUSES, locationAgeMinutes, isLocationStale, isReportingStatus, isMobileDevice, mobileDevices, userPresence, } from './presence';
|
|
42
42
|
export * from './types/api';
|
|
43
43
|
export * from './types/auth';
|
|
44
44
|
export * from './types/cache';
|
package/dist/presence.d.ts
CHANGED
|
@@ -25,3 +25,9 @@ export declare const isLocationStale: (location: Pick<Location, "time_collected"
|
|
|
25
25
|
export declare const LOCATION_RECENT_HOURS = 24;
|
|
26
26
|
/** True when the fix exists and is newer than `hours` old. */
|
|
27
27
|
export declare const isLocationRecent: (location: Pick<Location, "time_collected"> | null | undefined, hours?: number, nowMs?: number) => boolean;
|
|
28
|
+
export type UserPresence = 'online' | 'background' | 'offline';
|
|
29
|
+
/**
|
|
30
|
+
* online: some device is connected and on screen; background: connected
|
|
31
|
+
* but nothing on screen (e.g. a phone tracking location); offline: none.
|
|
32
|
+
*/
|
|
33
|
+
export declare const userPresence: (devices: Device[] | null | undefined) => UserPresence;
|
package/dist/presence.js
CHANGED
|
@@ -38,3 +38,13 @@ export const isLocationRecent = (location, hours = LOCATION_RECENT_HOURS, nowMs
|
|
|
38
38
|
const age = locationAgeMinutes(location, nowMs);
|
|
39
39
|
return age !== null && age < hours * 60;
|
|
40
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* online: some device is connected and on screen; background: connected
|
|
43
|
+
* but nothing on screen (e.g. a phone tracking location); offline: none.
|
|
44
|
+
*/
|
|
45
|
+
export const userPresence = (devices) => {
|
|
46
|
+
const connected = (devices ?? []).filter((d) => d.online);
|
|
47
|
+
if (connected.some((d) => d.foreground))
|
|
48
|
+
return 'online';
|
|
49
|
+
return connected.length > 0 ? 'background' : 'offline';
|
|
50
|
+
};
|
|
@@ -18,6 +18,8 @@ export interface DeviceInfo {
|
|
|
18
18
|
/** OS and version, e.g. "iOS 26.1" or "macOS 15". */
|
|
19
19
|
os?: string;
|
|
20
20
|
app_version?: string;
|
|
21
|
+
/** Whether the client is on screen (app active / tab visible). */
|
|
22
|
+
foreground?: boolean;
|
|
21
23
|
}
|
|
22
24
|
/** A device the user has connected from, as tracked by the server. */
|
|
23
25
|
export interface Device {
|
|
@@ -31,6 +33,8 @@ export interface Device {
|
|
|
31
33
|
location_status: LocationServicesStatus;
|
|
32
34
|
/** Whether the device currently holds a socket. */
|
|
33
35
|
online: boolean;
|
|
36
|
+
/** Whether the client is on screen; a backgrounded phone stays online for location. */
|
|
37
|
+
foreground: boolean;
|
|
34
38
|
last_location: Location | null;
|
|
35
39
|
last_seen: number | null;
|
|
36
40
|
time_created: number | null;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AVRO_JS_VERSION = "0.0.
|
|
1
|
+
export declare const AVRO_JS_VERSION = "0.0.111";
|
package/dist/version.js
CHANGED