@7365admin1/layer-common 4.4.1-staging.288 → 4.4.1

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 3662dab: The property role editor can now grant camera viewing. `useCameraViewPermission` opens the camera wall for any of four `virtual-patrol:` strings, mirroring the server's `CAMERA_VIEW_PERMISSIONS`, but `usePropertyPermission` carried no `virtual-patrol` family at all — so the gate was enforced at both ends and grantable by nobody, and only `*` wildcard holders saw a camera. Catalogue-only; nothing is granted to anybody.
8
+
3
9
  ## 4.4.0
4
10
 
5
11
  ### Minor Changes
@@ -860,11 +866,11 @@
860
866
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
861
867
  own rule from two endpoints the console already calls, unprojected:
862
868
 
863
- GET /api/members/user/:user/app/admin the Seven365 staff membership
864
- GET /api/roles/id/:role that membership's role document
869
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
870
+ GET /api/roles/id/:role that membership's role document
865
871
 
866
- owner = member.type === "admin" && role.type === "admin" && role.default === true
867
- staff = member.type === "admin" && role.type === "admin"
872
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
873
+ staff = member.type === "admin" && role.type === "admin"
868
874
 
869
875
  `role.default` is the marker because it is the only property of a platform
870
876
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -482,55 +482,6 @@
482
482
  </draggable>
483
483
  </section>
484
484
 
485
- <!-- RESIDENT CHECKLISTS -->
486
- <v-col cols="12" class="mt-4 border-t">
487
- <v-row align="center" no-gutters class="pt-5">
488
- <v-col cols="9" class="d-flex align-center text-body-2">
489
- <v-row no-gutters>
490
- <v-col cols="12" class="header-style">
491
- Resident Checklists
492
- </v-col>
493
- <v-col cols="12" class="text-body-2 text-medium-emphasis">
494
- Allow residents to view and complete assigned checklists. Each
495
- checklist requires a photo upload before submission.
496
- </v-col>
497
- </v-row>
498
- </v-col>
499
- <v-col cols="3" class="d-flex align-center justify-end">
500
- <v-switch
501
- v-model="facility.isResidentChecklistEnabled"
502
- class="d-flex align-center"
503
- color="accent"
504
- hide-details
505
- @update:model-value="onToggleResidentChecklist"
506
- />
507
- </v-col>
508
- </v-row>
509
-
510
- <!-- SECURITY CHECKLISTS -->
511
- <v-row align="center" no-gutters class="border-t pt-5 mt-5">
512
- <v-col cols="9" class="d-flex align-center text-body-2">
513
- <v-row no-gutters>
514
- <v-col cols="12" class="header-style">
515
- Security Checklists
516
- </v-col>
517
- <v-col cols="12" class="text-body-2 text-medium-emphasis">
518
- Allow Security to view and complete assigned checklists
519
- </v-col>
520
- </v-row>
521
- </v-col>
522
- <v-col cols="3" class="d-flex align-center justify-end">
523
- <v-switch
524
- v-model="facility.isSecurityChecklistEnabled"
525
- class="d-flex align-center"
526
- color="accent"
527
- hide-details
528
- @update:model-value="onToggleSecurityChecklist"
529
- />
530
- </v-col>
531
- </v-row>
532
- </v-col>
533
-
534
485
  <v-col cols="12" class="mt-10">
535
486
  <p class="header-style font-weight-bold mb-5 mt-md-0 ml-md-4">
536
487
  Other Settings
@@ -1069,20 +1020,6 @@ watchEffect(() => {
1069
1020
  }
1070
1021
  });
1071
1022
 
