@7365admin1/layer-common 4.21.4-staging.345 → 4.22.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 (31) hide show
  1. package/CHANGELOG.md +10 -4
  2. package/components/DocumentForm.vue +112 -407
  3. package/components/DocumentManagement.vue +12 -213
  4. package/components/EntryPass/QrTemplatePreview.vue +25 -21
  5. package/components/EntryPassInformation.vue +24 -119
  6. package/components/Facility/BookingSetup.vue +0 -63
  7. package/components/HidAccessLogDashboard.vue +5 -29
  8. package/components/HidIntercomManagement.vue +4 -48
  9. package/components/HidReaderManagement.vue +0 -26
  10. package/components/HidReaderUserRoster.vue +2 -32
  11. package/components/HidUserEnrollment.vue +152 -833
  12. package/components/InvitationClientForm.vue +1 -19
  13. package/components/VisitorManagement.vue +5 -267
  14. package/composables/useAccessManagement.ts +0 -5
  15. package/composables/useDocument.ts +0 -7
  16. package/composables/useFacility.ts +0 -11
  17. package/composables/useHidAmico.ts +0 -97
  18. package/composables/useHidNavigation.ts +1 -25
  19. package/composables/usePeople.ts +0 -19
  20. package/composables/useWebUsb.ts +11 -14
  21. package/package.json +1 -1
  22. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  23. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  24. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  25. package/types/document.d.ts +0 -14
  26. package/types/facility.d.ts +0 -4
  27. package/types/people.d.ts +1 -4
  28. package/components/HidAccessPermissions.vue +0 -424
  29. package/components/HidProfileQrCode.vue +0 -323
  30. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +0 -23
  31. package/utils/hid-permission-assignments.ts +0 -190
@@ -401,10 +401,7 @@ const exportForm = reactive({
401
401
  });
402
402
 
403
403
  const statusOptions = ["Authorized", "Not Authorized", "Unknown"];
404
- const accessMethodFilterOptions = ["Facial", "QR Code", "ID and Password", "PIN", "Card", "Intercom"];
405
-
406
- /** The persisted event the resident app records when it opens a door on a call. */
407
- const INTERCOM_DOOR_OPEN_EVENT = "intercom_door_open";
404
+ const accessMethodFilterOptions = ["Facial", "QR Code", "ID and Password", "PIN", "Card"];
408
405
  const accessMethodOptions = ["All", ...accessMethodFilterOptions];
409
406
 
