@7365admin1/layer-common 4.34.1-staging.368 → 4.35.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +47 -4
  2. package/assets/css/robot-hero.css +8 -8
  3. package/components/AccessCardAddForm.vue +4 -5
  4. package/components/AccessCardAssignToUnitForm.vue +2 -3
  5. package/components/AccessCardPreviewDialog.vue +3 -4
  6. package/components/Dialog/UpdateMoreAction.vue +1 -11
  7. package/components/DocumentForm.vue +112 -407
  8. package/components/DocumentManagement.vue +12 -213
  9. package/components/EntryPass/QrTemplatePreview.vue +25 -21
  10. package/components/EntryPassInformation.vue +24 -119
  11. package/components/Facility/BookingSetup.vue +0 -63
  12. package/components/HidAccessLogDashboard.vue +8 -41
  13. package/components/HidIntercomManagement.vue +14 -148
  14. package/components/HidQrCodeConfiguration.vue +195 -17
  15. package/components/HidReaderManagement.vue +0 -306
  16. package/components/HidReaderUserRoster.vue +3 -44
  17. package/components/HidUserEnrollment.vue +155 -845
  18. package/components/InvitationClientForm.vue +1 -19
  19. package/components/Robot/SiteHeader.vue +5 -6
  20. package/components/Robot/SiteScreen.vue +2 -25
  21. package/components/VisitorForm.vue +0 -12
  22. package/components/VisitorManagement.vue +5 -267
  23. package/composables/useAccessManagement.ts +0 -5
  24. package/composables/useDocument.ts +0 -7
  25. package/composables/useFacility.ts +0 -11
  26. package/composables/useHidAmico.ts +0 -134
  27. package/composables/useHidNavigation.ts +1 -25
  28. package/composables/usePeople.ts +0 -19
  29. package/composables/useRobots.ts +1 -1
  30. package/composables/useSiteEntryPassSettings.ts +0 -26
  31. package/composables/useWebUsb.ts +11 -14
  32. package/package.json +1 -1
  33. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  34. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  35. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  36. package/types/document.d.ts +0 -14
  37. package/types/facility.d.ts +0 -4
  38. package/types/people.d.ts +1 -28
  39. package/components/HidAccessPermissions.vue +0 -424
  40. package/components/HidProfileQrCode.vue +0 -332
  41. package/components/Robot/Bell.vue +0 -21
  42. package/composables/useHidReaderSelection.ts +0 -50
  43. package/composables/useSiteCategory.ts +0 -45
  44. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +0 -23
  45. package/utils/hid-permission-assignments.ts +0 -190
  46. package/utils/hid-reader-selection.ts +0 -52
  47. package/utils/occupancy-role.ts +0 -109
@@ -28,22 +28,6 @@ export type HidReaderPayload = {
28
28
  lastCallbackType?: string;
29
29
  };
30
30
 
