@7365admin1/layer-common 4.97.1-staging.543 → 4.97.1-staging.545

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.
@@ -24,6 +24,30 @@
24
24
  class="flex-grow-0 ml-4"
25
25
  />
26
26
  </div>
27
+ <!-- How long an HID visitor pass lasts. Only asked once HID is on. -->
28
+ <v-radio-group
29
+ v-if="option.type === 'hid' && option.isEnabled"
30
+ v-model="option.usage"
31
+ inline
32
+ hide-details
33
+ density="compact"
34
+ color="success"
35
+ class="pb-3"
36
+ >
37
+ <v-radio
38
+ v-for="usage in hidQrUsageOptions"
39
+ :key="usage.value"
40
+ :value="usage.value"
41
+ class="mr-6"
42
+ >
43
+ <template #label>
44
+ <div>
45
+ <div class="text-body-2">{{ usage.title }}</div>
46
+ <div class="text-caption text-medium-emphasis">{{ usage.description }}</div>
47
+ </div>
48
+ </template>
49
+ </v-radio>
50
+ </v-radio-group>
27
51
  <v-divider />
28
52
  </template>
29
53
  <div class="d-flex align-center justify-space-between py-3">
@@ -260,8 +284,23 @@ const visitorQrLabels: Record<TVisitorQrCodeType, { title: string; description:
260
284
  description: "When enabled, security QR codes will be generated for visitor invitations.",
261
285
  },
262
286
  };
287
+ // Whole day until the end of the visit day, or one entry and then it expires.
288
+ // Sites that saved before this existed have none, and read as whole day.
289
+ const DEFAULT_HID_QR_USAGE: TVisitorQrUsage = "wholeDay";
290
+ const hidQrUsageOptions: { value: TVisitorQrUsage; title: string; description: string }[] = [
291
+ {
292
+ value: "wholeDay",
293
+ title: "Whole day usage",
294
+ description: "The visitor can use the QR code as many times as needed until the end of the visit day.",
295
+ },
296
+ {
297
+ value: "singleUse",
298
+ title: "Single usage",
299
+ description: "The QR code expires after the visitor's first entry.",
300
+ },
301
+ ];
263
302
  const visitorQrCodes = ref<TVisitorQrCode[]>([
264
- { type: "hid", isEnabled: false },
303
+ { type: "hid", isEnabled: false, usage: DEFAULT_HID_QR_USAGE },
265
304
  { type: "security", isEnabled: false },
266
305
  { type: "entryPass", isEnabled: false },
267
306
  ]);
@@ -342,6 +381,9 @@ watch(
342
381
  (q) => q.type === option.type
343
382
  );
344
383
  option.isEnabled = saved?.isEnabled === true;
384
+ if (option.type === "hid") {
385
+ option.usage = saved?.usage ?? DEFAULT_HID_QR_USAGE;
386
+ }
345
387
  });
