@7365admin1/layer-common 3.2.1-staging.72 → 3.2.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/components/EntryPassInformation.vue +4 -4
  3. package/components/FeedbackMain.vue +7 -7
  4. package/components/HidAccessLogDashboard.vue +44 -119
  5. package/components/HidIdentityMapping.vue +975 -0
  6. package/components/HidIntercomManagement.vue +201 -808
  7. package/components/HidQrCodeConfiguration.vue +95 -907
  8. package/components/HidServiceSettingsPanel.vue +1 -20
  9. package/components/HidUserEnrollment.vue +81 -392
  10. package/components/Layout/NavigationDrawer.vue +2 -43
  11. package/components/NavigationItem.vue +0 -9
  12. package/components/Nfc/NFCPatrolRouteMain.vue +7 -52
  13. package/components/OnlineFormConfigurationForm.vue +224 -620
  14. package/components/OnlineFormFill.vue +8 -36
  15. package/components/OnlineFormsConfiguration.vue +2 -6
  16. package/components/QrTemplate/CreditCardLandscape.vue +12 -19
  17. package/components/QrTemplate/PrintDialog.vue +196 -209
  18. package/components/SiteSettings.vue +2 -4
  19. package/components/VisitorForm.vue +78 -201
  20. package/components/VisitorManagement.vue +2 -1
  21. package/components/VisitorSocketPopUp.vue +2 -56
  22. package/composables/useComment.ts +3 -3
  23. package/composables/useHidAmico.ts +0 -127
  24. package/composables/useHidNavigation.ts +7 -0
  25. package/composables/useOnlineFormPages.ts +0 -2
  26. package/composables/useSiteSettings.ts +0 -50
  27. package/composables/useVisitorSocket.ts +0 -26
  28. package/composables/useWebUsb.ts +37 -127
  29. package/middleware/member.ts +4 -0
  30. package/package.json +1 -3
  31. package/pages/[org]/[site]/access-mgmt/identity-mapping/index.vue +23 -0
  32. package/pages/[org]/[site]/access-mgmt/intercom/index.vue +1 -1
  33. package/plugins/secure-member.client.ts +56 -21
  34. package/plugins/vuetify.ts +9 -37
  35. package/types/site.d.ts +0 -71
  36. package/.changeset/camera-wall-gated-endpoint.md +0 -47
  37. package/.changeset/camera-wall-plain-english.md +0 -60
  38. package/.changeset/camera-wall-selection-and-guidance.md +0 -65
  39. package/.changeset/dark-primary-contrast.md +0 -39
  40. package/components/CameraWall.vue +0 -1034
  41. package/components/CameraWallTile.vue +0 -818
  42. package/components/HidCameraCaptureDialog.vue +0 -199
  43. package/composables/useSipWebPhone.ts +0 -311
  44. package/test/visitor-socket.test.mjs +0 -36
  45. package/utils/camera-wall.test.ts +0 -571
  46. package/utils/camera-wall.ts +0 -926
  47. package/utils/theme.test.ts +0 -201
  48. package/utils/theme.ts +0 -136