1072
- /**
1073
- * One checklist, one owner, and always one. A facility is completed either by
1074
- * its residents or by Security, so the two switches are each other's inverse:
1075
- * turning either off turns the other on. There is no state where a facility
1076
- * has no checklist owner.
1077
- */
1078
- function onToggleResidentChecklist(enabled: boolean | null) {
1079
- facility.value.isSecurityChecklistEnabled = !enabled;
1080
- }
1081
-
1082
- function onToggleSecurityChecklist(enabled: boolean | null) {
1083
- facility.value.isResidentChecklistEnabled = !enabled;
1084
- }
1085
-
1086
1023
  function onToggleBookingUnitLimit(val: any) {
1087
1024
  if (val) {
1088
1025
  isBookingUnitLimitEnabled.value = true;
@@ -132,18 +132,15 @@
132
132
  </template>
133
133
 
134
134
  <template #[`item.contactStatus`]="{ item }">
135
- <span class="contact-status-cell">
136
- <StatusChip :status="getContactReaderStatus(item)" />
137
- <v-btn
138
- icon="mdi-refresh"
139
- size="x-small"
140
- variant="text"
141
- class="contact-status-refresh"
142
- aria-label="Check reader SIP status"
143
- :loading="testingContactReaderId === item.readerId"
144
- @click="testContactSipStatus(item)"
145
- />
146
- </span>
135
+ <v-btn
136
+ size="small"
137
+ variant="outlined"
138
+ class="text-none"
139
+ :loading="testingContactReaderId === item.readerId"
140
+ @click="testContactSipStatus(item)"
141
+ >
142
+ {{ getContactReaderStatus(item) }}
143
+ </v-btn>
147
144
  </template>
148
145
 
149
146
  <template #[`item.action-table`]="{ item }">
@@ -151,26 +148,24 @@
151
148
  <template #activator="{ props: menuProps }">
152
149
  <AppButton v-bind="menuProps" variant="row" icon="mdi-dots-vertical" />
153
150
  </template>
154
- <v-list v-if="activeTab === 'intercom'" density="compact" class="screen-menu">
155
- <v-list-item class="screen-menu__item" title="View" prepend-icon="mdi-eye" @click="openViewDialog(item)" />
151
+ <v-list v-if="activeTab === 'intercom'" density="compact" class="row-menu">
152
+ <v-list-item title="View" @click="openViewDialog(item)" />
156
153
  <v-list-item
157
- class="screen-menu__item"
158
154
  title="Test Connection with SIP"
159
- prepend-icon="mdi-lan-check"
160
155
  :disabled="testingSipReaderId === item.reader._id"
161
156
  @click="testSipConnection(item)"
162
157
  />
163
- <v-list-item class="screen-menu__item" title="Call Settings" prepend-icon="mdi-cog" @click="openCallDialog(item)" />
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)" />
158
+ <v-list-item title="Call Settings" @click="openCallDialog(item)" />
159
+ <v-list-item title="Dial Code" @click="openDialCodeDialog(item)" />
160
+ <v-list-item title="Make a call" @click="openMakeCallDialog(item)" />
161
+ <v-list-item title="Web call" @click="openWebPhoneDialog(item)" />
167
162
  </v-list>
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)" />
170
- <v-list-item class="screen-menu__item" title="Check reader SIP status" prepend-icon="mdi-lan-check" @click="testContactSipStatus(item)" />
171
- <v-list-item class="screen-menu__item" title="View" prepend-icon="mdi-eye" @click="openContactView(item)" />
172
- <v-list-item class="screen-menu__item" title="Edit" prepend-icon="mdi-pencil" @click="openContactDialog(item)" />
173
- <v-list-item class="screen-menu__item screen-menu__item--danger" title="Delete" prepend-icon="mdi-delete-outline" @click="openDeleteContact(item)" />
163
+ <v-list v-else density="compact" class="row-menu">
164
+ <v-list-item title="Call" prepend-icon="mdi-phone" @click="openContactCall(item)" />
165
+ <v-list-item title="Check reader SIP status" prepend-icon="mdi-lan-check" @click="testContactSipStatus(item)" />
166
+ <v-list-item title="View" @click="openContactView(item)" />
167
+ <v-list-item title="Edit" @click="openContactDialog(item)" />
168
+ <v-list-item title="Delete" @click="openDeleteContact(item)" />
174
169
  </v-list>
175
170
  </v-menu>
176
171
  </template>
@@ -579,7 +574,7 @@
579
574
  </v-dialog>
580
575
 
581
576
  <v-dialog v-model="contactDialog" max-width="360" persistent>