410
407
  const readerOptions = computed(() =>
@@ -609,7 +606,7 @@ async function loadDashboard() {
609
606
  resetDashboardData();
610
607
  try {
611
608
  const isVisitorTab = activeTab.value === "visitor";
612
- const [logResponse, intercomLogResponse, hidAccessLogResponse, visitorResponse, readerUserResponse] = await Promise.all([
609
+ const [logResponse, hidAccessLogResponse, visitorResponse, readerUserResponse] = await Promise.all([
613
610
  loadDashboardSource(
614
611
  getLogs(selectedReaderId.value, {
615
612
  page: page.value,
@@ -618,20 +615,6 @@ async function loadDashboard() {
618
615
  null,
619
616
  "persisted access logs",
620
617
  ),
621
- // Door opens from the resident app during an intercom call. The reader
622
- // never logs a DTMF door open, so these exist only as persisted events
623
- // and are fetched by type: the general page above is shared with every
624
- // other event the reader emits and is dropped whenever the reader has
625
- // live logs, which it always has.
626
- loadDashboardSource(
627
- getLogs(selectedReaderId.value, {
628
- page: page.value,
629
- limit,
630
- type: INTERCOM_DOOR_OPEN_EVENT,
631
- }),
632
- null,
633
- "intercom door-open logs",
634
- ),
635
618
  loadDashboardSource(
636
619
  getReaderAccessLogs(selectedReaderId.value, {
637
620
  page: page.value,
@@ -698,14 +681,9 @@ async function loadDashboard() {
698
681
  // identity metadata here: it can contain a stale photo from another user.
699
682
  allIdentities.value = readerUsers;
700
683
  identities.value = readerUsers;
701
- const intercomItems = intercomLogResponse?.items ?? intercomLogResponse?.data?.items ?? intercomLogResponse?.data?.logs ?? [];
702
- logs.value = [
703
- ...(liveItems.length
704
- ? []
705
- : logResponse?.items ?? logResponse?.data?.items ?? logResponse?.data?.logs ?? []),
706
- // Always kept: the reader has no live counterpart for these.
707
- ...intercomItems,
708
- ];
684
+ logs.value = liveItems.length
685
+ ? []
686
+ : logResponse?.items ?? logResponse?.data?.items ?? logResponse?.data?.logs ?? [];
709
687
  liveAccessLogs.value = liveItems;
710
688
  serverPages.value = Number(hidAccessLogResponse?.pages ?? hidAccessLogResponse?.data?.pages ?? 1);
711
689
  serverPageRange.value = String(
@@ -841,8 +819,6 @@ function getAccessMethod(identity: HidAccessRecord, log?: HidAccessRecord) {
841
819
  id_password: "ID and Password",
842
820
  pin: "PIN",
843
821
  card: "Card",
844
- // Set by the API on intercom_door_open events; no reader field implies it.
845
- intercom: "Intercom",
846
822
  };
847
823
  const normalizedMethod = String(payload.normalizedMethod || "");
848
824
  if (normalizedMethodLabels[normalizedMethod]) return normalizedMethodLabels[normalizedMethod];
@@ -162,8 +162,11 @@
162
162
  />
163
163
  <v-list-item class="screen-menu__item" title="Call Settings" prepend-icon="mdi-cog" @click="openCallDialog(item)" />
164
164
  <v-list-item class="screen-menu__item" title="Dial Code" prepend-icon="mdi-dialpad" @click="openDialCodeDialog(item)" />
165
+ <v-list-item class="screen-menu__item" title="Make a call" prepend-icon="mdi-phone" @click="openMakeCallDialog(item)" />
166
+ <v-list-item class="screen-menu__item" title="Web call" prepend-icon="mdi-headset" @click="openWebPhoneDialog(item)" />
165
167
  </v-list>
166
168
  <v-list v-else density="compact" class="screen-menu">
169
+ <v-list-item class="screen-menu__item" title="Call" prepend-icon="mdi-phone" @click="openContactCall(item)" />
167
170
  <v-list-item class="screen-menu__item" title="Check reader SIP status" prepend-icon="mdi-lan-check" @click="testContactSipStatus(item)" />
168
171
  <v-list-item class="screen-menu__item" title="View" prepend-icon="mdi-eye" @click="openContactView(item)" />
169
172
  <v-list-item class="screen-menu__item" title="Edit" prepend-icon="mdi-pencil" @click="openContactDialog(item)" />
@@ -729,7 +732,6 @@ const {
729
732
  makeIntercomCall,
730
733
  finalizeIntercomCall,
731
734
  ensureSipAccount,
732
- notifyIntercomCall,
733
735
  } = useHidAmico();
734
736
 
735
737
  const activeTab = ref<IntercomTab>("intercom");
@@ -1440,10 +1442,8 @@ async function disconnectWebPhone() {
1440
1442
 
1441
1443
  async function startWebCall() {
1442
1444
  webPhoneActionLoading.value = true;
1443
- const destination = webPhoneForm.destination;
1444
1445
  try {
1445
- await webPhone.call(destination);
1446
- void ringResidentPhone(destination);
1446
+ await webPhone.call(webPhoneForm.destination);
1447
1447
  } catch (error: unknown) {
1448
1448
  showMessage(getErrorMessage(error), "error");
1449
1449
  } finally {
@@ -1451,50 +1451,6 @@ async function startWebCall() {
1451
1451
  }
1452
1452
  }
1453
1453
 
1454
- /**
1455
- * Wake the called resident's mobile so they are there to answer.
1456
- *
1457
- * Deliberately fired AFTER the INVITE and never awaited. The SIP leg is the
1458
- * call: it is already ringing by the time this runs, and a resident whose
1459
- * phone is asleep is the only thing this fixes. So a failure here is logged
1460
- * and dropped rather than shown — telling the operator "call failed" for a
1461
- * call that is ringing would be worse than a silent miss.
1462
- *
1463
- * A destination with no resident behind it (a staff extension, an external SIP
1464
- * address) comes back `notified: false` with a reason and is not an error.
1465
- */
1466
- async function ringResidentPhone(destination: string) {
1467
- if (!props.org || !props.site) return;
1468
-
1469
- try {
1470
- // No `readerId`: this call came from the web phone, not a door station.
1471
- // The reader selected in the table above is whatever the operator happens
1472
- // to be looking at, and sending it would tell the resident's app the call
1473
- // arrived at a door it never touched.
1474
- await notifyIntercomCall(props.site, {
1475
- orgId: props.org,
1476
- destination,
1477
- callId: createCallId(),
1478
- });
1479
- } catch (error: unknown) {
1480
- console.warn("[intercom] could not send the incoming-call push", error);
1481
- }
1482
- }
1483
-
1484
- /**
1485
- * A per-call id, so a second push for the same call replaces the first on the
1486
- * resident's lock screen rather than stacking a second ringing card.
1487
- * `randomUUID` needs a secure context, which the web phone already requires —
1488
- * getUserMedia does not run without one — but the fallback keeps a call from
1489
- * failing on that account alone.
1490
- */
1491
- function createCallId() {
1492
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
1493
- return crypto.randomUUID();
1494
- }
1495
- return `call-${Date.now()}-${Math.random().toString(16).slice(2)}`;
1496
- }
1497
-
1498
1454
  async function answerWebCall() {
1499
1455
  webPhoneActionLoading.value = true;
1500
1456
  try {
@@ -87,7 +87,6 @@
87
87
 
88
88
  <v-list density="compact" min-width="180">
89
89
  <v-list-item title="View" @click="openView(item)" />
90
- <v-list-item title="Access Permissions" @click="openPermissions(item)" />
91
90
  <v-list-item title="Sync HID Reader" @click="openSyncConfirm(item)" />
92
91
  <v-list-item title="Test Connection" @click="openTestConfirm(item)" />
93
92
  <v-list-item title="Edit" @click="openEdit(item)" />
@@ -242,18 +241,6 @@
242
241
  </v-card-actions>
243
242
  </v-card>
244
243
  </v-dialog>
245
-
246
- <!-- Who may actually pass this reader. Enrolment makes a person
247
- RECOGNISABLE; this is what puts them in the group the access rule is
248
- attached to, and without it a recognised person is refused at the
249
- door. Reloads the list on save so the reader's own counts stay true. -->
250
- <HidAccessPermissions
251
- v-model="permissionsDialog"
252
- :site="props.site"
253
- :org="props.org"
254
- :reader="selectedReader"
255
- @saved="loadReaders"
256
- />
257
244
  </section>
258
245
  </template>
259
246
 
@@ -335,13 +322,6 @@ const props = defineProps({
335
322
  type: String,
336
323
  required: true,
337
324
  },
338
- // The permission endpoints are org-scoped (`assertOrganizationSiteAccess`),
339
- // and this component previously had no reason to know the org. Passed from
340
- // the page, as `HidQrCodeConfiguration` already does.
341
- org: {
342
- type: String,
343
- required: true,
344
- },
345
325
  });
346
326
 
347
327
  const {
@@ -367,7 +347,6 @@ const viewDialog = ref(false);
367
347
  const confirmDialog = ref(false);
368
348
  const resultDialog = ref(false);
369
349
  const selectedReader = ref<HidRecord | null>(null);
370
- const permissionsDialog = ref(false);
371
350
  const pendingAction = ref<"test" | "sync" | "delete" | null>(null);
372
351
  const actionStage = ref<"confirm" | "review" | "loading">("confirm");
373
352
  const resultSuccess = ref(true);
@@ -505,11 +484,6 @@ function openView(reader: HidRecord) {
505
484
  viewDialog.value = true;
506
485
  }
507
486
 
508
- function openPermissions(reader: HidRecord) {
509
- selectedReader.value = reader;
510
- permissionsDialog.value = true;
511
- }
512
-
513
487
  function openTestConfirm(reader?: HidRecord | null) {
514
488
  if (reader) selectedReader.value = reader;
515
489
  pendingAction.value = "test";
@@ -27,7 +27,7 @@
27
27
  v-model="search"
28
28
  search
29
29
  placeholder="Search Amico user, UID or registration"
30
- @keyup.enter="onSearchSubmit"
30
+ @keyup.enter="reloadFromFirstPage"
31
31
  />
32
32
  <AppSelect
33
33
  v-model="userType"
@@ -284,8 +284,6 @@ async function loadUsers() {
284
284
  return;
285
285
  }
286
286
 
287
- const sequence = loadUsersSequence.value + 1;
288
- loadUsersSequence.value = sequence;
289
287
  loading.value = true;
290
288
  try {
291
289
  let clientFiltersUserType = false;
@@ -321,7 +319,6 @@ async function loadUsers() {
321
319
  const pageItems = clientFiltersUserType
322
320
  ? matchingItems.slice(pageStart, pageStart + 10)
323
321
  : matchingItems;
324
- if (sequence !== loadUsersSequence.value) return;
325
322
  users.value = pageItems.map(toReaderUser);
326
323
  total.value = clientFiltersUserType
327
324
  ? matchingItems.length
@@ -333,15 +330,13 @@ async function loadUsers() {
333
330
  ? ""
334
331
  : toText(response.pageRange ?? data.pageRange);
335
332
  } catch (error: unknown) {
336
- if (sequence !== loadUsersSequence.value) return;
337
333
  users.value = [];
338
334
  total.value = 0;
339
335
  pages.value = 1;
340
336
  serverPageRange.value = "";
341
337
  showToast(getErrorMessage(error), "error");
342
338
  } finally {
343
- // Only the newest load owns the spinner.
344
- if (sequence === loadUsersSequence.value) loading.value = false;
339
+ loading.value = false;
345
340
  }
346
341
  }
347
342
 
@@ -355,31 +350,6 @@ function reloadFromFirstPage() {
355
350
  loadUsers();
356
351
  }
357
352
 
358
- /**
359
- * Typing is the search. It used to reload on `@keyup.enter` and on nothing
360
- * else, so unless you guessed Enter was required the screen sent no request at
361
- * all. Debounced, because each reload is a login/load/logout round trip to a
362
- * reader over a VPN; Enter still works and skips the wait.
363
- */
364
- const SEARCH_DEBOUNCE_MS = 400;
365
- let searchDebounce: ReturnType<typeof setTimeout> | undefined;
366
-
367
- function onSearchInput() {
368
- clearTimeout(searchDebounce);
369
- searchDebounce = setTimeout(reloadFromFirstPage, SEARCH_DEBOUNCE_MS);
370
- }
371
-
372
- function onSearchSubmit() {
373
- clearTimeout(searchDebounce);
374
- reloadFromFirstPage();
375
- }
376
-
377
- watch(search, onSearchInput);
378
- onBeforeUnmount(() => clearTimeout(searchDebounce));
379
-
380
- /** Discards a load whose answer arrives after a newer one started. */
381
- const loadUsersSequence = ref(0);
382
-
383
353
  function hasFacialData(user: HidReaderUser) {
384
354
  return user.metadata?.facialEnrolled === true || Boolean(toText(user.metadata?.facialData));
385
355
  }