@@ -12,40 +12,75 @@ export default defineNuxtPlugin(() => {
12
12
 
13
13
  const { userAppRole, id, orgNature } = useLocalSetup();
14
14
 
15
- router.beforeEach(async (to) => {
15
+ router.afterEach(async (to) => {
16
16
  const isMember = to.meta?.memberOnly;
17
17
 
18
18
  if (!isMember) return;
19
19
 
20
20
  const APP = useRuntimeConfig().public.APP;
21
- const org =
22
- (to.params.org as string) || (to.params.organization as string) || "";
21
+ const org = computed(
22
+ () =>
23
+ (to.params.org as string) || (to.params.organization as string) || ""
24
+ );
23
25
 
24
- if (!hexSchema.safeParse(org).success) {
25
- return { name: "require-organization-membership" };
26
+ console.log('[secure-member-plugin', 'org', org.value)
27
+
28
+ if (!hexSchema.safeParse(org.value).success) {
29
+ return router.replace({ name: "require-organization-membership" });
26
30
  }
27
31
 
28
- const userId = useCookie("user").value ?? "";
29
- if (!userId) return { name: "index" };
32
+ const userId = computed(() => useCookie("user").value ?? "");
33
+
34
+ const { data: userMemberData, error: userMemberError } =
35
+ await useLazyAsyncData(
36
+ "plugin-get-member-by-id-" + userId.value + "-" + APP + "-" + org.value,
37
+ () => getByUserType(userId.value, APP, org.value),
38
+ { watch: [userId] }
39
+ );
40
+
41
+ watchEffect(() => {
42
+ if (userMemberError.value) {
43
+ console.log('running-secure-member-redirect-plugin')
44
+ navigateTo(
45
+ {
46
+ name: "index",
47
+ },
48
+ { replace: true }
49
+ );
50
+ }
51
+ });
52
+
53
+ const roleId = ref("roleId");
30
54
 
31
- try {
32
- const userMemberData = await getByUserType(userId, APP, org);
33
- id.value = userMemberData.org ?? "";
55
+ watchEffect(() => {
56
+ if (userMemberData.value) {
57
+ id.value = userMemberData.value.org ?? "";
58
+ roleId.value = userMemberData.value.role ?? "roleId";
59
+ }
60
+ });
34
61
 
35
- const [orgResult, roleResult] = await Promise.allSettled([
36
- getById(org),
37
- userMemberData.role ? getRoleById(userMemberData.role) : null,
38
- ]);
62
+ const { data: getOrgByIdReq } = await useLazyAsyncData(
63
+ "plugin-get-org-by-id-" + org.value,
64
+ () => getById(org.value),
65
+ { watch: [org] }
66
+ );
39
67
 
40
- if (orgResult.status === "fulfilled" && orgResult.value) {
41
- orgNature.value = orgResult.value.nature ?? "";
68
+ watchEffect(() => {
69
+ if (getOrgByIdReq.value) {
70
+ orgNature.value = getOrgByIdReq.value.nature ?? "";
42
71
  }
72
+ });
43
73
 
44
- if (roleResult.status === "fulfilled" && roleResult.value) {
45
- userAppRole.value = roleResult.value;
74
+ const { data: getRoleByIdReq } = await useLazyAsyncData(
75
+ "plugin-get-role-by-id-" + roleId.value,
76
+ () => getRoleById(roleId.value),
77
+ { watch: [roleId] }
78
+ );
79
+
80
+ watchEffect(() => {
81
+ if (getRoleByIdReq.value) {
82
+ userAppRole.value = getRoleByIdReq.value;
46
83
  }
47
- } catch (error) {
48
- return { name: "index" };
49
- }
84
+ });
50
85
  });
51
86
  });
@@ -42,8 +42,6 @@ import {
42
42
  } from "vuetify-pro-tiptap";
43
43
  import "vuetify-pro-tiptap/style.css";
44
44
 
45
- import { LIGHT_THEME, DARK_THEME } from "../utils/theme";
46
-
47
45
  export default defineNuxtPlugin((app) => {
48
46
  const vuetify = createVuetify({
49
47
  defaults: {
@@ -71,43 +69,17 @@ export default defineNuxtPlugin((app) => {
71
69
  // hint: "This field is required",
72
70
  // },
73
71
  },
74
- /**
75
- * THE PRODUCT HAS TWO THEMES, AND UNTIL NOW ONLY ONE OF THEM WAS OURS.
76
- *
77
- * Every app shows a light/dark toggle in the app bar (Layout/Header.vue),
78
- * and it sets Vuetify's built-in "light" and "dark" themes. Those were left
79
- * at Vuetify's factory values, so one click on any screen in any of the
80
- * eleven apps threw the brand away: `primary` stopped being the Seven365
81
- * navy and became Material blue #2196F3 - and `primary` is the navigation
82
- * drawer's fill - while `primary-button` and `text-primary`, used in around
83
- * eighty places across the layer and the apps, do not exist in a stock
84
- * theme at all, so those components lost their colour to an undefined CSS
85
- * variable. There was also no way back to the brand: the toggle only ever
86
- * flipped between the two stock themes.
87
- *
88
- * The fix is to make the stock names OURS rather than to add new names.
89
- * Several components already branch on `theme.global.name === "dark"` (this
90
- * layer's FormDialog, property-management's facility icons), so a
91
- * differently-named dark theme would have left every one of them silently
92
- * on their light branch inside a dark app. Overriding `light` and `dark`
93
- * means the toggle, `v-theme-provider theme="light"`, the `plain-dark`
94
- * layout and all of those comparisons keep working, and start being right.
95
- *
96
- * The colours themselves, and every ratio they were chosen for, are in
97
- * `utils/theme.ts`, which `utils/theme.test.ts` measures on every run.
98
- */
99
72
  theme: {
100
- defaultTheme: "light",
73
+ defaultTheme: "iservice365",
101
74
  themes: {
102
- light: LIGHT_THEME,
103
- dark: DARK_THEME,
104
- /**
105
- * The name this product booted on before the two above carried the
106
- * brand. Kept, and identical to `light`, so anything that asks for it
107
- * by name - in an app that is not in this repository - still gets a
108
- * theme rather than a blank one.
109
- */
110
- iservice365: LIGHT_THEME,
75
+ iservice365: {
76
+ dark: false,
77
+ colors: {
78
+ primary: "#042134",
79
+ "primary-button": "#1867C0",
80
+ "text-primary": "#052439",
81
+ },
82
+ },
111
83
  },
112
84
  },
113
85
  icons: {
package/types/site.d.ts CHANGED
@@ -1,76 +1,5 @@
1
1
  declare type TSiteCreate = Pick<TSite, "name" | "description" | "orgId">;
2
2
 
3
- declare type THidQrCodeFormat = "0" | "1" | "2";
4
-
5
- declare type THidPermissionCategory =
6
- | "resident"
7
- | "property_management"
8
- | "service_provider";
9
-
10
- declare type THidPermissionAssignment = {
11
- subjectId: string;
12
- category: THidPermissionCategory;
13
- name: string;
14
- subtitle?: string;
15
- intercom: boolean;
16
- readerId?: string;
17
- location?: string;
18
- locationKey?: string;
19
- };
20
-
21
- declare type THidSitePermissions = {
22
- orgId: string;
23
- site: string;
24
- readerId: string;
25
- location: string;
26
- assignments: THidPermissionAssignment[];
27
- counts: {
28
- resident: number;
29
- propertyManagement: number;
30
- serviceProvider: number;
31
- intercom: number;
32
- };
33
- };
34
-
35
- declare type THidPermissionCandidate = THidPermissionAssignment & {
36
- selected: boolean;
37
- };
38
-
39
- declare type THidQrCodePassConfig = {
40
- enabled: boolean;
41
- onlineMode?: boolean;
42
- readerId: string;
43
- qrFormat: THidQrCodeFormat;
44
- identificationMethods?: {
45
- facial: boolean;
46
- card: boolean;
47
- qrCode: boolean;
48
- idPassword: boolean;
49
- pin: boolean;
50
- bluetooth: boolean;
51
- };
52
- printer: {
53
- vendorId: string;
54
- productId: string;
55
- };
56
- template: {
57
- header: string;
58
- subtext: string;
59
- };
60
- validityMinutes: number | null;
61
- updatedAt?: string;
62
- };
63
-
64
- declare type TSiteMetadata = {
65
- block?: number;
66
- guardPosts?: number;
67
- gracePeriod?: number;
68
- incidentCounter?: number;
69
- incidentLogo?: string;
70
- services?: Record<string, unknown>[];
71
- hidQrCodePass?: THidQrCodePassConfig;
72
- };
73
-
74
3
 
75
4
  declare type TSite = {
76
5
  _id?: string;
@@ -1,47 +0,0 @@
1
- ---
2
- "@7365admin1/layer-common": patch
3
- ---
4
-
5
- Draw the camera wall from the gated wall endpoint, and show the server's own
6
- reason on a tile.
7
-
8
- `CameraWall` fetched its cameras from `GET /api/site-cameras` - the Settings
9
- panel's paginated CRUD list, which took its site from an optional query
10
- parameter and checked nothing about the caller. Any signed-in user from any
11
- organisation could read every camera in the estate through it, `host` and
12
- `username` included.
13
-
14
- It now calls `GET /api/site-cameras/site/:siteId/wall`, which already exists,
15
- which the React Native monitoring app was built against, and which is
16
- authorised server-side: the caller must be a member of the site, of its owning
17
- organisation, or work for an organisation actively engaged to serve it. That
18
- endpoint also returns `type: "ip"` cameras only and each camera's capability
19
- descriptor, so a wall cannot be handed an ANPR unit and a tile can explain
20
- itself.
21
-
22
- Two consequences worth stating:
23
-
24
- - **The pager is gone.** The wall endpoint returns the site's cameras in one
25
- answer. Paging a video wall was an artefact of borrowing the CRUD list.
26
- - **A tile now prefers the server's `unavailableReason`** over the reason it
27
- used to work out itself. The server knows things the browser cannot - chiefly
28
- "No recorder is configured for this camera's relay", which is the true answer
29
- for every camera in the estate until the API host is configured, and which the
30
- wall used to replace with its own guess. Offline still beats everything, since
31
- it explains every tile at once.
32
-
33
- No permission gate was invented here. Each application still gates its own menu
34
- entry; this component draws what it is given, and the server decides.
35
-
36
- Two smaller things in the same area:
37
-
38
- - **A refused wall now says so.** The catch-all message told every failure to
39
- "check your connection", which sends somebody who simply may not see that
40
- site off to debug their wifi. A 401/403/404 now reads "You do not have access
41
- to this site's cameras." The server answers "not yours" and "does not exist"
42
- identically, so this wording does not distinguish them either.
43
- - **`middleware/member.ts` is removed.** It read a cookie into an unused
44
- variable and did nothing else - a file named like a membership gate that was
45
- not one. No page in any of the eleven web apps referenced it. The real check
46
- is `plugins/secure-member.client.ts`, driven by `memberOnly` page meta, which
47
- is untouched.
@@ -1,60 +0,0 @@
1
- ---
2
- "@7365admin1/layer-common": patch
3
- ---
4
-
5
- Rewrite the camera wall's detail panel for the people who read it, and stop
6
- repeating the same sentence four times.
7
-
8
- The panel under the tiles was written for a developer. On the live wall it
9
- read:
10
-
11
- > BBQ AREA
12
- > The video page loaded, but this browser cannot confirm a picture is arriving.
13
- > The player belongs to the video service and a browser cannot look inside it.
14
- > Judge the tile by what you can see, and report a blank or frozen picture.
15
- > ● Recorder responding Last picture this server received: none yet
16
- > Firmware and device clock are not available: this recorder is reachable over
17
- > video only.
18
-
19
- Every one of those statements is true, and the screen was still wrong: it
20
- explained cross-origin isolation to a guard, repeated the camera's name the
21
- tile already showed, put a green light beside the words "none yet", and printed
22
- the same reason on four capability cards in a row.
23
-
24
- Changes, all copy and layout — **no behaviour, no capability gating and no
25
- permission check is touched**:
26
-
27
- - **The badge reads "Not confirmed"**, not "Not verified". "Not verified"
28
- describes a check we failed to make; "Not confirmed" describes the picture,
29
- which is the thing the reader cares about. Same claim, and the wall still
30
- refuses to say "Live" until the video service reports a decoded frame.
31
- - **The sentence behind it is now an instruction**: "This page cannot confirm
32
- the picture is arriving, so check the tile yourself. If it is blank or frozen,
33
- report the camera." Why the software cannot confirm it is our problem, and it
34
- has been removed from the product.
35
- - **The camera's name is no longer a heading of its own.** It is the subject of
36
- the status line — "BBQ AREA · Recorder responding" — so a reader on a 3x3 wall
37
- still knows which tile the panel describes, without a second caption under the
38
- first one.
39
- - **"Last picture" is drawn only when there has been one.** A green "Recorder
40
- responding" beside "none yet" read as a contradiction. They were never in
41
- conflict, but a screen that has to be explained is wrong. The tile's own
42
- health line has always behaved this way; the panel now matches it.
43
- - **The firmware-and-device-clock sentence is gone**, from the panel and from
44
- the tile's tooltip. This screen never showed either value, so explaining their
45
- absence gave the reader nothing to do. The server still sends
46
- `detailUnavailableReason`; nothing draws it.
47
- - **One reason for the group instead of four copies.** When every switched-off
48
- control is off for the same reason, that reason and its next step are stated
49
- once above the row and each card keeps only its title and its state. When the
50
- reasons differ — "the recorder is unreachable" and "this camera cannot move"
51
- are two problems with two different people to ask — the group note is refused
52
- and each card carries its own again. New rule 7, in `camera-wall.ts`, with
53
- four tests.
54
- - Shorter next-step and no-signal wording, and a subject on the recorder's
55
- status labels ("Recorder not checked yet" rather than "Health not checked
56
- yet").
57
-
58
- Rules 3 and 6 are intact: the server's own sentence is still shown verbatim and
59
- never rewritten, and the recorder's state is still a separate fact from the
60
- tile's badge.
@@ -1,65 +0,0 @@
1
- ---
2
- "@7365admin1/layer-common": patch
3
- ---
4
-
5
- Mark the selected camera on the wall, and stop telling the reader to raise a
6
- ticket without saying what for.
7
-
8
- Two things the owner found on the live wall after the last copy pass. Both are
9
- copy and presentation only — **no behaviour, no capability gating, no permission
10
- check and no request is changed.**
11
-
12
- **1. The camera's name was still printed twice.**
13
-
14
- The tile said `BBQ AREA` and the panel underneath said it again. The last pass
15
- merged the panel's heading into its status line, which changed the layout and
16
- left the repetition exactly where it was.
17
-
18
- The name was there to answer "which of these nine tiles is this panel about?".
19
- That is a real question and a name is the wrong answer to it — it makes the
20
- reader scan the wall for a matching caption. So:
21
-
22
- - **the selected tile is now visibly selected**: a 3 px accent ring with a scrim
23
- hairline inside it, so the ring holds against a bright picture as well as a
24
- dark one, plus the accent underline on the name chip that the toolbar already
25
- uses to mark a selected tool. Both read at 1x1, 2x2 and 3x3;
26
- - **the camera's name is removed from the panel entirely**. The panel opens on
27
- the recorder's state — "● Recorder responding";
28
- - `aria-current` marks the same tile for anyone not looking at the ring.
29
-
30
- The highlight had never worked in the most common case, which is why the name
31
- was load-bearing: it was bound to the raw clicked id, and before anyone clicks —
32
- or after paging — nothing on the wall was marked while the panel was already
33
- describing the first tile. It is now bound to the tile the panel actually
34
- resolves to, so the two can never disagree.
35
-
36
- **The panel can never be about a tile that is off screen**, so it never needs to
37
- name one: the focused camera is resolved out of the current PAGE, so paging away
38
- from a selection re-resolves to the first tile of the page in front of you and
39
- the ring follows. Paging back restores the original selection. Extracted as
40
- `focusedCamera()` in `camera-wall.ts` with four tests, including the 5-cameras
41
- -across-2-pages case.
42
-
43
- **2. "Ask your Seven365 administrator" was a dead end.**
44
-
45
- It was the whole of the advice under every switched-off control, and it tells
46
- the administrator nothing and a property manager only to go and wait. The screen
47
- never said what the request should ask for.
48
-
49
- The advice now names the two changes that are actually missing, because they are
50
- two different jobs for two different people: **the site's network has to let our
51
- server reach the camera recorder**, and **that recorder then has to be added to
52
- the server's configuration**. Both are stated in plain words, with who arranges
53
- them, and with the fact that neither is switchable from this page.
54
-
55
- No environment variable name appears in any of it — those belong in
56
- `iservice365-core/docs/camera-integration-config.md`, not on a property
57
- manager's screen — and there is a test that keeps it that way. The other reason
58
- codes (`device-http-disabled`, `device-http-unreachable`, `device-http-locked-out`,
59
- `control-not-enabled`, `no-recorder-configured`, and the unknown-code fallback)
60
- get the same treatment; the Site Settings ones already said what to do and are
61
- unchanged.
62
-
63
- The truthful-status rules are untouched: the wall still refuses to say "Live"
64
- until the video service reports a decoded frame, and the recorder's state is
65
- still a separate fact from the tile's badge.
@@ -1,39 +0,0 @@
1
- ---
2
- "@7365admin1/layer-common": patch
3
- ---
4
-
5
- Split the dark theme's `primary` into a foreground colour and a fill, so text
6
- using it is readable again.
7
-
8
- Dark `primary` was set to the brand navy `#17506F` so the navigation drawer
9
- would read as a surface. That is the right value for a fill — a white label on
10
- it measures 8.70:1 — but Vuetify emits `.text-primary` from the same token, so
11
- every `class="text-primary"` sentence and every `color="primary"` icon, spinner
12
- and text button rendered navy on a dark background:
13
-
14
- | | before | now |
15
- |---|---|---|
16
- | `primary` as text on the dark page `#0E1319` | 2.14:1 | **6.40:1** |
17
- | `primary` as text on a dark card `#1B242F` | 1.80:1 | **5.38:1** |
18
- | `primary` as text on `surface-bright` `#26313E`| 1.52:1 | **4.53:1** |
19
-
20
- Dark `primary` is now `#5B9BE0`. That is not a new colour: it is the blue the
21
- camera wall already draws its accents in (`--vms-accent`), so the two dark
22
- surfaces in this product agree on one blue.
23
-
24
- The navigation drawer no longer depends on `primary`. Both themes gain a
25
- `brand-surface` colour — `#042134` light (identical to light `primary`, so
26
- light mode renders exactly as before) and `#17506F` dark — and
27
- `Layout/NavigationDrawer.vue` is painted with it. Its white label still reads
28
- 16.51:1 light and 8.70:1 dark. `floating` was dropped from the drawer so it
29
- draws its own edge: the fill is 2.14:1 against the dark page, under the 3:1 a
30
- boundary wants, and the border at `border-opacity` 0.35 is 3.22:1.
31
-
32
- Where `primary` is still used as a fill, Vuetify derives `on-primary` from it
33
- and picks black, which reads at 7.21:1. What a light `primary` cannot carry is
34
- a hardcoded white label, and a handful of app-side sites still set one — see
35
- the pull request for the list.
36
-
37
- The light theme is unchanged. The colours moved to `utils/theme.ts` and
38
- `utils/theme.test.ts` now measures them, so a token cannot be moved for one use
39
- and quietly broken for the other again.