582
- <v-card class="form-dialog contact-dialog" rounded="lg">
577
+ <v-card class="form-dialog" rounded="lg">
583
578
  <v-card-title class="dialog-title">{{ contactForm.id ? 'Edit Contact' : 'Add Contact' }}</v-card-title>
584
579
  <v-card-text class="dialog-body">
585
580
  <FieldLabel text="HID Reader" required />
@@ -589,10 +584,9 @@
589
584
  :disabled="Boolean(contactForm.id)"
590
585
  />
591
586
  <FieldLabel text="Name" required />
592
- <AppField v-model="contactForm.name" placeholder="Name shown on calls" class="my-3" />
593
- <FieldLabel text="Address" required />
594
- <AppField v-model="contactForm.serverAddress" :placeholder="contactAddressPlaceholder" />
595
- <p class="field-hint">{{ contactAddressHint }}</p>
587
+ <AppField v-model="contactForm.name" placeholder="Enter name" />
588
+ <FieldLabel text="SIP Number / Address" required />
589
+ <AppField v-model="contactForm.serverAddress" placeholder="7100 or user@example.com" />
596
590
  </v-card-text>
597
591
  <v-card-actions class="dialog-actions pa-0">
598
592
  <v-btn class="text-none action-cancel" variant="flat" height="44" @click="contactDialog = false">Cancel</v-btn>
@@ -964,26 +958,6 @@ const webPhoneButtonClass = computed(() => ({
964
958
  "has-incoming-call": webPhone.callState.value === "incoming",
965
959
  }));
966
960
  const isPeerToPeerMode = computed(() => sipForm.operatingMode === "peer-to-peer");
967
-
968
- /**
969
- * The user guide (6.3 Intercom contacts) gives a contact ONE address field
970
- * whose meaning follows the reader's operating mode: an extension number in
971
- * SIP Client mode, a local IP address in Peer-to-Peer mode. The reader chosen
972
- * in the contact dialog decides which one the field asks for.
973
- */
974
- const contactReaderRow = computed(() =>
975
- intercomRows.value.find((row) => row.reader._id === contactForm.readerId)
976
- );
977
- const isContactReaderPeerToPeer = computed(() => contactReaderRow.value?.operatingMode === "Peer-to-Peer");
978
- const contactAddressPlaceholder = computed(() => (isContactReaderPeerToPeer.value ? "192.168.0.129" : "7100"));
979
- const contactAddressHint = computed(() => {
980
- if (!contactReaderRow.value) {
981
- return "Extension number (SIP Client) or local IP address (Peer-to-Peer), depending on the reader's operating mode.";
982
- }
983
- return isContactReaderPeerToPeer.value
984
- ? "Peer-to-Peer mode: enter the contact's local IP address."
985
- : "SIP Client mode: enter the contact's extension number.";
986
- });
987
961
  const areSipCredentialFieldsDisabled = computed(() => !sipForm.enabled || isPeerToPeerMode.value);
