@7365admin1/layer-common 4.11.1-staging.315 → 4.12.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.
@@ -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;
@@ -182,36 +166,6 @@ export default function useHidAmico() {
182
166
  });
183
167
  }
184
168
 
185
- /**
186
- * The signed-in member's own QR code on one reader.
187
- *
188
- * No user id in the path: the server takes the caller from the session, so
189
- * these cannot be pointed at somebody else. `assigned` in the response says
190
- * whether the HID permissions screen actually admits this member to the
191
- * reader - issuing a code does not grant access, and the screen has to be
192
- * able to say so.
193
- */
194
- function getProfileQr(readerId: string) {
195
- return useNuxtApp().$api<{ data: HidProfileQr }>(
196
- `${basePath}/readers/${readerId}/profile-qr`,
197
- { method: "GET" },
198
- );
199
- }
200
-
201
- function issueProfileQr(readerId: string) {
202
- return useNuxtApp().$api<{ data: HidProfileQr }>(
203
- `${basePath}/readers/${readerId}/profile-qr`,
204
- { method: "POST" },
205
- );
206
- }
207
-
208
- function deleteProfileQr(readerId: string) {
209
- return useNuxtApp().$api<{ data: HidProfileQr }>(
210
- `${basePath}/readers/${readerId}/profile-qr`,
211
- { method: "DELETE" },
212
- );
213
- }
214
-
215
169
  function createReader(payload: HidReaderPayload) {
216
170
  return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers`, {
217
171
  method: "POST",
@@ -460,27 +414,6 @@ export default function useHidAmico() {
460
414
  );
461
415
  }
462
416
 
463
- function getUserPasswordStatus(readerId: string, hidUserId: string | number) {
464
- return useNuxtApp().$api<HidApiRecord>(
465
- `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
466
- { method: "GET" },
467
- );
468
- }
469
-
470
- function setUserPassword(readerId: string, hidUserId: string | number, password: string) {
471
- return useNuxtApp().$api<HidApiRecord>(
472
- `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
473
- { method: "PUT", body: { password } },
474
- );
475
- }
476
-
477
- function deleteUserPassword(readerId: string, hidUserId: string | number) {
478
- return useNuxtApp().$api<HidApiRecord>(
479
- `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
480
- { method: "DELETE" },
481
- );
482
- }
483
-
484
417
  function deleteUserPin(readerId: string, hidUserId: string | number) {
485
418
  return useNuxtApp().$api<{ data: { pinEnrolled: boolean } }>(
486
419
  `${basePath}/readers/${readerId}/users/${hidUserId}/pin`,
@@ -541,29 +474,6 @@ export default function useHidAmico() {
541
474
  );
542
475
  }
543
476
 
544
- /**
545
- * Wake the resident's phone for a call the web phone has just placed.
546
- *
547
- * The SIP INVITE is the call and travels over the WebSocket, not through the
548
- * API; this only rings the resident's mobile so somebody is there to answer
549
- * it. It is therefore fired after the INVITE and never awaited in a way that
550
- * could fail the call — see `startWebCall` in `HidIntercomManagement.vue`.
551
- *
552
- * `notified: false` with a reason is a normal response, not an error: staff
553
- * extensions and external SIP addresses have no resident behind them.
554
- */
555
- function notifyIntercomCall(
556
- siteId: string,
557
- payload: { orgId: string; destination: string; callId: string; readerId?: string },
558
- ) {
559
- return useNuxtApp().$api<{
560
- data: { notified: boolean; delivered?: number; reason?: string };
561
- }>(
562
- `${basePath}/sites/${siteId}/intercom/notify-call`,
563
- { method: "POST", body: payload },
564
- );
565
- }
566
-
567
477
  function getPermissionCandidates(
568
478
  siteId: string,
569
479
  query: {
@@ -595,9 +505,6 @@ export default function useHidAmico() {
595
505
 
596
506
  return {
597
507
  getReaders,
598
- getProfileQr,
599
- issueProfileQr,
600
- deleteProfileQr,
601
508
  discoverReader,
602
509
  createReader,
603
510
  updateReader,
@@ -623,9 +530,6 @@ export default function useHidAmico() {
623
530
  getUserPinStatus,
624
531
  setUserPin,
625
532
  deleteUserPin,
626
- getUserPasswordStatus,
627
- setUserPassword,
628
- deleteUserPassword,
629
533
  getIdentities,
630
534
  getReaderUsers,
631
535
  getReaderAccessLogs,
@@ -636,7 +540,6 @@ export default function useHidAmico() {
636
540
  makeIntercomCall,
637
541
  finalizeIntercomCall,
638
542
  ensureSipAccount,
639
- notifyIntercomCall,
640
543
  getSitePermissions,
641
544
  getPermissionCandidates,
642
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,
@@ -21,7 +21,8 @@ export default function useUser() {
21
21
  name = '',
22
22
  org = '',
23
23
  site = '',
24
- siteName = ''
24
+ siteName = '',
25
+ modules
25
26
  }: {
26
27
  email?: string
27
28
  app?: string[]
@@ -30,6 +31,8 @@ export default function useUser() {
30
31
  org?: string
31
32
  site?: string
32
33
  siteName?: string
34
+ /** A new client's modules (Seven365 staff only). */
35
+ modules?: string[]
33
36
  } = {}) {
34
37
  return useNuxtApp().$api<Record<string, any>>('/api/auth/invite/user', {
35
38
  method: 'POST',
@@ -40,7 +43,8 @@ export default function useUser() {
40
43
  name,
41
44
  org,
42
45
  ...(site && { siteId: site }),
43
- ...(siteName && { siteName })
46
+ ...(siteName && { siteName }),
47
+ ...(modules && { modules })
44
48
  }
45
49
  })
46
50
  }
@@ -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.11.1-staging.315",
5
+ "version": "4.12.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.",
@@ -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,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; user?: 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"
@@ -0,0 +1,56 @@
1
+ import { PERMISSIONS } from "../constants/permissions";
2
+ import { applicationModules, groupModulesByApplication } from "./module-applications";
3
+
4
+ /**
5
+ * THE MODULES A NEW CLIENT IS OFFERED ON "INVITE CLIENT".
6
+ *
7
+ * Owner, 2026-09-14: *"Client Owner Super Admin can only have the full access on
8
+ * what Seven365 Super Admin given to them, same goes to the modules that they
9
+ * can access."* So the Super Admin chooses the modules when inviting, and the
10
+ * server enforces that list from the day the client is created.
11
+ *
12
+ * The same catalogue and the same narrowing as the Client details card
13
+ * (`web-app-org pages/super-admin/client-details.vue` + `utils/module-nature.js`):
14
+ * the flat catalogue plus every application's modules, grouped by application,
15
+ * then only the applications that go with the client's nature, plus the modules
16
+ * no application claims (`sites`, `customers`, ...). A client created here and
17
+ * opened on that card shows exactly what was ticked.
18
+ */
19
+
20
+ /**
21
+ * Nature of business -> the application groups that client is offered.
22
+ * Mirrors `web-app-org utils/module-nature.js NATURE_APPLICATIONS` (owner,
23
+ * 2026-09-12); `test/client-invite-modules.test.mjs` pins the pairs.
24
+ */
25
+ export const NATURE_APPLICATIONS: Readonly<Record<string, readonly string[]>> = Object.freeze({
26
+ security_agency: ["security"],
27
+ cleaning_services: ["cleaning"],
28
+ pest_control_services: ["pest"],
29
+ mechanical_electrical_services: ["mechanical-electrical"],
30
+ landscaping_services: ["landscape"],
31
+ pool_maintenance_services: ["pool"],
32
+ property_management_agency: ["property-management"],
33
+ real_estate_developer: ["property-management"],
34
+ });
35
+
36
+ export type ModuleGroup = { key: string; label: string; modules: string[] };
37
+
38
+ /**
39
+ * The groups to offer for a new client of `nature`, every module in them ticked
40
+ * by default. An unknown nature is offered everything, like the card.
41
+ */
42
+ export function inviteModuleGroups(nature: string): ModuleGroup[] {
43
+ const keys = [
44
+ ...new Set([
45
+ ...Object.keys(PERMISSIONS),
46
+ ...applicationModules().flatMap((application) => application.modules),
47
+ ]),
48
+ ];
49
+ const { groups, ungrouped } = groupModulesByApplication(keys);
50
+ const applications = Object.hasOwn(NATURE_APPLICATIONS, nature) ? NATURE_APPLICATIONS[nature] : null;
51
+
52
+ const shown = applications ? groups.filter((group) => applications.includes(group.key)) : groups;
53
+ return ungrouped.length
54
+ ? [...shown, { key: "other", label: "Not tied to a service application", modules: ungrouped }]
55
+ : shown;
56
+ }
@@ -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