@7365admin1/layer-common 4.9.1-staging.310 → 4.10.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 +20 -4
- package/components/CameraForm.vue +3 -460
- package/components/CameraMain.vue +1 -118
- package/components/EntryPass/QrTemplatePreview.vue +25 -21
- package/components/Facility/BookingSetup.vue +0 -63
- package/components/HidIntercomManagement.vue +43 -193
- package/components/HidReaderUserRoster.vue +2 -32
- package/components/HidUserEnrollment.vue +212 -771
- package/components/InvitationClientForm.vue +1 -19
- package/components/RolePermissionMain.vue +2 -7
- package/components/VehicleForm.vue +3 -11
- package/components/VisitorManagement.vue +5 -267
- package/composables/useFacility.ts +0 -11
- package/composables/useHidAmico.ts +0 -97
- package/composables/useHidNavigation.ts +1 -25
- package/composables/usePeople.ts +0 -19
- package/composables/useSiteSettings.ts +2 -114
- package/composables/useWebUsb.ts +11 -14
- package/package.json +1 -1
- package/plugins/secure-member.client.ts +2 -8
- package/types/facility.d.ts +0 -4
- package/types/people.d.ts +1 -4
- package/utils/materialSymbols.ts +0 -3
- package/utils/org-modules.ts +0 -26
- package/components/CameraPlateSyncDialog.vue +0 -626
- package/components/HidProfileQrCode.vue +0 -323
- package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +0 -23
- package/utils/anpr-direction.ts +0 -70
- package/utils/camera-plate-sync.ts +0 -141
|
@@ -48,22 +48,7 @@ export default function () {
|
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
|
-
async function addCamera(
|
|
52
|
-
camera: TSiteCamera &
|
|
53
|
-
TCameraByRecorder & {
|
|
54
|
-
/**
|
|
55
|
-
* Clear the new ANPR camera's allowed list and blocklist on the device
|
|
56
|
-
* before the site's vehicles are added. Absent means keep them.
|
|
57
|
-
*/
|
|
58
|
-
clearCameraLists?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* The add-camera screen has already cleared and filled the camera
|
|
61
|
-
* itself (`clearNewCamera` / `addNewCameraPlate`), so saving must not
|
|
62
|
-
* touch the device again.
|
|
63
|
-
*/
|
|
64
|
-
skipPlateSync?: boolean;
|
|
65
|
-
}
|
|
66
|
-
) {
|
|
51
|
+
async function addCamera(camera: TSiteCamera & TCameraByRecorder) {
|
|
67
52
|
return await useNuxtApp().$api<Record<string, any>>(`/api/site-cameras`, {
|
|
68
53
|
method: "POST",
|
|
69
54
|
body: camera,
|
|
@@ -100,83 +85,6 @@ export default function () {
|
|
|
100
85
|
* Try an address before saving it. Read-only, and it runs on the server —
|
|
101
86
|
* the browser never touches a recorder and never sees a credential.
|
|
102
87
|
*/
|
|
103
|
-
/* ---- filling a NEW ANPR camera, before it is saved ---- */
|
|
104
|
-
|
|
105
|
-
type TNewCameraDevice = {
|
|
106
|
-
host: string;
|
|
107
|
-
username: string;
|
|
108
|
-
password: string;
|
|
109
|
-
name?: string;
|
|
110
|
-
direction: string;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
/** The plates a new camera of this type receives, blocked ones first. */
|
|
114
|
-
async function getNewCameraPlates(
|
|
115
|
-
siteId: string,
|
|
116
|
-
query: { host: string; direction: string }
|
|
117
|
-
) {
|
|
118
|
-
return await useNuxtApp().$api<{ items: Array<Record<string, any>> }>(
|
|
119
|
-
`/api/site-cameras/site/${siteId}/new-camera/plates`,
|
|
120
|
-
{ method: "GET", query }
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/** Empty the new camera's allowed list and blocklist on the device. */
|
|
125
|
-
async function clearNewCamera(siteId: string, device: TNewCameraDevice) {
|
|
126
|
-
return await useNuxtApp().$api<Record<string, any>>(
|
|
127
|
-
`/api/site-cameras/site/${siteId}/new-camera/clear`,
|
|
128
|
-
{ method: "POST", body: device }
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Write ONE vehicle's plate to the new camera. Answers `{ ok: false, reason,
|
|
134
|
-
* kind }` when the camera refuses it.
|
|
135
|
-
*/
|
|
136
|
-
async function addNewCameraPlate(
|
|
137
|
-
siteId: string,
|
|
138
|
-
device: TNewCameraDevice,
|
|
139
|
-
plate: { vehicle: string; list: "allowed" | "blocked"; onlyIfMissing?: boolean }
|
|
140
|
-
) {
|
|
141
|
-
return await useNuxtApp().$api<{ ok: boolean; reason?: string; kind?: string }>(
|
|
142
|
-
`/api/site-cameras/site/${siteId}/new-camera/plate`,
|
|
143
|
-
{ method: "POST", body: { ...device, ...plate } }
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/* ---- "Sync vehicles": filling a camera that is already saved ---- */
|
|
148
|
-
|
|
149
|
-
/** The plates this saved camera receives, blocked ones first. */
|
|
150
|
-
async function getCameraPlates(cameraId: string) {
|
|
151
|
-
return await useNuxtApp().$api<{ items: Array<Record<string, any>> }>(
|
|
152
|
-
`/api/site-cameras/id/${cameraId}/plates`,
|
|
153
|
-
{ method: "GET" }
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** Empty the saved camera's allowed list and blocklist on the device. */
|
|
158
|
-
async function clearCamera(cameraId: string) {
|
|
159
|
-
return await useNuxtApp().$api<Record<string, any>>(
|
|
160
|
-
`/api/site-cameras/id/${cameraId}/clear`,
|
|
161
|
-
{ method: "POST" }
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Write ONE vehicle's plate to the saved camera. The server uses the
|
|
167
|
-
* camera's stored login. Answers `{ ok: false, reason, kind }` when the
|
|
168
|
-
* camera refuses it.
|
|
169
|
-
*/
|
|
170
|
-
async function addCameraPlate(
|
|
171
|
-
cameraId: string,
|
|
172
|
-
plate: { vehicle: string; list: "allowed" | "blocked"; onlyIfMissing?: boolean }
|
|
173
|
-
) {
|
|
174
|
-
return await useNuxtApp().$api<{ ok: boolean; reason?: string; kind?: string }>(
|
|
175
|
-
`/api/site-cameras/id/${cameraId}/plate`,
|
|
176
|
-
{ method: "POST", body: plate }
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
88
|
async function testSiteCamera(
|
|
181
89
|
siteId: string,
|
|
182
90
|
payload: { host?: string } & TCameraByRecorder
|
|
@@ -204,21 +112,7 @@ export default function () {
|
|
|
204
112
|
| "status"
|
|
205
113
|
>
|
|
206
114
|
> &
|
|
207
|
-
TCameraByRecorder
|
|
208
|
-
/**
|
|
209
|
-
* The person confirmed that this type change clears the camera's
|
|
210
|
-
* plate lists on the camera itself (to Exit: allowed list and
|
|
211
|
-
* blocklist; Entry / Both / Residents to Visitors: allowed list).
|
|
212
|
-
* Without it the API refuses that change.
|
|
213
|
-
*/
|
|
214
|
-
confirmClearCameraLists?: boolean;
|
|
215
|
-
/**
|
|
216
|
-
* Save a type change that would fill the camera (to Entry / Both /
|
|
217
|
-
* Residents, or Exit to Visitors) without filling it: the vehicles
|
|
218
|
-
* are added afterwards with "Sync vehicles", or not now.
|
|
219
|
-
*/
|
|
220
|
-
skipPlateSync?: boolean;
|
|
221
|
-
}
|
|
115
|
+
TCameraByRecorder
|
|
222
116
|
) {
|
|
223
117
|
return await useNuxtApp().$api<Record<string, any>>(
|
|
224
118
|
`/api/site-cameras/id/${id}`,
|
|
@@ -409,12 +303,6 @@ export default function () {
|
|
|
409
303
|
updateSite,
|
|
410
304
|
addCamera,
|
|
411
305
|
testSiteCamera,
|
|
412
|
-
getNewCameraPlates,
|
|
413
|
-
clearNewCamera,
|
|
414
|
-
addNewCameraPlate,
|
|
415
|
-
getCameraPlates,
|
|
416
|
-
clearCamera,
|
|
417
|
-
addCameraPlate,
|
|
418
306
|
getAllSiteCameras,
|
|
419
307
|
bulkImportSiteCameras,
|
|
420
308
|
getSiteWall,
|
package/composables/useWebUsb.ts
CHANGED
|
@@ -345,19 +345,16 @@ export default function useWebUsb() {
|
|
|
345
345
|
70,
|
|
346
346
|
);
|
|
347
347
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
// Generated at the size it is drawn at: the old corner copies were
|
|
353
|
-
// downscaled from the 250px canvas, which softened their modules.
|
|
354
|
-
const qrSize = 350;
|
|
355
|
-
const qrCanvas = await QRCode.toCanvas(qrUrlImage, {
|
|
356
|
-
width: qrSize,
|
|
357
|
-
margin: 1,
|
|
358
|
-
});
|
|
348
|
+
const qrSmall = 140;
|
|
349
|
+
const qrCenter = 250;
|
|
350
|
+
const margin = 20;
|
|
351
|
+
const qrCanvas = await QRCode.toCanvas(qrUrlImage, { width: qrCenter });
|
|
359
352
|
|
|
360
|
-
ctx.drawImage(qrCanvas,
|
|
353
|
+
ctx.drawImage(qrCanvas, margin, 90, qrSmall, qrSmall);
|
|
354
|
+
ctx.drawImage(qrCanvas, canvas.width - qrSmall - margin, 90, qrSmall, qrSmall);
|
|
355
|
+
ctx.drawImage(qrCanvas, (canvas.width - qrCenter) / 2, 110, qrCenter, qrCenter);
|
|
356
|
+
ctx.drawImage(qrCanvas, margin, 300, qrSmall, qrSmall);
|
|
357
|
+
ctx.drawImage(qrCanvas, canvas.width - qrSmall - margin, 300, qrSmall, qrSmall);
|
|
361
358
|
|
|
362
359
|
ctx.font = "25px Arial";
|
|
363
360
|
ctx.fillText(companyName || "", canvas.width / 2, 470);
|
|
@@ -404,8 +401,8 @@ export default function useWebUsb() {
|
|
|
404
401
|
/**
|
|
405
402
|
* The self-service onboarding QR: one large QR code, a "SCAN QR CODE"-style
|
|
406
403
|
* subtext, and a dark site-name banner along the bottom - a single-purpose
|
|
407
|
-
* gate sign, not the visitor-pass receipt `createReceiptLayout`
|
|
408
|
-
* (that one
|
|
404
|
+
* gate sign, not the multi-copy visitor-pass receipt `createReceiptLayout`
|
|
405
|
+
* produces (that one prints several QRs to be cut apart and handed out).
|
|
409
406
|
*/
|
|
410
407
|
async function createOnboardingQrLayout(
|
|
411
408
|
qrUrlImage: string,
|
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.10.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.",
|
|
@@ -130,14 +130,8 @@ export default defineNuxtPlugin(() => {
|
|
|
130
130
|
// A page of a module Seven365 did not give this client goes to the site's
|
|
131
131
|
// dashboard, which is never governed. Every governed route is an
|
|
132
132
|
// `org-site-*` page, so both params are there. Unmapped routes pass.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
// governed, but they have no site dashboard to send anyone to. There the
|
|
136
|
-
// page is left open (fail open) rather than sent to a page that does not
|
|
137
|
-
// exist. A PATH, not a route name, because those apps' route-names tests
|
|
138
|
-
// reject a literal name they cannot resolve.
|
|
139
|
-
if (routeDenied(to.name, userAppModulesDenied.value) && router.hasRoute("org-site-dashboard")) {
|
|
140
|
-
return `/${to.params.org}/${to.params.site}/dashboard`;
|
|
133
|
+
if (routeDenied(to.name, userAppModulesDenied.value)) {
|
|
134
|
+
return { name: "org-site-dashboard", params: { org: to.params.org, site: to.params.site } };
|
|
141
135
|
}
|
|
142
136
|
|
|
143
137
|
const isMember = to.meta?.memberOnly;
|
package/types/facility.d.ts
CHANGED
|
@@ -73,10 +73,6 @@ declare type TFacility = {
|
|
|
73
73
|
hourInterval?: number;
|
|
74
74
|
isBookingFeeEnabled: boolean;
|
|
75
75
|
isGuestEnabled: boolean;
|
|
76
|
-
/** Residents may complete this facility's checklist themselves. */
|
|
77
|
-
isResidentChecklistEnabled?: boolean;
|
|
78
|
-
/** Security may complete it. Mutually exclusive with the above. */
|
|
79
|
-
isSecurityChecklistEnabled?: boolean;
|
|
80
76
|
bookingAmount: number | null;
|
|
81
77
|
peakBookingFeeAmount?: number | null;
|
|
82
78
|
bookingFeeGuestAmount?: number | null;
|
package/types/people.d.ts
CHANGED
|
@@ -22,14 +22,11 @@ declare type TPeople = {
|
|
|
22
22
|
email?: string;
|
|
23
23
|
files?: { name: string, id: string }[];
|
|
24
24
|
isOwner?: boolean;
|
|
25
|
-
// Link to this person's `users` row. Empty for the person types that carry
|
|
26
|
-
// no login, and empty for a resident whose account was never written.
|
|
27
|
-
user?: string;
|
|
28
25
|
};
|
|
29
26
|
|
|
30
27
|
declare type TPlateNumber = { plateNumber: string, recNo: string, _id?: string, status: "active" | "deleted" | "pending", type: TVehicleType };
|
|
31
28
|
|
|
32
29
|
|
|
33
|
-
declare type TPeoplePayload = Pick<TGuest, "name" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "nric" | "contact" | "remarks" | "org" | "site" | "start" | "end" | "type" | "isOwner"> & { status?: string
|
|
30
|
+
declare type TPeoplePayload = Pick<TGuest, "name" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "nric" | "contact" | "remarks" | "org" | "site" | "start" | "end" | "type" | "isOwner"> & { status?: string }
|
|
34
31
|
|
|
35
32
|
declare type TPeopleType = "guest" | "resident" | "tenant"
|
package/utils/materialSymbols.ts
CHANGED
|
@@ -242,9 +242,6 @@ export const MDI_TO_SYMBOL: Record<string, string> = {
|
|
|
242
242
|
"mdi-link-variant": "link",
|
|
243
243
|
"mdi-lan-connect": "lan",
|
|
244
244
|
"mdi-lan-disconnect": "link_off", // NEAREST: no disconnected-LAN glyph
|
|
245
|
-
"mdi-lan-check": "network_check",
|
|
246
|
-
"mdi-dialpad": "dialpad",
|
|
247
|
-
"mdi-headset": "headset_mic",
|
|
248
245
|
"mdi-bluetooth": "bluetooth",
|
|
249
246
|
"mdi-nfc": "nfc",
|
|
250
247
|
|
package/utils/org-modules.ts
CHANGED
|
@@ -187,32 +187,6 @@ export function effectiveModules(
|
|
|
187
187
|
return allowed.length ? allowed : org;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
/**
|
|
191
|
-
* The site tier, but only for the organisation that OWNS the site.
|
|
192
|
-
*
|
|
193
|
-
* Owner Q1, 2026-09-11: a service provider's role editor follows the
|
|
194
|
-
* PROVIDER's own company modules, never the client's. A provider editing
|
|
195
|
-
* roles while working on a client's site passes that site's id, and the site
|
|
196
|
-
* list there is what the CLIENT chose for its own staff - so it must not
|
|
197
|
-
* narrow the provider. Only when the site belongs to the organisation whose
|
|
198
|
-
* roles are being edited does the site tier apply.
|
|
199
|
-
*
|
|
200
|
-
* Fails open: no site, no `orgId` on it, or no org to compare with all mean
|
|
201
|
-
* "no site tier", which leaves the organisation's own list in charge.
|
|
202
|
-
*/
|
|
203
|
-
export function siteModulesForOrg(
|
|
204
|
-
site: { orgId?: unknown; org?: unknown; metadata?: { modules?: unknown } } | null | undefined,
|
|
205
|
-
orgId: unknown,
|
|
206
|
-
): readonly string[] | undefined {
|
|
207
|
-
// `org` is the legacy field name; core reads `orgId ?? org` the same way.
|
|
208
|
-
const siteOrg = String(site?.orgId ?? site?.org ?? "");
|
|
209
|
-
const org = String(orgId ?? "");
|
|
210
|
-
if (!siteOrg || !org || siteOrg !== org) return undefined;
|
|
211
|
-
|
|
212
|
-
const modules = site?.metadata?.modules;
|
|
213
|
-
return Array.isArray(modules) ? modules : undefined;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
190
|
function isKey(value: unknown): value is string {
|
|
217
191
|
return typeof value === "string" && value.trim().length > 0;
|
|
218
192
|
}
|