@7365admin1/layer-common 4.84.0 → 4.84.1-staging.482
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 +4 -4
- package/assets/css/primitives.css +107 -0
- package/assets/css/screens.css +8 -4
- package/components/AccessCardDetailsDialog.vue +57 -4
- package/components/AccessCardPreviewDialog.vue +291 -50
- package/components/AppSelect.vue +143 -4
- package/components/AttendanceDetailsDialog.vue +48 -1
- package/components/AttendanceMain.vue +104 -10
- package/components/AttendanceProxyDialog.vue +391 -0
- package/components/AttendanceSettingsDialog.vue +53 -1
- package/components/BuildingUnitFormEdit.vue +6 -0
- package/components/BuildingUnitManagement.vue +298 -0
- package/components/BulletinBoardView.vue +1 -1
- package/components/DashboardEmptyState.vue +8 -0
- package/components/DashboardMain.vue +14 -0
- package/components/DashboardPanel.vue +10 -0
- package/components/Dialog/UpdateMoreAction.vue +11 -1
- package/components/DocumentForm.vue +407 -112
- package/components/DocumentManagement.vue +213 -12
- package/components/Facility/BookingSetup.vue +63 -0
- package/components/HidAccessLogDashboard.vue +74 -17
- package/components/HidAccessPermissions.vue +424 -0
- package/components/HidIntercomManagement.vue +183 -14
- package/components/HidProfileQrCode.vue +332 -0
- package/components/HidQrCodeConfiguration.vue +17 -195
- package/components/HidReaderManagement.vue +398 -0
- package/components/HidReaderUserRoster.vue +44 -3
- package/components/HidUserEnrollment.vue +2239 -276
- package/components/InventoryMain.vue +11 -2
- package/components/InvitationClientForm.vue +19 -1
- package/components/MemberServiceProviders.vue +43 -45
- package/components/MyAttendanceMain.vue +60 -2
- package/components/NotificationBell.vue +14 -2
- package/components/TableMain.vue +22 -7
- package/components/VisitorForm.vue +12 -0
- package/components/VisitorManagement.vue +279 -7
- package/composables/useAttendance.ts +53 -0
- package/composables/useAttendancePermission.ts +25 -0
- package/composables/useCleaningPermission.ts +5 -0
- package/composables/useDocument.ts +7 -0
- package/composables/useFacility.ts +11 -0
- package/composables/useHidAmico.ts +165 -0
- package/composables/useHidNavigation.ts +25 -1
- package/composables/useHidReaderSelection.ts +50 -0
- package/composables/useLandscapingPermission.ts +5 -0
- package/composables/useMember.ts +12 -0
- package/composables/useNFCPatrolReportFilters.ts +21 -3
- package/composables/useNFCPatrolRoute.ts +8 -1
- package/composables/usePeople.ts +19 -0
- package/composables/usePestControlPermission.ts +5 -0
- package/composables/usePoolMaintenancePermission.ts +5 -0
- package/composables/useSecurityPermission.ts +5 -0
- package/composables/useServiceProvider.ts +45 -2
- package/composables/useSiteActions.ts +29 -0
- package/composables/useSiteCategory.ts +45 -0
- package/constants/permissions.ts +1 -0
- package/nuxt.config.ts +18 -0
- package/package.json +4 -2
- package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
- package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
- package/plugins/vuetify.ts +6 -0
- package/server/plugins/no-powered-by.ts +7 -0
- package/types/attendance.d.ts +13 -1
- package/types/document.d.ts +14 -0
- package/types/facility.d.ts +4 -0
- package/types/member.d.ts +4 -0
- package/types/people.d.ts +28 -1
- package/types/service-provider.d.ts +5 -0
- package/types/site.d.ts +7 -1
- package/utils/attendance-proxy.ts +110 -0
- package/utils/hid-enrolment-subject.ts +344 -0
- package/utils/hid-permission-assignments.ts +198 -0
- package/utils/hid-reader-selection.ts +52 -0
- package/utils/notification-target.ts +43 -4
- package/utils/occupancy-role.ts +109 -0
- package/utils/sanitize-html.ts +16 -0
- package/utils/security-headers.ts +52 -0
- package/utils/service-type.ts +30 -0
- package/utils/site-actions.ts +18 -0
- package/utils/site-provider-members.ts +37 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OWNER / OCCUPANT / PERSON IN CHARGE - the three standings a business
|
|
3
|
+
* tenancy has, and everything the product says about them.
|
|
4
|
+
*
|
|
5
|
+
* One list, because three screens read it: the form that asks the question
|
|
6
|
+
* (`PeopleFormMgmt`), the list and preview that print the answer back, and
|
|
7
|
+
* the row menu that reassigns it (`people-mgmt`). The values are the ones the
|
|
8
|
+
* server stores and validates - `OccupancyRoles` in core's `person.model.ts`
|
|
9
|
+
* - so a value added on one side has to be added on the other.
|
|
10
|
+
*/
|
|
11
|
+
export const OCCUPANCY_ROLE_OPTIONS: TOccupancyRoleOption[] = [
|
|
12
|
+
{
|
|
13
|
+
value: "owner",
|
|
14
|
+
title: "Owner",
|
|
15
|
+
action: "Assign Owner",
|
|
16
|
+
prompt: "Assign Owner",
|
|
17
|
+
description:
|
|
18
|
+
"The legal titleholder or primary deed owner of the property.",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: "occupant",
|
|
22
|
+
title: "Occupant",
|
|
23
|
+
action: "Assign Occupant",
|
|
24
|
+
prompt: "Assign Occupant",
|
|
25
|
+
description:
|
|
26
|
+
"The person currently living in, renting, or utilizing the physical unit.",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: "person-in-charge",
|
|
30
|
+
title: "Person in Charge",
|
|
31
|
+
action: "Assign Person in Charge",
|
|
32
|
+
prompt: "Assign Person in Charge (PIC)",
|
|
33
|
+
description:
|
|
34
|
+
"The designated manager responsible for maintenance, emergencies, and daily operations.",
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The same three, in the order the ROW MENU draws them, which is not the
|
|
40
|
+
* order the form's radio does. Derived rather than re-typed so the wording
|
|
41
|
+
* cannot drift between the two.
|
|
42
|
+
*/
|
|
43
|
+
export const OCCUPANCY_ROLE_ACTIONS: TOccupancyRoleOption[] = (
|
|
44
|
+
["person-in-charge", "owner", "occupant"] as TOccupancyRole[]
|
|
45
|
+
).map(
|
|
46
|
+
(value) =>
|
|
47
|
+
OCCUPANCY_ROLE_OPTIONS.find(
|
|
48
|
+
(option) => option.value === value,
|
|
49
|
+
) as TOccupancyRoleOption,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The label for a stored role, or "" for a person who was never asked - which
|
|
54
|
+
* is everyone on a residential site and everyone saved before the question
|
|
55
|
+
* existed. Callers decide what to print instead; nobody should print a raw
|
|
56
|
+
* `person-in-charge` at a user.
|
|
57
|
+
*/
|
|
58
|
+
export function occupancyRoleLabel(role?: string | null): string {
|
|
59
|
+
return (
|
|
60
|
+
OCCUPANCY_ROLE_OPTIONS.find((option) => option.value === role)?.title ?? ""
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Does this person hold OWNER at their unit?
|
|
66
|
+
*
|
|
67
|
+
* The role when there is one, `isOwner` when there is not - the same test the
|
|
68
|
+
* server applies (`holdsUnitOwner` in core's `unit-owner.util.ts`). A person
|
|
69
|
+
* recorded before the role existed carries only the flag, and the people list
|
|
70
|
+
* already prints them as "Owner".
|
|
71
|
+
*/
|
|
72
|
+
export function holdsUnitOwner(person?: {
|
|
73
|
+
occupancyRole?: string | null;
|
|
74
|
+
isOwner?: boolean;
|
|
75
|
+
}): boolean {
|
|
76
|
+
if (!person) return false;
|
|
77
|
+
|
|
78
|
+
if (person.occupancyRole) return person.occupancyRole === "owner";
|
|
79
|
+
|
|
80
|
+
return person.isOwner === true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* MUST THIS PERSON HAND THE UNIT OVER BEFORE THEY CAN BE DEACTIVATED?
|
|
85
|
+
*
|
|
86
|
+
* The owner of a unit does not leave while they still own it - the standing
|
|
87
|
+
* moves to another tenant at the same block, level and unit first.
|
|
88
|
+
*
|
|
89
|
+
* Keyed to the ROLE and never to `isOwner`, exactly as the server keys it
|
|
90
|
+
* (`mustHandOverBeforeDeactivating` in core): the flag is on every resident in
|
|
91
|
+
* the estate, and no residential screen can change it, so a rule keyed to it
|
|
92
|
+
* would trap records that can never satisfy it.
|
|
93
|
+
*/
|
|
94
|
+
export function mustHandOverBeforeDeactivating(person?: {
|
|
95
|
+
occupancyRole?: string | null;
|
|
96
|
+
}): boolean {
|
|
97
|
+
return person?.occupancyRole === "owner";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Why a deactivation was held back. The SERVER carries the enforcing copy of
|
|
102
|
+
* this rule and of these words (core `unit-owner.util.ts`); this one exists so
|
|
103
|
+
* the console can say it before the round trip rather than after.
|
|
104
|
+
*/
|
|
105
|
+
export function ownerHandoverRequiredMessage(name?: string): string {
|
|
106
|
+
const who = name?.trim() ? `"${name.trim()}"` : "This person";
|
|
107
|
+
|
|
108
|
+
return `${who} is the owner of this unit. Assign the owner role to another tenant at the same block, level and unit before deactivating them.`;
|
|
109
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import DOMPurify from "dompurify";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The one way rich text typed by a user (announcements, facility descriptions,
|
|
5
|
+
* policies) reaches `v-html`. Keeps formatting, drops scripts, event handlers,
|
|
6
|
+
* `javascript:` links and embedded frames/forms. Browser-only (the apps are
|
|
7
|
+
* `ssr: false`); without a DOM it returns "" rather than unsanitised HTML.
|
|
8
|
+
*/
|
|
9
|
+
export function sanitizeHtml(html: unknown): string {
|
|
10
|
+
if (html === null || html === undefined || html === "") return "";
|
|
11
|
+
if (typeof window === "undefined" || !DOMPurify.isSupported) return "";
|
|
12
|
+
return DOMPurify.sanitize(String(html), {
|
|
13
|
+
USE_PROFILES: { html: true },
|
|
14
|
+
FORBID_TAGS: ["style", "form", "input", "button", "iframe", "object", "embed"],
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response headers every web app sends, on the HTML shell (Nitro route rules)
|
|
3
|
+
* and on the static files (nitro writes the same rules into Cloudflare's
|
|
4
|
+
* `_headers`). One list, so the eleven apps cannot drift apart.
|
|
5
|
+
*
|
|
6
|
+
* The ENFORCED Content-Security-Policy only carries the directives that cannot
|
|
7
|
+
* break a screen: who may frame us (clickjacking), no plugins, no <base> swap.
|
|
8
|
+
* The full policy ships as Report-Only first: the apps load Google Fonts,
|
|
9
|
+
* camera players and documents in iframes, sockets and the Spaces CDN, and a
|
|
10
|
+
* wrong guess there blanks a page. Violations show in the browser console;
|
|
11
|
+
* once a release runs clean, move it to the enforced header.
|
|
12
|
+
*
|
|
13
|
+
* HSTS deliberately has no `preload`: preload is decided for the whole
|
|
14
|
+
* iservice365.org domain at the apex and is hard to undo (owner/leads action).
|
|
15
|
+
*/
|
|
16
|
+
export const CSP_ENFORCED = [
|
|
17
|
+
"frame-ancestors 'self'",
|
|
18
|
+
"object-src 'none'",
|
|
19
|
+
"base-uri 'self'",
|
|
20
|
+
].join("; ");
|
|
21
|
+
|
|
22
|
+
export const CSP_REPORT_ONLY = [
|
|
23
|
+
"default-src 'self'",
|
|
24
|
+
"script-src 'self'",
|
|
25
|
+
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
|
|
26
|
+
"font-src 'self' data: https://fonts.gstatic.com",
|
|
27
|
+
"img-src 'self' data: blob: https:",
|
|
28
|
+
"media-src 'self' blob: https:",
|
|
29
|
+
"connect-src 'self' https: wss:",
|
|
30
|
+
"frame-src 'self' https:",
|
|
31
|
+
"worker-src 'self' blob:",
|
|
32
|
+
"object-src 'none'",
|
|
33
|
+
"base-uri 'self'",
|
|
34
|
+
"frame-ancestors 'self'",
|
|
35
|
+
"form-action 'self' https:",
|
|
36
|
+
"upgrade-insecure-requests",
|
|
37
|
+
].join("; ");
|
|
38
|
+
|
|
39
|
+
export const SECURITY_HEADERS: Record<string, string> = {
|
|
40
|
+
"strict-transport-security": "max-age=31536000; includeSubDomains",
|
|
41
|
+
"x-content-type-options": "nosniff",
|
|
42
|
+
"x-frame-options": "SAMEORIGIN",
|
|
43
|
+
"referrer-policy": "strict-origin-when-cross-origin",
|
|
44
|
+
// camera/mic: QR scan, photo capture; geolocation: attendance;
|
|
45
|
+
// usb/serial/hid: card readers (useWebUsb). Everything else is off.
|
|
46
|
+
"permissions-policy":
|
|
47
|
+
"camera=(self), microphone=(self), geolocation=(self), usb=(self), serial=(self), hid=(self), payment=(self), display-capture=(self), bluetooth=(), midi=(), magnetometer=(), gyroscope=(), accelerometer=()",
|
|
48
|
+
// allow-popups: payment and document windows we open keep working.
|
|
49
|
+
"cross-origin-opener-policy": "same-origin-allow-popups",
|
|
50
|
+
"content-security-policy": CSP_ENFORCED,
|
|
51
|
+
"content-security-policy-report-only": CSP_REPORT_ONLY,
|
|
52
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A SERVICE PROVIDER'S LINE OF BUSINESS, AS PEOPLE NAME IT.
|
|
3
|
+
*
|
|
4
|
+
* `/api/service-providers` returns the service CODE (`mechanical_electrical_services`),
|
|
5
|
+
* which is a database value, not something to show an operator. This is the same
|
|
6
|
+
* mapping `API-core src/utils/converter.ts spmServiceNewToOld` applies — copied
|
|
7
|
+
* rather than imported, because that is a server package this layer does not
|
|
8
|
+
* depend on.
|
|
9
|
+
*
|
|
10
|
+
* NOT the same labels as `utils/module-applications.ts APPLICATIONS`. Those name
|
|
11
|
+
* the seven role-permission applications ("Mechanical & electrical", "Pest
|
|
12
|
+
* control") and are keyed `mechanical-electrical`, not `*_services`. These are
|
|
13
|
+
* the shorter names the service-provider screens use ("M&E", "Pest Control").
|
|
14
|
+
*
|
|
15
|
+
* An unknown code is returned untouched: a new service type shows as its raw
|
|
16
|
+
* code, which is visibly odd, rather than vanishing from the row.
|
|
17
|
+
*/
|
|
18
|
+
const SERVICE_TYPE_LABELS: Readonly<Record<string, string>> = Object.freeze({
|
|
19
|
+
security_agency: "Security",
|
|
20
|
+
cleaning_services: "Cleaning",
|
|
21
|
+
pool_maintenance_services: "Pool Maintenance",
|
|
22
|
+
pest_control_services: "Pest Control",
|
|
23
|
+
landscaping_services: "Landscape",
|
|
24
|
+
mechanical_electrical_services: "Mechanical & Electrical",
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export function serviceTypeLabel(service: string | null | undefined): string {
|
|
28
|
+
const code = String(service ?? "");
|
|
29
|
+
return SERVICE_TYPE_LABELS[code] ?? code;
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the signed-in person may do with an organisation's sites, as core
|
|
3
|
+
* answers it (`GET /api/customer-sites?withActions=true` -> `siteActions`).
|
|
4
|
+
*
|
|
5
|
+
* Owner rule 2026-10-01: creating, deleting or removing sites is for Seven365
|
|
6
|
+
* Super Admin, the organisation's owner and organisation-level members with the
|
|
7
|
+
* right; a member confined to sites never - whatever their role says. The
|
|
8
|
+
* server decides and refuses (403); the UI only hides what would be refused.
|
|
9
|
+
* Anything missing or unreadable reads as "no" (the button stays hidden).
|
|
10
|
+
*/
|
|
11
|
+
export type TSiteActions = { create: boolean; delete: boolean; createCustomer: boolean };
|
|
12
|
+
|
|
13
|
+
export const NO_SITE_ACTIONS: TSiteActions = Object.freeze({ create: false, delete: false, createCustomer: false });
|
|
14
|
+
|
|
15
|
+
export function siteActionsOf(response: unknown): TSiteActions {
|
|
16
|
+
const a = (response as { siteActions?: Record<string, unknown> } | null)?.siteActions ?? {};
|
|
17
|
+
return { create: a.create === true, delete: a.delete === true, createCustomer: a.createCustomer === true };
|
|
18
|
+
}
|
|
@@ -43,6 +43,43 @@ export function companyChipText(name: string, people: number): string {
|
|
|
43
43
|
return `${name || "Unnamed company"} · ${people} ${people === 1 ? "person" : "people"}`;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* The Company filter (owner 2026-10-02: a proper filter instead of a row of
|
|
48
|
+
* company chips): one entry per company, narrowed to the chosen service,
|
|
49
|
+
* named with its service, head count and who brought it in.
|
|
50
|
+
*/
|
|
51
|
+
export function companyFilterItems(
|
|
52
|
+
companies: Array<{ orgId: string; name?: string; type?: string; typeLabel?: string; people: number; invitedVia?: string }>,
|
|
53
|
+
type = "",
|
|
54
|
+
): Array<{ title: string; value: string; subtitle: string }> {
|
|
55
|
+
return companies
|
|
56
|
+
.filter((c) => !type || c.type === type)
|
|
57
|
+
.map((c) => ({
|
|
58
|
+
title: c.name || "Unnamed company",
|
|
59
|
+
value: c.orgId,
|
|
60
|
+
subtitle: [
|
|
61
|
+
c.typeLabel || c.type || "",
|
|
62
|
+
`${c.people} ${c.people === 1 ? "person" : "people"}`,
|
|
63
|
+
c.invitedVia ? `via ${c.invitedVia}` : "",
|
|
64
|
+
]
|
|
65
|
+
.filter(Boolean)
|
|
66
|
+
.join(" · "),
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** "7 companies · 37 people · 1 company has not added anyone yet" */
|
|
71
|
+
export function providerSummaryText(companies: Array<{ people: number }>): string {
|
|
72
|
+
const people = companies.reduce((n, c) => n + (c.people || 0), 0);
|
|
73
|
+
const idle = companies.filter((c) => !c.people).length;
|
|
74
|
+
return [
|
|
75
|
+
`${companies.length} ${companies.length === 1 ? "company" : "companies"}`,
|
|
76
|
+
`${people} ${people === 1 ? "person" : "people"}`,
|
|
77
|
+
idle ? `${idle} ${idle === 1 ? "company has" : "companies have"} not added anyone yet` : "",
|
|
78
|
+
]
|
|
79
|
+
.filter(Boolean)
|
|
80
|
+
.join(" · ");
|
|
81
|
+
}
|
|
82
|
+
|
|
46
83
|
/** What an empty table says: nothing on site, nobody added yet, or the filters. */
|
|
47
84
|
export function providerMembersEmptyText({
|
|
48
85
|
companies,
|