31
- export type HidProfileQr = {
32
- readerId: string;
33
- userId: string;
34
- memberId: string;
35
- hidUserId: string;
36
- registration: string;
37
- readerName: string;
38
- portalName: string;
39
- qrEnabled: boolean;
40
- issued: boolean;
41
- qrValue: string;
42
- issuedAt: string;
43
- /** null when the permission lookup itself failed, so "unknown" stays distinct from "no". */
44
- assigned: boolean | null;
45
- };
46
-
47
31
  type HidIdentityPayload = {
48
32
  site?: string;
49
33
  hidUserId?: string | number;
@@ -155,18 +139,6 @@ export type HidSipAccountData = {
155
139
  provisionedAt: string;
156
140
  };
157
141
 
158
- /** One row of the site's SIP account list - who owns the extension, never its password. */
159
- export type HidSipAccountListItem = {
160
- _id: string;
161
- userId: string;
162
- name: string;
163
- email: string;
164
- extension: string;
165
- username: string;
166
- status: string;
167
- provisionedAt: string;
168
- };
169
-
170
142
  /**
171
143
  * True only for the specific validation error an API that predates core #1878
172
144
  * returns when the discover body carries `site`. Deliberately narrow: after
@@ -194,36 +166,6 @@ export default function useHidAmico() {
194
166
  });
195
167
  }
196
168
 
197
- /**
198
- * The signed-in member's own QR code on one reader.
199
- *
200
- * No user id in the path: the server takes the caller from the session, so
201
- * these cannot be pointed at somebody else. `assigned` in the response says
202
- * whether the HID permissions screen actually admits this member to the
203
- * reader - issuing a code does not grant access, and the screen has to be
204
- * able to say so.
205
- */
206
- function getProfileQr(readerId: string) {
207
- return useNuxtApp().$api<{ data: HidProfileQr }>(
208
- `${basePath}/readers/${readerId}/profile-qr`,
209
- { method: "GET" },
210
- );
211
- }
212
-
213
- function issueProfileQr(readerId: string) {
214
- return useNuxtApp().$api<{ data: HidProfileQr }>(
215
- `${basePath}/readers/${readerId}/profile-qr`,
216
- { method: "POST" },
217
- );
218
- }
219
-
220
- function deleteProfileQr(readerId: string) {
221
- return useNuxtApp().$api<{ data: HidProfileQr }>(
222
- `${basePath}/readers/${readerId}/profile-qr`,
223
- { method: "DELETE" },
224
- );
225
- }
226
-
227
169
  function createReader(payload: HidReaderPayload) {
228
170
  return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers`, {
229
171
  method: "POST",
@@ -315,22 +257,6 @@ export default function useHidAmico() {
315
257
  });
316
258
  }
317
259
 
318
- /**
319
- * Which credentials a reader accepts at the door.
320
- *
321
- * Separate from `setReaderConfiguration` on purpose. That one is the generic
322
- * configuration endpoint, gated by an allowlist of writable objects; this is
323
- * a dedicated route that validates the four methods against the reader's own
324
- * `capabilities` and confirms the write by reading the device back, so a
325
- * refusal here names the credential the hardware would not take.
326
- */
327
- function setReaderIdentificationMethods(readerId: string, payload: HidApiRecord) {
328
- return useNuxtApp().$api<HidApiRecord>(
329
- `${basePath}/readers/${readerId}/identification-methods`,
330
- { method: "PUT", body: payload },
331
- );
332
- }
333
-
334
260
  function getIdentities(readerId: string, query: HidApiRecord = {}) {
335
261
  return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers/${readerId}/identities`, {
336
262
  method: "GET",
@@ -488,27 +414,6 @@ export default function useHidAmico() {
488
414
  );
489
415
  }
490
416
 
491
- function getUserPasswordStatus(readerId: string, hidUserId: string | number) {
492
- return useNuxtApp().$api<HidApiRecord>(
493
- `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
494
- { method: "GET" },
495
- );
496
- }
497
-
498
- function setUserPassword(readerId: string, hidUserId: string | number, password: string) {
499
- return useNuxtApp().$api<HidApiRecord>(
500
- `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
501
- { method: "PUT", body: { password } },
502
- );
503
- }
504
-
505
- function deleteUserPassword(readerId: string, hidUserId: string | number) {
506
- return useNuxtApp().$api<HidApiRecord>(
507
- `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
508
- { method: "DELETE" },
509
- );
510
- }
511
-
512
417
  function deleteUserPin(readerId: string, hidUserId: string | number) {
513
418
  return useNuxtApp().$api<{ data: { pinEnrolled: boolean } }>(
514
419
  `${basePath}/readers/${readerId}/users/${hidUserId}/pin`,
@@ -569,36 +474,6 @@ export default function useHidAmico() {
569
474
  );
570
475
  }
571
476
 
572
- function getSipAccounts(siteId: string, orgId: string) {
573
- return useNuxtApp().$api<{ data: HidSipAccountListItem[] }>(
574
- `${basePath}/sites/${siteId}/intercom/sip-accounts`,
575
- { method: "GET", query: { orgId } },
576
- );
577
- }
578
-
579
- /**
580
- * Wake the resident's phone for a call the web phone has just placed.
581
- *
582
- * The SIP INVITE is the call and travels over the WebSocket, not through the
583
- * API; this only rings the resident's mobile so somebody is there to answer
584
- * it. It is therefore fired after the INVITE and never awaited in a way that
585
- * could fail the call — see `startWebCall` in `HidIntercomManagement.vue`.
586
- *
587
- * `notified: false` with a reason is a normal response, not an error: staff
588
- * extensions and external SIP addresses have no resident behind them.
589
- */
590
- function notifyIntercomCall(
591
- siteId: string,
592
- payload: { orgId: string; destination: string; callId: string; readerId?: string },
593
- ) {
594
- return useNuxtApp().$api<{
595
- data: { notified: boolean; delivered?: number; reason?: string };
596
- }>(
597
- `${basePath}/sites/${siteId}/intercom/notify-call`,
598
- { method: "POST", body: payload },
599
- );
600
- }
601
-
602
477
  function getPermissionCandidates(
603
478
  siteId: string,
604
479
  query: {
@@ -630,9 +505,6 @@ export default function useHidAmico() {
630
505
 
631
506
  return {
632
507
  getReaders,
633
- getProfileQr,
634
- issueProfileQr,
635
- deleteProfileQr,
636
508
  discoverReader,
637
509
  createReader,
638
510
  updateReader,
@@ -647,7 +519,6 @@ export default function useHidAmico() {
647
519
  issueVisitorQr,
648
520
  getReaderConfiguration,
649
521
  setReaderConfiguration,
650
- setReaderIdentificationMethods,
651
522
  getLogs,
652
523
  setUserImage,
653
524
  deleteUserImage,
@@ -659,9 +530,6 @@ export default function useHidAmico() {
659
530
  getUserPinStatus,
660
531
  setUserPin,
661
532
  deleteUserPin,
662
- getUserPasswordStatus,
663
- setUserPassword,
664
- deleteUserPassword,
665
533
  getIdentities,
666
534
  getReaderUsers,
667
535
  getReaderAccessLogs,
@@ -672,8 +540,6 @@ export default function useHidAmico() {
672
540
  makeIntercomCall,
673
541
  finalizeIntercomCall,
674
542
  ensureSipAccount,
675
- getSipAccounts,
676
- notifyIntercomCall,
677
543
  getSitePermissions,
678
544
  getPermissionCandidates,
679
545
  updateSitePermissions,
@@ -46,33 +46,9 @@ export default function useHidNavigation() {
46
46
  },
47
47
  },
48
48
  {
49
- // "HID Reader Users" now points at `access-mgmt/administrator`, not at
50
- // `access-mgmt/hid-users`.
51
- //
52
- // Both routes mount a roster of the reader's users, but only this one
53
- // can act on them. `administrator` renders HidUserEnrollment WITHOUT
54
- // `card-management`, and that prop is what gates the Enroll action:
55
- // <template v-if="!props.cardManagement" #actions>
56
- // `hid-users` renders HidReaderUserRoster, which is read-only apart
57
- // from PIN management. So the menu entry with this name used to lead
58
- // to the screen that cannot enrol, while the screen that can was
59
- // reachable only by typing the URL.
60
- //
61
- // `hid-users` is left in place and simply unlisted - the same state
62
- // `administrator` was in - so any existing link to it still resolves.
63
49
  title: "HID Reader Users",
64
50
  route: {
65
- name: "org-site-access-mgmt-administrator",
66
- params: { org, site },
67
- },
68
- },
69
- {
70
- // The signed-in member's own pass, not somebody else's. Every other
71
- // entry in this group acts on a resident or a visitor; this one has
72
- // no subject but the caller.
73
- title: "HID QR Code",
74
- route: {
75
- name: "org-site-access-mgmt-hid-qr-code",
51
+ name: "org-site-access-mgmt-hid-users",
76
52
  params: { org, site },
77
53
  },
78
54
  },
@@ -115,24 +115,6 @@ export default function () {
115
115
  });
116
116
  }
117
117
 
118
- /**
119
- * The blocks, levels and units at a site that actually have an occupant.
120
- * The other half of the unit picker: this narrows the cascade, then
121
- * `getPeopleByUnit` answers "which person in this unit?".
122
- */
123
- async function getOccupiedStructure(
124
- site: string,
125
- { type = "", status = "active", block = "", level = "" } = {}
126
- ) {
127
- return await useNuxtApp().$api<Record<string, any>>(
128
- `/api/people/site/${site}/occupied-structure`,
129
- {
130
- method: "GET",
131
- query: { type, status, block, level },
132
- }
133
- );
134
- }
135
-
136
118
  async function getPeopleByUnit(
137
119
  _id: string,
138
120
  { status = "active", type = "" } = {}
@@ -166,7 +148,6 @@ export default function () {
166
148
  findPersonByPlateNumberMultipleResult,
167
149
  findPersonByContact,
168
150
  getPeopleByUnit,
169
- getOccupiedStructure,
170
151
  searchCompanyList,
171
152
  findUsersByPlateNumber,
172
153
  reviewResidentPerson,
@@ -297,7 +297,7 @@ export default function useRobots() {
297
297
 
298
298
  /**
299
299
  * The site's open faults and robots not reporting (Alerts, README §6),
300
- * faults first, paged; `faults` = real faults only (the header bell).
300
+ * faults first, paged; `faults` = real faults only (robots merely offline are not counted).
301
301
  * Narrowed to this app's robot types.
302
302
  */
303
303
  function getSiteFaults(site: string, { page = 1, limit = 25, type = "" }: { page?: number; limit?: number; type?: string } = {}) {
@@ -27,35 +27,9 @@ export default function useSiteEntryPassSettings() {
27
27
  );
28
28
  }
29
29
 
30
- /**
31
- * The encrypted ACM URL the access-card screens hand to API-core, which
32
- * decrypts it and sends the ACM commands to that host.
33
- *
34
- * Resolves the site's own "Enter entrypass URL" setting first, the way
35
- * `VisitorForm` does for contractor passes. The access-card forms used to
36
- * call `/api/encrypt-acm-url` with no `url`, so every site's door/lift
37
- * levels and access groups came from the route's hardcoded default host
38
- * whatever the site had configured. A site with no URL set, or whose
39
- * settings cannot be read, still gets that default.
40
- */
41
- async function getEncryptedAcmUrl(siteId: string): Promise<string> {
42
- let rawUrl = "";
43
- try {
44
- const settings: any = await getBySiteId(siteId);
45
- rawUrl = String(settings?.data?.settings?.url ?? "").trim();
46
- } catch {
47
- // No entry pass settings for this site yet - the default host applies.
48
- }
49
- const { encrypted } = await $fetch<{ encrypted: string }>(
50
- `/api/encrypt-acm-url${rawUrl ? `?url=${encodeURIComponent(rawUrl)}` : ""}`,
51
- );
52
- return encrypted;
53
- }
54
-
55
30
  return {
56
31
  getBySiteId,
57
32
  getById,
58
33
  save,
59
- getEncryptedAcmUrl,
60
34
  };
61
35
  }
@@ -345,19 +345,16 @@ export default function useWebUsb() {
345
345
  70,
346
346
  );
347
347
 
348
- // The pass used to print five copies of the same QR - four 140px ones at
349
- // the corners around a 250px centre - so a strip could be cut apart. It now
350
- // prints a single large QR filling that same band (y 90 to 440, above the
351
- // company name at y 470), which scans far more reliably on a thermal print.
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, (canvas.width - qrSize) / 2, 90, qrSize, qrSize);
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` produces
408
- * (that one pairs its QR with company, date, access and instruction lines).
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.34.1-staging.368",
5
+ "version": "4.35.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.",
@@ -5,7 +5,7 @@
5
5
  :org="orgId"
6
6
  message="Enable HID as a service for this site before managing HID users."
7
7
  >
8
- <HidUserEnrollment :site="siteId" :org="orgId" />
8
+ <HidUserEnrollment :site="siteId" />
9
9
  </HidEnabledGate>
10
10
  </v-container>
11
11
  </template>
@@ -5,7 +5,7 @@
5
5
  :org="orgId"
6
6
  message="Enable HID as a service for this site before managing physical HID cards."
7
7
  >
8
- <HidUserEnrollment :site="siteId" :org="orgId" card-management />
8
+ <HidUserEnrollment :site="siteId" card-management />
9
9
  </HidEnabledGate>
10
10
  </v-container>
11
11
  </template>
@@ -5,7 +5,7 @@
5
5
  :org="orgId"
6
6
  message="Enable HID as a service for this site before managing HID readers."
7
7
  >
8
- <HidReaderManagement :site="siteId" :org="orgId" />
8
+ <HidReaderManagement :site="siteId" />
9
9
  </HidEnabledGate>
10
10
  </v-container>
11
11
  </template>
@@ -3,18 +3,4 @@ declare type TDocument = {
3
3
  name: string;
4
4
  attachment: string;
5
5
  type: string;
6
- /**
7
- * Set at upload or renewal, absent when the document never expires.
8
- *
9
- * An ISO instant on the way out of the API and a `YYYY-MM-DD` string on the
10
- * way back in, which is what `InputDatePicker` binds to - hence the loose
11
- * type rather than `string`.
12
- */
13
- expiryDate?: string | Date | null;
14
- remarks?: string;
15
- size?: number;
16
- parentId?: string | null;
17
- createdAt?: string | Date;
18
- updatedAt?: string | Date;
19
- status?: string;
20
6
  };
@@ -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,38 +22,11 @@ declare type TPeople = {
22
22
  email?: string;
23
23
  files?: { name: string, id: string }[];
24
24
  isOwner?: boolean;
25
- /**
26
- * Owner / occupant / person-in-charge, as the BUSINESS people form asks it.
27
- * Absent on everyone else - `isOwner` is still the flag that decides unit
28
- * ownership, and the server derives it from this when it is sent. See
29
- * `OccupancyRoles` in core's `person.model.ts`.
30
- */
31
- occupancyRole?: TOccupancyRole;
32
- // Link to this person's `users` row. Empty for the person types that carry
33
- // no login, and empty for a resident whose account was never written.
34
- user?: string;
35
- };
36
-
37
- declare type TOccupancyRole = "owner" | "occupant" | "person-in-charge";
38
-
39
- /** One standing and everything the product says about it. See `utils/occupancy-role.ts`. */
40
- declare type TOccupancyRoleOption = {
41
- value: TOccupancyRole;
42
- /** The label a stored role is printed with. */
43
- title: string;
44
- /** The row menu's wording. */
45
- action: string;
46
- /** The confirmation's heading and its sentence. */
47
- prompt: string;
48
- description: string;
49
25
  };
50
26
 
51
27
  declare type TPlateNumber = { plateNumber: string, recNo?: string, _id?: string, status: TVehicleStatus, type: TVehicleType, anprCameras?: TVehicleAnprCamera[] };
52
28
 
53
29
 
54
- // `""` is the FORM's "nothing picked yet" - it is stripped from the payload
55
- // before it is sent, because absence is what the server reads as "never
56
- // asked". See `PeopleFormMgmt.vue`.
57
- declare type TPeoplePayload = Pick<TGuest, "name" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "nric" | "contact" | "remarks" | "org" | "site" | "start" | "end" | "type" | "isOwner"> & { status?: string; user?: string; occupancyRole?: TOccupancyRole | "" }
30
+ declare type TPeoplePayload = Pick<TGuest, "name" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "nric" | "contact" | "remarks" | "org" | "site" | "start" | "end" | "type" | "isOwner"> & { status?: string }
58
31
 
59
32
  declare type TPeopleType = "guest" | "resident" | "tenant"