346
388
  setTimeout(() => {
347
389
  isHydrating.value = false;
@@ -468,7 +510,11 @@ async function handleSave(
468
510
  isAllowPlateNumberOpenBarrier: isAllowPlateNumberOpenBarrier.value,
469
511
  autoApproveOvernightParking: autoApproveOvernightParking.value,
470
512
  isAutoApproved: autoApproveOvernightParking.value,
471
- visitorQrCodes: visitorQrCodes.value.map(({ type, isEnabled }) => ({ type, isEnabled })),
513
+ visitorQrCodes: visitorQrCodes.value.map(({ type, isEnabled, usage }) => ({
514
+ type,
515
+ isEnabled,
516
+ ...(type === "hid" ? { usage: usage ?? DEFAULT_HID_QR_USAGE } : {}),
517
+ })),
472
518
  updatedBy: updatedByValue.value,
473
519
  };
474
520
 
@@ -342,6 +342,18 @@ export const PERMISSIONS = {
342
342
  // Owner answer Q10, 2026-09-11. Mirrors `start-virtual-patrol-route`.
343
343
  "start-nfc-patrol",
344
344
  ],
345
+ // Security Ops. Both strings are enforced by the server (API-core
346
+ // `SITE_VISIT_PERMISSIONS`) and read by the security mobile app's own
347
+ // catalogue, so the spelling is maintained by hand in three places and this
348
+ // is the one that makes a typo visible.
349
+ //
350
+ // `see-all-site-visits` also decides who is told about an action: a head of
351
+ // security holds it together with `site-settings:manage-geofence`. A wildcard
352
+ // deliberately does NOT qualify for that, because a wildcard says somebody
353
+ // administers this site, not that they run security at it - measured
354
+ // 2026-10-13, every wildcard holder at a live site was an org owner, a test
355
+ // account or a service provider's administrator.
356
+ "security-ops": ["start-site-visit", "see-all-site-visits"],
345
357
  // Owner answer Q9, 2026-09-11: seeing the CCTV wall. Distinct from
346
358
  // `site-settings:manage-cctv-camera`, which is camera setup.
347
359
  "cctv-mgmt": ["see-all-cctv", "view-recordings"],
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.97.1-staging.543",
5
+ "version": "4.97.1-staging.545",
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.",
@@ -19,9 +19,15 @@ declare type TOvernightParkingAvailability = {
19
19
 
20
20
  declare type TVisitorQrCodeType = "hid" | "entryPass" | "security";
21
21
 
22
+ // How long an HID visitor pass lasts: until the end of the visit day, or
23
+ // until the visitor's first entry.
24
+ declare type TVisitorQrUsage = "wholeDay" | "singleUse";
25
+
22
26
  declare type TVisitorQrCode = {
23
27
  type: TVisitorQrCodeType;
24
28
  isEnabled: boolean;
29
+ // HID only.
30
+ usage?: TVisitorQrUsage;
25
31
  };
26
32
 
27
33
  declare type TOvernightParkingRequestStatus =
@@ -56,8 +56,50 @@ export const INVENTORY_PRESETS: TPermissionPreset[] = [
56
56
  },
57
57
  ];
58
58
 
59
- /** Presets per module key; only inventory has them today. */
60
- export const PERMISSION_PRESETS: Record<string, TPermissionPreset[]> = { inventory: INVENTORY_PRESETS };
59
+ /**
60
+ * Security Ops in plain words: the two jobs the module actually has.
61
+ *
62
+ * WHY A PRESET AND NOT A NEW PERMISSION. Neither of these is a new right: both
63
+ * sets are made of strings that already exist. The preset only spares somebody
64
+ * hunting a permission tree, and that matters here because the alternative
65
+ * people reach for is a wildcard role, which is how a service provider's
66
+ * administrator ends up supervising a security site.
67
+ *
68
+ * GEOFENCING IS NOT IN EITHER SET, and cannot be: `applyPermissionPreset` is
69
+ * scoped to one resource, and `manage-geofence` belongs to `site-settings`.
70
+ * That matters because the owner's definition of a head of security
71
+ * (2026-10-13) is this permission AND geofencing, and the server reads exactly
72
+ * that pair to decide who is told when an action is raised or sent for
73
+ * verification. So the preset's description has to send the administrator to
74
+ * tick the other box, rather than quietly leaving the job half done.
75
+ *
76
+ * `start-site-visit` is deliberately NOT in the head of security set: it is the
77
+ * right to go and do a visit, and somebody who never walks a site should not
78
+ * have to hold it to be told what is happening on one. Holding it as well does
79
+ * not disqualify them.
80
+ */
81
+ export const SECURITY_OPS_PRESETS: TPermissionPreset[] = [
82
+ {
83
+ key: "officer",
84
+ label: "Security Ops officer",
85
+ description:
86
+ "Goes to the site, works through the visit checklists and checks out. Sees their own work.",
87
+ actions: ["start-site-visit"],
88
+ },
89
+ {
90
+ key: "head",
91
+ label: "Head of security",
92
+ description:
93
+ "Sees every officer's visits and actions. Also tick Manage geofencing under Site settings: that pair is what decides who is told when an action is raised or sent for verification.",
94
+ actions: ["see-all-site-visits"],
95
+ },
96
+ ];
97
+
98
+ /** Presets per module key. */
99
+ export const PERMISSION_PRESETS: Record<string, TPermissionPreset[]> = {
100
+ inventory: INVENTORY_PRESETS,
101
+ "security-ops": SECURITY_OPS_PRESETS,
102
+ };
61
103
 
62
104
  /**
63
105
  * The permission list with `resource`'s grants replaced by `preset`'s actions --
@@ -204,6 +204,16 @@ const SITE_PAGES: Record<string, TSitePage[]> = {
204
204
  robotAlert: [{ apps: ["security", "property-management", "hygiene"], page: () => "robot-management/alerts" }],
205
205
  // hygiene has its Service Providers page too since 2026-09-28
206
206
  serviceProviderInviteAnswer: [{ apps: SERVICE_APPS, page: () => "service-providers" }],
207
+ /**
208
+ * Security Ops: an action was raised, sent for verification, signed off,
209
+ * reopened, or went overdue. Lands on the Ops Review page, which is where the
210
+ * register is read.
211
+ *
212
+ * WITHOUT THIS ENTRY THE ROW IS A DEAD END. `notificationTarget` answers null
213
+ * for a kind it has no page for, so every overdue escalation ever written has
214
+ * opened nothing at all. Adding it repairs those too, not only the new alerts.
215
+ */
216
+ "security-ops": [{ apps: ["security"], page: () => "security-ops" }],
207
217
  };
208
218
  SITE_PAGES.myVisitors = SITE_PAGES.visitors;
209
219