988
962
  const intercomDetailSections = computed(() => {
989
963
  const row = selectedRow.value;
@@ -1492,14 +1466,7 @@ function toggleWebMute() {
1492
1466
  }
1493
1467
  }
1494
1468
 
1495
- function hasReaderContactId(contact: ContactRow) {
1496
- if (contact.id !== undefined) return true;
1497
- showMessage("This contact has no identifier on the HID reader. Refresh the list and try again.", "error");
1498
- return false;
1499
- }
1500
-
1501
1469
  function openContactDialog(contact?: ContactRow) {
1502
- if (contact && !hasReaderContactId(contact)) return;
1503
1470
  selectedContact.value = contact || null;
1504
1471
  contactForm.id = contact?.id;
1505
1472
  contactForm.readerId = contact?.readerId || selectedReaderId.value || readers.value[0]?._id || "";
@@ -1549,20 +1516,10 @@ function openContactCall(contact: ContactRow) {
1549
1516
  }
1550
1517
 
1551
1518
  function openDeleteContact(contact: ContactRow) {
1552
- if (!hasReaderContactId(contact)) return;
1553
1519
  selectedContact.value = contact;
1554
1520
  deleteContactDialog.value = true;
1555
1521
  }
1556
1522
 
1557
- /**
1558
- * modify_objects and destroy_objects answer { changes: n } (API guide, Modify
1559
- * Objects / Delete Objects). Zero means the where clause matched nothing on the
1560
- * reader - typically a contact already removed from the touchscreen.
1561
- */
1562
- function readChanges(response: unknown) {
1563
- return toNumber(toRecord(toRecord(response).data ?? response).changes, Number.NaN);
1564
- }
1565
-
1566
1523
  async function saveSipSettings() {
1567
1524
  if (!selectedRow.value) return;
1568
1525
  const isPeerToPeer = sipForm.operatingMode === "peer-to-peer";
@@ -1663,17 +1620,6 @@ function isSipCallTarget(value = "") {
1663
1620
  return /^(?:sip:)?[A-Za-z0-9_.+-]+(?:@[A-Za-z0-9.-]+(?::\d{1,5})?)?$/.test(value.trim());
1664
1621
  }
1665
1622
 
1666
- function isIpv4Address(value = "") {
1667
- const [host, port, ...rest] = value.trim().split(":");
1668
- if (rest.length || (port !== undefined && !/^\d{1,5}$/.test(port))) return false;
1669
- const octets = host.split(".");
1670
- return octets.length === 4 && octets.every((octet) => /^\d{1,3}$/.test(octet) && Number(octet) <= 255);
1671
- }
1672
-
1673
- function isContactAddress(value: string, peerToPeer: boolean) {
1674
- return peerToPeer ? isIpv4Address(value) : isSipCallTarget(value);
1675
- }
1676
-
1677
1623
  async function runHangupCall() {
1678
1624
  if (!selectedRow.value) return;
1679
1625
  hangingUp.value = true;
@@ -1762,20 +1708,15 @@ async function saveContact() {
1762
1708
  return;
1763
1709
  }
1764
1710
 
1765
- if (!isContactAddress(contactForm.serverAddress, isContactReaderPeerToPeer.value)) {
1766
- showMessage(
1767
- isContactReaderPeerToPeer.value
1768
- ? "Enter the contact's local IPv4 address for a Peer-to-Peer reader."
1769
- : "Enter a valid extension number or SIP address.",
1770
- "warning",
1771
- );
1711
+ if (!isSipCallTarget(contactForm.serverAddress)) {
1712
+ showMessage("Enter a valid extension, SIP address, or IPv4 address.", "warning");
1772
1713
  return;
1773
1714
  }
1774
1715
 
1775
1716
  contactsSaving.value = true;
1776
1717
  try {
1777
- if (contactForm.id !== undefined) {
1778
- const response = await runObjectOperation(contactForm.readerId, {
1718
+ if (contactForm.id) {
1719
+ await runObjectOperation(contactForm.readerId, {
1779
1720
  operation: "modify",
1780
1721
  object: "contacts",
1781
1722
  values: {
@@ -1784,14 +1725,8 @@ async function saveContact() {
1784
1725
  },
1785
1726
  where: { contacts: { id: contactForm.id } },
1786
1727
  });
1787
- if (readChanges(response) === 0) {
1788
- contactDialog.value = false;
1789
- await loadContacts();
1790
- showMessage("The HID reader no longer has this contact. The list has been refreshed.", "warning");
1791
- return;
1792
- }
1793
1728
  } else {
1794
- const response = await runObjectOperation(contactForm.readerId, {
1729
+ await runObjectOperation(contactForm.readerId, {
1795
1730
  operation: "create",
1796
1731
  object: "contacts",
1797
1732
  values: [{
@@ -1799,15 +1734,6 @@ async function saveContact() {
1799
1734
  number: contactForm.serverAddress.trim(),
1800
1735
  }],
1801
1736
  });
1802
- // create_objects answers { ids: [...] } with the id of each created
1803
- // object. No id means the reader accepted the request but created nothing.
1804
- const created = toRecord(response?.data ?? response).ids;
1805
- if (!Array.isArray(created) || created.length === 0) {
1806
- contactDialog.value = false;
1807
- await loadContacts();
1808
- showMessage("The HID reader did not confirm the new contact. Check the contact list.", "warning");
1809
- return;
1810
- }
1811
1737
  }
1812
1738
  contactDialog.value = false;
1813
1739
  await loadContacts();
@@ -1820,21 +1746,16 @@ async function saveContact() {
1820
1746
  }
1821
1747
 
1822
1748
  async function deleteContact() {
1823
- const contact = selectedContact.value;
1824
- if (!contact || !hasReaderContactId(contact)) return;
1749
+ if (!selectedContact.value?.id) return;
1825
1750
  contactsSaving.value = true;
1826
1751
  try {
1827
- const response = await runObjectOperation(contact.readerId, {
1752
+ await runObjectOperation(selectedContact.value.readerId, {
1828
1753
  operation: "destroy",
1829
1754
  object: "contacts",
1830
- where: { contacts: { id: contact.id } },
1755
+ where: { contacts: { id: selectedContact.value.id } },
1831
1756
  });
1832
1757
  deleteContactDialog.value = false;
1833
1758
  await loadContacts();
1834
- if (readChanges(response) === 0) {
1835
- showMessage("The HID reader had already removed this contact. The list has been refreshed.", "warning");
1836
- return;
1837
- }
1838
1759
  showMessage("Intercom contact deleted.", "success");
1839
1760
  } catch (error: unknown) {
1840
1761
  showMessage(getErrorMessage(error), "error");
@@ -2022,14 +1943,9 @@ export default {
2022
1943
 
2023
1944
 
2024
1945
 
2025
- .contact-status-cell {
2026
- display: inline-flex;
2027
- align-items: center;
2028
- gap: 4px;
2029
- }
2030
-
2031
- .contact-status-refresh {
2032
- color: var(--text2);
1946
+ .row-menu {
1947
+ min-width: 160px;
1948
+ border-radius: 6px;
2033
1949
  }
2034
1950
 
2035
1951
  .link-text {
@@ -2089,27 +2005,10 @@ export default {
2089
2005
  color: var(--err);
2090
2006
  }
2091
2007
 
2092
- .field-hint {
2093
- margin: 6px 0 0;
2094
- color: var(--text2);
2095
- font-size: 11px;
2096
- line-height: 1.4;
2097
- }
2098
-
2099
2008
  .sip-settings-dialog .field-label {
2100
2009
  margin-top: 14px;
2101
2010
  }
2102
2011
 
2103
- /* Room between the contact dialog's three inputs; the first label sits
2104
- against the body padding. */
2105
- .contact-dialog .field-label {
2106
- margin-top: 18px;
2107
- }
2108
-
2109
- .contact-dialog .field-label:first-child {
2110
- margin-top: 0;
2111
- }
2112
-
2113
2012
  .sip-label {
2114
2013
  margin: 12px 0 6px;
2115
2014
  color: var(--text);
@@ -2807,18 +2706,14 @@ export default {
2807
2706
  margin-top: 0;
2808
2707
  }
2809
2708
 
2810
- .detail-dialog .dialog-title {
2811
- font-size: var(--fs-card-title);
2812
- }
2813
-
2814
2709
  .detail-row {
2815
2710
  display: flex;
2816
2711
  align-items: center;
2817
2712
  justify-content: space-between;
2818
2713
  gap: 16px;
2819
- min-height: 32px;
2714
+ min-height: 26px;
2820
2715
  color: var(--muted);
2821
- font-size: var(--fs-cell);
2716
+ font-size: 11px;
2822
2717
  }
2823
2718
 
2824
2719
  .detail-row strong {
@@ -2830,11 +2725,13 @@ export default {
2830
2725
  .dialog-actions {
2831
2726
  display: grid;
2832
2727
  grid-template-columns: 1fr 1fr;
2833
- gap: 0;
2834
- min-height: 0;
2835
2728
  border-top: 1px solid var(--border);
2836
2729
  }
2837
2730
 
2731
+ .sip-settings-dialog .dialog-actions {
2732
+ min-height: 46px;
2733
+ }
2734
+
2838
2735
  /* The split footer bar, as panels 2, 4 and 5 keep it: the SHAPE is the
2839
2736
  screen's own (the handoff draws no such bar); only the colours change. The
2840
2737
  navy was a fixed hex that sat on the dark card unchanged. */