@7365admin1/layer-common 4.13.2 → 4.15.0
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/CHANGELOG.md +16 -4
- package/components/CameraWall.vue +161 -2
- package/components/InvitationClientForm.vue +47 -1
- package/composables/usePropertyPermission.ts +4 -0
- package/composables/useSecurityPermission.ts +4 -0
- package/composables/useSiteSettings.ts +19 -0
- package/composables/useUser.ts +6 -2
- package/constants/permissions.ts +1 -1
- package/package.json +1 -1
- package/utils/camera-wall.ts +47 -1
- package/utils/client-invite-modules.ts +37 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- bfc654d: Invite Client: a Property Management client also gets the Service365 resident app modules, all ticked to start
|
|
8
|
+
|
|
9
|
+
## 4.14.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 894a47c: CCTV camera wall: Recorded footage — pick a start time and length and play what the camera recorded (server link, plain refusal messages); `cctv-mgmt:view-recordings` added to the Property Management and Security catalogues.
|
|
14
|
+
|
|
3
15
|
## 4.13.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1119,11 +1131,11 @@
|
|
|
1119
1131
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
1120
1132
|
own rule from two endpoints the console already calls, unprojected:
|
|
1121
1133
|
|
|
1122
|
-
|
|
1123
|
-
|
|
1134
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
1135
|
+
GET /api/roles/id/:role that membership's role document
|
|
1124
1136
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1137
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
1138
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
1127
1139
|
|
|
1128
1140
|
`role.default` is the marker because it is the only property of a platform
|
|
1129
1141
|
staff role no API caller can set - `role.controller.ts` validates create and
|
|
@@ -300,7 +300,10 @@
|
|
|
300
300
|
v-for="c in WALL_CAPABILITY_CONTROLS"
|
|
301
301
|
:key="c.key"
|
|
302
302
|
class="vms__cap"
|
|
303
|
-
:class="{
|
|
303
|
+
:class="{
|
|
304
|
+
'vms__cap--off': !capability(c.key).available,
|
|
305
|
+
'vms__cap--wide': c.key === 'playback' && capability(c.key).available,
|
|
306
|
+
}"
|
|
304
307
|
>
|
|
305
308
|
<p class="vms__cap-title">
|
|
306
309
|
{{ c.title }}
|
|
@@ -318,6 +321,50 @@
|
|
|
318
321
|
its title and its tag.
|
|
319
322
|
-->
|
|
320
323
|
<p v-if="capabilityText(c)" class="vms__cap-detail">{{ capabilityText(c) }}</p>
|
|
324
|
+
<!--
|
|
325
|
+
RECORDED FOOTAGE. Only when the server says this camera can serve it;
|
|
326
|
+
who may watch is the server's decision (site reach + the recordings
|
|
327
|
+
permission), and its refusal is shown here in plain words.
|
|
328
|
+
-->
|
|
329
|
+
<div v-if="c.key === 'playback' && capability(c.key).available" class="vms__playback">
|
|
330
|
+
<div class="vms__playback-form">
|
|
331
|
+
<label class="vms__playback-field">
|
|
332
|
+
Start
|
|
333
|
+
<input v-model="playbackStart" type="datetime-local" data-test="playback-start" />
|
|
334
|
+
</label>
|
|
335
|
+
<label class="vms__playback-field">
|
|
336
|
+
Length
|
|
337
|
+
<select v-model.number="playbackMinutes" data-test="playback-length">
|
|
338
|
+
<option v-for="m in PLAYBACK_MINUTES" :key="m" :value="m">{{ m }} minutes</option>
|
|
339
|
+
</select>
|
|
340
|
+
</label>
|
|
341
|
+
<button
|
|
342
|
+
type="button"
|
|
343
|
+
class="vms__playback-btn"
|
|
344
|
+
:disabled="playbackLoading"
|
|
345
|
+
data-test="playback-play"
|
|
346
|
+
@click="playRecording"
|
|
347
|
+
>
|
|
348
|
+
{{ playbackLoading ? "Opening…" : "Play" }}
|
|
349
|
+
</button>
|
|
350
|
+
<button
|
|
351
|
+
v-if="playbackUrl"
|
|
352
|
+
type="button"
|
|
353
|
+
class="vms__playback-btn vms__playback-btn--quiet"
|
|
354
|
+
@click="stopRecording"
|
|
355
|
+
>
|
|
356
|
+
Close
|
|
357
|
+
</button>
|
|
358
|
+
</div>
|
|
359
|
+
<p v-if="playbackError" class="vms__playback-error" role="alert">{{ playbackError }}</p>
|
|
360
|
+
<iframe
|
|
361
|
+
v-if="playbackUrl"
|
|
362
|
+
:src="playbackUrl"
|
|
363
|
+
class="vms__playback-player"
|
|
364
|
+
title="Recorded footage"
|
|
365
|
+
allow="autoplay; fullscreen"
|
|
366
|
+
/>
|
|
367
|
+
</div>
|
|
321
368
|
<!--
|
|
322
369
|
RULE 5. The line the server cannot write, because it does not know
|
|
323
370
|
who the reader can go and ask. Somebody read "Not set up yet" on this
|
|
@@ -358,6 +405,9 @@ import {
|
|
|
358
405
|
UNVERIFIED_DETAIL,
|
|
359
406
|
WALL_CAPABILITY_CONTROLS,
|
|
360
407
|
WALL_LAYOUTS,
|
|
408
|
+
PLAYBACK_MINUTES,
|
|
409
|
+
playbackErrorMessage,
|
|
410
|
+
playbackWindow,
|
|
361
411
|
type TWallCamera,
|
|
362
412
|
type TWallCameraHealth,
|
|
363
413
|
type TWallLayoutKey,
|
|
@@ -401,7 +451,7 @@ const props = defineProps<{ site: string }>();
|
|
|
401
451
|
|
|
402
452
|
/* ---------------------------------------------------------------- the data */
|
|
403
453
|
|
|
404
|
-
const { getSiteWall, getSiteHealth } = useSiteSettings();
|
|
454
|
+
const { getSiteWall, getSiteHealth, getCameraPlayback } = useSiteSettings();
|
|
405
455
|
|
|
406
456
|
const cameras = ref<TWallCamera[]>([]);
|
|
407
457
|
const loading = ref(true);
|
|
@@ -578,6 +628,43 @@ function togglePick(id: string) {
|
|
|
578
628
|
*/
|
|
579
629
|
const focusedId = ref("");
|
|
580
630
|
const focused = computed(() => focusedCamera(tiles.value, focusedId.value));
|
|
631
|
+
// A recording belongs to the camera it was opened for.
|
|
632
|
+
watch(() => focused.value?._id, stopRecording);
|
|
633
|
+
|
|
634
|
+
/* -------------------------------------------------------- recorded footage */
|
|
635
|
+
|
|
636
|
+
const playbackStart = ref("");
|
|
637
|
+
const playbackMinutes = ref<number>(10);
|
|
638
|
+
const playbackUrl = ref("");
|
|
639
|
+
const playbackError = ref("");
|
|
640
|
+
const playbackLoading = ref(false);
|
|
641
|
+
|
|
642
|
+
function stopRecording() {
|
|
643
|
+
playbackUrl.value = "";
|
|
644
|
+
playbackError.value = "";
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
async function playRecording() {
|
|
648
|
+
const camera = focused.value;
|
|
649
|
+
if (!camera) return;
|
|
650
|
+
const span = playbackWindow(playbackStart.value, playbackMinutes.value);
|
|
651
|
+
playbackUrl.value = "";
|
|
652
|
+
if ("error" in span) {
|
|
653
|
+
playbackError.value = span.error;
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
playbackError.value = "";
|
|
657
|
+
playbackLoading.value = true;
|
|
658
|
+
try {
|
|
659
|
+
const link = await getCameraPlayback(camera._id, span.start, span.end);
|
|
660
|
+
// Still the same camera: a click elsewhere while this was loading wins.
|
|
661
|
+
if (focused.value?._id === camera._id) playbackUrl.value = link.playerUrl;
|
|
662
|
+
} catch (error) {
|
|
663
|
+
playbackError.value = playbackErrorMessage(error);
|
|
664
|
+
} finally {
|
|
665
|
+
playbackLoading.value = false;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
581
668
|
|
|
582
669
|
function capability(key: string) {
|
|
583
670
|
return capabilityView(focused.value, key);
|
|
@@ -1156,6 +1243,78 @@ async function toggleFullscreen() {
|
|
|
1156
1243
|
than filled, which is what says "not switched on"; the fade was saying it a
|
|
1157
1244
|
second time at the cost of the words.
|
|
1158
1245
|
*/
|
|
1246
|
+
.vms__cap--wide {
|
|
1247
|
+
grid-column: 1 / -1;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
.vms__playback {
|
|
1251
|
+
margin-top: 8px;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
.vms__playback-form {
|
|
1255
|
+
display: flex;
|
|
1256
|
+
flex-wrap: wrap;
|
|
1257
|
+
align-items: flex-end;
|
|
1258
|
+
gap: 8px;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
.vms__playback-field {
|
|
1262
|
+
display: flex;
|
|
1263
|
+
flex-direction: column;
|
|
1264
|
+
gap: 2px;
|
|
1265
|
+
font-size: 12px;
|
|
1266
|
+
color: var(--vms-text-dim);
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
.vms__playback-field input,
|
|
1270
|
+
.vms__playback-field select {
|
|
1271
|
+
min-height: 32px;
|
|
1272
|
+
padding: 4px 8px;
|
|
1273
|
+
border: 1px solid var(--vms-line);
|
|
1274
|
+
border-radius: var(--vms-radius);
|
|
1275
|
+
background: var(--vms-chrome);
|
|
1276
|
+
color: var(--vms-text);
|
|
1277
|
+
color-scheme: dark;
|
|
1278
|
+
font: inherit;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
.vms__playback-btn {
|
|
1282
|
+
min-height: 32px;
|
|
1283
|
+
padding: 4px 14px;
|
|
1284
|
+
border: 1px solid var(--vms-accent);
|
|
1285
|
+
border-radius: var(--vms-radius);
|
|
1286
|
+
background: var(--vms-accent);
|
|
1287
|
+
color: #07090c;
|
|
1288
|
+
font-weight: 600;
|
|
1289
|
+
cursor: pointer;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
.vms__playback-btn:disabled {
|
|
1293
|
+
opacity: 0.7;
|
|
1294
|
+
cursor: progress;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
.vms__playback-btn--quiet {
|
|
1298
|
+
background: transparent;
|
|
1299
|
+
color: var(--vms-text);
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
.vms__playback-error {
|
|
1303
|
+
margin: 6px 0 0;
|
|
1304
|
+
font-size: 12px;
|
|
1305
|
+
color: #f2b8b5;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
.vms__playback-player {
|
|
1309
|
+
display: block;
|
|
1310
|
+
width: 100%;
|
|
1311
|
+
max-width: 960px;
|
|
1312
|
+
aspect-ratio: 16 / 9;
|
|
1313
|
+
margin-top: 8px;
|
|
1314
|
+
border: 0;
|
|
1315
|
+
background: #000;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1159
1318
|
.vms__cap-detail {
|
|
1160
1319
|
margin: 0;
|
|
1161
1320
|
font-size: 12px;
|
|
@@ -98,6 +98,31 @@
|
|
|
98
98
|
</v-row>
|
|
99
99
|
</div>
|
|
100
100
|
|
|
101
|
+
<!--
|
|
102
|
+
THE SERVICE365 RESIDENT APP (owner, 2026-09-12 / 2026-09-15): a
|
|
103
|
+
Property Management client gets its own modules AND these. Same
|
|
104
|
+
switches the Client details card saves.
|
|
105
|
+
-->
|
|
106
|
+
<div v-if="inviteIncludesResidentApp(app)" class="mt-4" data-test="invite-resident-app">
|
|
107
|
+
<InputLabel title="Modules for Service365 (resident app)" required />
|
|
108
|
+
<p class="text-caption text-medium-emphasis mb-2">
|
|
109
|
+
Only the modules ticked here appear in this client's Service365
|
|
110
|
+
resident app. Each site can then turn off what it does not use.
|
|
111
|
+
</p>
|
|
112
|
+
<v-row no-gutters>
|
|
113
|
+
<v-col v-for="module in RESIDENT_APP_MODULES" :key="`${app}-resident-${module.value}`" cols="12" sm="6">
|
|
114
|
+
<v-checkbox
|
|
115
|
+
v-model="residentAppOn"
|
|
116
|
+
:value="module.value"
|
|
117
|
+
:label="module.label"
|
|
118
|
+
density="compact"
|
|
119
|
+
hide-details
|
|
120
|
+
color="primary"
|
|
121
|
+
/>
|
|
122
|
+
</v-col>
|
|
123
|
+
</v-row>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
101
126
|
<!--
|
|
102
127
|
THE OWNER ROLE (owner, 2026-09-15): Seven365 chooses the
|
|
103
128
|
client owner's permissions with the modules. Only permissions
|
|
@@ -110,6 +135,11 @@
|
|
|
110
135
|
{{ appTitle(app) }}. They can only give their own staff roles
|
|
111
136
|
within these. Unticking a module above removes its permissions.
|
|
112
137
|
</p>
|
|
138
|
+
<p v-if="inviteIncludesResidentApp(app)" class="text-caption text-medium-emphasis mb-2">
|
|
139
|
+
Service365 residents do not hold roles: the resident app shows
|
|
140
|
+
them only the Service365 modules ticked above. Managing those
|
|
141
|
+
features for residents in Property Management follows this owner role.
|
|
142
|
+
</p>
|
|
113
143
|
<v-expansion-panels multiple variant="accordion">
|
|
114
144
|
<v-expansion-panel
|
|
115
145
|
v-for="(actions, resource) in roleCatalogue(app)"
|
|
@@ -222,7 +252,15 @@ import useUser from '../composables/useUser'
|
|
|
222
252
|
import useUtils from '../composables/useUtils'
|
|
223
253
|
import useOrg from '../composables/useOrg'
|
|
224
254
|
import useMember from '../composables/useMember'
|
|
225
|
-
import {
|
|
255
|
+
import {
|
|
256
|
+
RESIDENT_APP_MODULES,
|
|
257
|
+
catalogueStrings,
|
|
258
|
+
inviteIncludesResidentApp,
|
|
259
|
+
inviteModuleGroups,
|
|
260
|
+
inviteModuleKeys,
|
|
261
|
+
inviteResidentAppModules,
|
|
262
|
+
inviteRoleCatalogue,
|
|
263
|
+
} from '../utils/client-invite-modules'
|
|
226
264
|
import { ALWAYS_ALLOWED_MODULES } from '../utils/org-modules'
|
|
227
265
|
import { formatResourceLabel } from '../utils/permission-labels'
|
|
228
266
|
|
|
@@ -402,6 +440,10 @@ function syncModules(chosen: string[]) {
|
|
|
402
440
|
|
|
403
441
|
syncModules(invite.value.app)
|
|
404
442
|
|
|
443
|
+
/** Service365 switches ticked ON; every one starts ticked. */
|
|
444
|
+
const allResidentAppModules = () => RESIDENT_APP_MODULES.map(module => module.value)
|
|
445
|
+
const residentAppOn = ref<string[]>(allResidentAppModules())
|
|
446
|
+
|
|
405
447
|
/* ================= NEW CLIENT: OWNER ROLE ================= */
|
|
406
448
|
/*
|
|
407
449
|
* What Seven365 UNTICKED, per application. The owner's permissions are every
|
|
@@ -466,6 +508,7 @@ async function handleUpdateApp(value: string | null) {
|
|
|
466
508
|
// A different application starts again: all its modules and permissions ticked.
|
|
467
509
|
modulesByApp.value = {}
|
|
468
510
|
uncheckedByApp.value = {}
|
|
511
|
+
residentAppOn.value = allResidentAppModules()
|
|
469
512
|
syncModules(chosen)
|
|
470
513
|
await refreshRoles()
|
|
471
514
|
}
|
|
@@ -558,6 +601,9 @@ async function submit() {
|
|
|
558
601
|
]),
|
|
559
602
|
],
|
|
560
603
|
permissions: ownerPermissions(app),
|
|
604
|
+
...(inviteIncludesResidentApp(app)
|
|
605
|
+
? { residentAppModules: inviteResidentAppModules(residentAppOn.value) }
|
|
606
|
+
: {}),
|
|
561
607
|
}
|
|
562
608
|
: { role: invite.value.role }),
|
|
563
609
|
|
|
@@ -519,6 +519,10 @@ export default function usePropertyPermission() {
|
|
|
519
519
|
check: true,
|
|
520
520
|
description: "Allows the user to view the site's CCTV cameras.",
|
|
521
521
|
},
|
|
522
|
+
"view-recordings": {
|
|
523
|
+
check: true,
|
|
524
|
+
description: "Allows the user to watch what the site's CCTV cameras recorded.",
|
|
525
|
+
},
|
|
522
526
|
},
|
|
523
527
|
"nfc-patrol": {
|
|
524
528
|
"see-all-nfc-patrol": {
|
|
@@ -706,6 +706,10 @@ export default function useSecurityPermission() {
|
|
|
706
706
|
check: true,
|
|
707
707
|
description: "Allows the user to view the site's CCTV cameras.",
|
|
708
708
|
},
|
|
709
|
+
"view-recordings": {
|
|
710
|
+
check: true,
|
|
711
|
+
description: "Allows the user to watch what the site's CCTV cameras recorded.",
|
|
712
|
+
},
|
|
709
713
|
},
|
|
710
714
|
|
|
711
715
|
members: memberPermissions,
|
|
@@ -305,6 +305,24 @@ export default function () {
|
|
|
305
305
|
* Unpaginated by design: a wall shows a site's cameras, and paging them was
|
|
306
306
|
* an artefact of borrowing the CRUD list.
|
|
307
307
|
*/
|
|
308
|
+
/**
|
|
309
|
+
* A short-lived link to play one camera's recording for a past window
|
|
310
|
+
* (at most 30 minutes): `{ playerUrl, streamUrl, start, end, expiresAt }`.
|
|
311
|
+
* Site reach and `cctv-mgmt:view-recordings` are checked by the server.
|
|
312
|
+
*/
|
|
313
|
+
async function getCameraPlayback(cameraId: string, start: string, end: string) {
|
|
314
|
+
return await useNuxtApp().$api<{
|
|
315
|
+
playerUrl: string;
|
|
316
|
+
streamUrl: string;
|
|
317
|
+
start: string;
|
|
318
|
+
end: string;
|
|
319
|
+
expiresAt: string;
|
|
320
|
+
}>(`/api/site-cameras/id/${cameraId}/playback`, {
|
|
321
|
+
method: "GET",
|
|
322
|
+
query: { start, end },
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
|
|
308
326
|
async function getSiteWall(siteId: string) {
|
|
309
327
|
return await useNuxtApp().$api<Record<string, any>>(
|
|
310
328
|
`/api/site-cameras/site/${siteId}/wall`,
|
|
@@ -403,6 +421,7 @@ export default function () {
|
|
|
403
421
|
}
|
|
404
422
|
|
|
405
423
|
return {
|
|
424
|
+
getCameraPlayback,
|
|
406
425
|
getSiteById,
|
|
407
426
|
getSiteLevels,
|
|
408
427
|
getSiteUnits,
|
package/composables/useUser.ts
CHANGED
|
@@ -23,7 +23,8 @@ export default function useUser() {
|
|
|
23
23
|
site = '',
|
|
24
24
|
siteName = '',
|
|
25
25
|
modules,
|
|
26
|
-
permissions
|
|
26
|
+
permissions,
|
|
27
|
+
residentAppModules
|
|
27
28
|
}: {
|
|
28
29
|
email?: string
|
|
29
30
|
app?: string[]
|
|
@@ -36,6 +37,8 @@ export default function useUser() {
|
|
|
36
37
|
modules?: string[]
|
|
37
38
|
/** That client owner's permissions in the application (with modules only). */
|
|
38
39
|
permissions?: string[]
|
|
40
|
+
/** A Property Management client's Service365 resident app switches (with modules only). */
|
|
41
|
+
residentAppModules?: Record<string, boolean>
|
|
39
42
|
} = {}) {
|
|
40
43
|
return useNuxtApp().$api<Record<string, any>>('/api/auth/invite/user', {
|
|
41
44
|
method: 'POST',
|
|
@@ -48,7 +51,8 @@ export default function useUser() {
|
|
|
48
51
|
...(site && { siteId: site }),
|
|
49
52
|
...(siteName && { siteName }),
|
|
50
53
|
...(modules && { modules }),
|
|
51
|
-
...(permissions && { permissions })
|
|
54
|
+
...(permissions && { permissions }),
|
|
55
|
+
...(residentAppModules && { residentAppModules })
|
|
52
56
|
}
|
|
53
57
|
})
|
|
54
58
|
}
|
package/constants/permissions.ts
CHANGED
|
@@ -332,7 +332,7 @@ export const PERMISSIONS = {
|
|
|
332
332
|
],
|
|
333
333
|
// Owner answer Q9, 2026-09-11: seeing the CCTV wall. Distinct from
|
|
334
334
|
// `site-settings:manage-cctv-camera`, which is camera setup.
|
|
335
|
-
"cctv-mgmt": ["see-all-cctv"],
|
|
335
|
+
"cctv-mgmt": ["see-all-cctv", "view-recordings"],
|
|
336
336
|
"billing-mgmt": [
|
|
337
337
|
"see-all-billing-summary",
|
|
338
338
|
"see-all-billing-items",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.
|
|
5
|
+
"version": "4.15.0",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
package/utils/camera-wall.ts
CHANGED
|
@@ -413,6 +413,8 @@ export const CAPABILITY_NEXT_STEPS: Record<string, string> = {
|
|
|
413
413
|
"Not switchable from this page. This one moves real hardware, so a Seven365 backend lead has to approve it before it is turned on in the server's configuration.",
|
|
414
414
|
"device-no-ptz":
|
|
415
415
|
"This camera cannot move, so there is nothing to switch on. A different camera would be needed.",
|
|
416
|
+
"relay-playback-not-configured":
|
|
417
|
+
"Not switchable from this page. Recorded footage is turned on per video service in the server's configuration — your Seven365 administrator sets it up.",
|
|
416
418
|
"no-recorder-configured":
|
|
417
419
|
"Not switchable from this page. This camera's video service has no recorder linked to it in the server's configuration — your Seven365 administrator adds it.",
|
|
418
420
|
"no-channel-in-address":
|
|
@@ -461,7 +463,7 @@ export const WALL_CAPABILITY_CONTROLS = [
|
|
|
461
463
|
{
|
|
462
464
|
key: "playback",
|
|
463
465
|
title: "Recorded footage",
|
|
464
|
-
ready: "
|
|
466
|
+
ready: "Pick a date, a start time and how long, then press Play to watch what this camera recorded.",
|
|
465
467
|
},
|
|
466
468
|
{
|
|
467
469
|
key: "events",
|
|
@@ -1044,3 +1046,47 @@ export function clampPan(
|
|
|
1044
1046
|
export function zoomStep(scale: number, deltaY: number): number {
|
|
1045
1047
|
return clampZoom(deltaY < 0 ? scale * 1.25 : scale / 1.25);
|
|
1046
1048
|
}
|
|
1049
|
+
|
|
1050
|
+
/* ------------------------------------------------------- recorded footage */
|
|
1051
|
+
|
|
1052
|
+
/** The lengths a person can pick. The server allows at most 30 minutes. */
|
|
1053
|
+
export const PLAYBACK_MINUTES = [5, 10, 15, 30] as const;
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* A `datetime-local` value (the viewer's own clock) plus a length, as the
|
|
1057
|
+
* window the server is asked for — or the sentence saying why not.
|
|
1058
|
+
*/
|
|
1059
|
+
export function playbackWindow(
|
|
1060
|
+
localStart: string,
|
|
1061
|
+
minutes: number,
|
|
1062
|
+
now: Date = new Date()
|
|
1063
|
+
): { start: string; end: string } | { error: string } {
|
|
1064
|
+
const start = localStart ? new Date(localStart) : null;
|
|
1065
|
+
if (!start || Number.isNaN(start.getTime())) {
|
|
1066
|
+
return { error: "Pick the date and time to start from." };
|
|
1067
|
+
}
|
|
1068
|
+
if (!PLAYBACK_MINUTES.includes(minutes as (typeof PLAYBACK_MINUTES)[number])) {
|
|
1069
|
+
return { error: "Pick how long to watch." };
|
|
1070
|
+
}
|
|
1071
|
+
const end = new Date(start.getTime() + minutes * 60_000);
|
|
1072
|
+
if (end.getTime() > now.getTime()) {
|
|
1073
|
+
return {
|
|
1074
|
+
error: "That time has not finished recording yet. Pick an earlier start, or a shorter length.",
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
return { start: start.toISOString(), end: end.toISOString() };
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/** What to tell the person when the server refuses a recording. */
|
|
1081
|
+
export function playbackErrorMessage(error: unknown): string {
|
|
1082
|
+
const e = error as { statusCode?: number; status?: number; data?: { message?: string } } | null;
|
|
1083
|
+
const status = e?.statusCode ?? e?.status ?? 0;
|
|
1084
|
+
const said = e?.data?.message?.trim();
|
|
1085
|
+
if (status === 401) return "Your session has ended. Sign in again to watch recorded footage.";
|
|
1086
|
+
if (status === 403) return said || "You do not have permission to watch recorded footage.";
|
|
1087
|
+
if (status === 404) return "This camera is not available to you.";
|
|
1088
|
+
if (status === 409) return said || "Recorded footage is not set up for this camera yet.";
|
|
1089
|
+
if (status === 429) return "Too many requests. Wait a minute and try again.";
|
|
1090
|
+
if (status === 400 && said) return said;
|
|
1091
|
+
return "The recording could not be opened. Try again in a moment.";
|
|
1092
|
+
}
|
|
@@ -34,6 +34,43 @@ export const NATURE_APPLICATIONS: Readonly<Record<string, readonly string[]>> =
|
|
|
34
34
|
real_estate_developer: ["property-management"],
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* THE SERVICE365 RESIDENT APP'S MODULES (owner, 2026-09-12: *"for the property
|
|
39
|
+
* management they must have their modules and the Service365 modules"*;
|
|
40
|
+
* 2026-09-15: *"once I choose the Property Management during the invitation of
|
|
41
|
+
* Client the Roles and Modules for Service365 Mobile app is not included"*).
|
|
42
|
+
*
|
|
43
|
+
* The switches `organizations.residentAppModules` stores (core `site.model.ts
|
|
44
|
+
* residentAppModuleKeys`), labelled as the resident sees the tiles. The Client
|
|
45
|
+
* details card (`web-app-org pages/super-admin/client-details.vue`) saves the
|
|
46
|
+
* same object; both read this list.
|
|
47
|
+
*/
|
|
48
|
+
export const RESIDENT_APP_MODULES: readonly { value: string; label: string }[] = Object.freeze([
|
|
49
|
+
{ value: "feedback", label: "Feedback" },
|
|
50
|
+
{ value: "bulletin", label: "Bulletin" },
|
|
51
|
+
{ value: "bulletinVideos", label: "Bulletin videos" },
|
|
52
|
+
{ value: "inviteVisitors", label: "Invite visitors" },
|
|
53
|
+
{ value: "myVisitors", label: "My visitors" },
|
|
54
|
+
{ value: "billingAndSoa", label: "Billing and SOA" },
|
|
55
|
+
{ value: "access", label: "Access" },
|
|
56
|
+
{ value: "facilityBooking", label: "Facility booking" },
|
|
57
|
+
{ value: "onlineForm", label: "Online form" },
|
|
58
|
+
{ value: "emergencyContact", label: "Emergency contact" },
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
/** Does a new client of this nature get the Service365 resident app? */
|
|
62
|
+
export function inviteIncludesResidentApp(nature: string): boolean {
|
|
63
|
+
return Object.hasOwn(NATURE_APPLICATIONS, nature) && NATURE_APPLICATIONS[nature].includes("property-management");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The object to send: every switch explicit, `true` when ticked. Absent means
|
|
68
|
+
* on to the server, so a partial object could never turn a switch off again.
|
|
69
|
+
*/
|
|
70
|
+
export function inviteResidentAppModules(ticked: readonly string[]): Record<string, boolean> {
|
|
71
|
+
return Object.fromEntries(RESIDENT_APP_MODULES.map(({ value }) => [value, ticked.includes(value)]));
|
|
72
|
+
}
|
|
73
|
+
|
|
37
74
|
export type ModuleGroup = { key: string; label: string; modules: string[] };
|
|
38
75
|
|
|
39
76
|
/**
|