@7365admin1/layer-common 4.5.1-staging.300 → 4.6.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.
- package/CHANGELOG.md +20 -4
- package/components/AreaChecklistHistoryLogs.vue +0 -81
- package/components/Chat/Bubbles.vue +30 -94
- package/components/Chat/Message.vue +67 -281
- package/components/Facility/BookingSetup.vue +0 -63
- package/components/FeedbackDetail.vue +1 -1
- package/components/HidIntercomManagement.vue +42 -145
- package/components/HidReaderUserRoster.vue +2 -32
- package/components/HidUserEnrollment.vue +212 -771
- package/components/InvitationClientForm.vue +1 -19
- package/components/ManageChecklistMain.vue +2 -34
- package/components/SwitchContext.vue +2 -46
- package/components/VisitorManagement.vue +5 -267
- package/components/WorkOrder/Detail.vue +1 -1
- package/composables/useCleaningPermission.ts +0 -5
- package/composables/useComment.ts +1 -9
- package/composables/useFacility.ts +0 -11
- package/composables/useHidAmico.ts +0 -73
- package/composables/useHidNavigation.ts +1 -25
- package/composables/useLandscapingPermission.ts +0 -5
- package/composables/useMechanicalElectricalPermission.ts +0 -6
- package/composables/usePeople.ts +0 -19
- package/composables/usePestControlPermission.ts +0 -5
- package/composables/usePoolMaintenancePermission.ts +0 -5
- package/composables/usePropertyPermission.ts +0 -5
- package/composables/useSecurityPermission.ts +0 -5
- package/package.json +1 -1
- package/types/cleaner-schedule.d.ts +0 -2
- package/types/comment.d.ts +0 -2
- package/types/facility.d.ts +0 -4
- package/types/people.d.ts +1 -4
- package/utils/materialSymbols.ts +0 -3
- package/components/HidProfileQrCode.vue +0 -323
- package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +0 -23
- package/utils/chat-sender.ts +0 -47
- package/utils/module-applications.ts +0 -146
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import useSecurityPermission from "../composables/useSecurityPermission";
|
|
2
|
-
import useCleaningPermission from "../composables/useCleaningPermission";
|
|
3
|
-
import useLandscapingPermission from "../composables/useLandscapingPermission";
|
|
4
|
-
import useMechanicalElectricalPermission from "../composables/useMechanicalElectricalPermission";
|
|
5
|
-
import usePestControlPermission from "../composables/usePestControlPermission";
|
|
6
|
-
import usePoolMaintenancePermission from "../composables/usePoolMaintenancePermission";
|
|
7
|
-
import usePropertyPermission from "../composables/usePropertyPermission";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* WHICH APPLICATION EACH MODULE BELONGS TO.
|
|
11
|
-
*
|
|
12
|
-
* Owner report, 2026-09-10: *"I check security company and nature of business is
|
|
13
|
-
* security but have cleaning schedule management."* The Seven365 console's
|
|
14
|
-
* "Modules offered to this client" card listed the whole 47-entry catalogue as
|
|
15
|
-
* one flat alphabetical list, with nothing to say which service each module is
|
|
16
|
-
* part of — so a security client was offered Cleaning schedule management, and a
|
|
17
|
-
* cleaning client was offered Virtual patrol.
|
|
18
|
-
*
|
|
19
|
-
* R1 is written in terms of APPLICATIONS: *"assigns roles & permissions to an
|
|
20
|
-
* ORGANISATION for the applications it needs (Security, Cleaning, Pest, M&E, MA,
|
|
21
|
-
* Landscape, Pool)."* This is the map that makes that possible.
|
|
22
|
-
*
|
|
23
|
-
* ## DERIVED, never hand-written
|
|
24
|
-
*
|
|
25
|
-
* Each application's role editor already declares exactly what it offers — its
|
|
26
|
-
* `use*Permission` composable IS that declaration, and it is the same object the
|
|
27
|
-
* app passes to `RolePermissionMain` as `:permissions`. So the grouping is read
|
|
28
|
-
* from those composables at load time rather than copied out of them.
|
|
29
|
-
*
|
|
30
|
-
* A hand-written list would be correct on the day it was written and wrong the
|
|
31
|
-
* first time somebody adds a module to an app — silently, because nothing would
|
|
32
|
-
* fail. Deriving it means the console cannot disagree with the apps.
|
|
33
|
-
*
|
|
34
|
-
* The composables are pure (no Nuxt APIs, no lifecycle hooks), so calling them
|
|
35
|
-
* here is safe and costs one object construction each.
|
|
36
|
-
*
|
|
37
|
-
* ## A module can belong to SEVERAL applications, and that is not a mistake
|
|
38
|
-
*
|
|
39
|
-
* `cleaning-schedule-mgmt` is offered by BOTH Cleaning and M&E — M&E reuses the
|
|
40
|
-
* cleaning schedule module deliberately (`useMechanicalElectricalPermission`
|
|
41
|
-
* takes it from `useCleaningPermission`). `attendance-mgmt`, `site-settings`,
|
|
42
|
-
* `members`, `roles` and `invitations` are shared by nearly all of them.
|
|
43
|
-
*
|
|
44
|
-
* So this is a MANY-TO-MANY map, and the console has to show a shared module
|
|
45
|
-
* under each application that offers it. Presenting it as one-to-one would be
|
|
46
|
-
* the same class of wrongness as the flat list it replaces.
|
|
47
|
-
*
|
|
48
|
-
* ## It still stores a flat list of module keys
|
|
49
|
-
*
|
|
50
|
-
* `organizations.modules` is unchanged — a flat array of resource keys. Ticking
|
|
51
|
-
* an application ticks its keys. Nothing about the cascade, the server contract
|
|
52
|
-
* or the fail-open rule changes; this is how the choice is PRESENTED.
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
/** The seven service applications, in the order the owner names them in R1. */
|
|
56
|
-
export const APPLICATIONS = [
|
|
57
|
-
{ key: "security", label: "Security", composable: useSecurityPermission },
|
|
58
|
-
{ key: "cleaning", label: "Cleaning", composable: useCleaningPermission },
|
|
59
|
-
{ key: "pest", label: "Pest control", composable: usePestControlPermission },
|
|
60
|
-
{
|
|
61
|
-
key: "mechanical-electrical",
|
|
62
|
-
label: "Mechanical & electrical",
|
|
63
|
-
composable: useMechanicalElectricalPermission,
|
|
64
|
-
},
|
|
65
|
-
{ key: "landscape", label: "Landscape", composable: useLandscapingPermission },
|
|
66
|
-
{ key: "pool", label: "Pool maintenance", composable: usePoolMaintenancePermission },
|
|
67
|
-
{
|
|
68
|
-
key: "property-management",
|
|
69
|
-
label: "Property management",
|
|
70
|
-
composable: usePropertyPermission,
|
|
71
|
-
},
|
|
72
|
-
] as const;
|
|
73
|
-
|
|
74
|
-
export type ApplicationKey = (typeof APPLICATIONS)[number]["key"];
|
|
75
|
-
|
|
76
|
-
export type ApplicationModules = {
|
|
77
|
-
key: string;
|
|
78
|
-
label: string;
|
|
79
|
-
/** The resource keys this application's role editor offers. */
|
|
80
|
-
modules: string[];
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
/** Read one application's resource keys straight out of its own catalogue. */
|
|
84
|
-
function modulesOf(composable: () => { permissions?: Record<string, unknown> }): string[] {
|
|
85
|
-
try {
|
|
86
|
-
const { permissions } = composable() ?? {};
|
|
87
|
-
if (!permissions || typeof permissions !== "object") return [];
|
|
88
|
-
return Object.keys(permissions).filter(Boolean);
|
|
89
|
-
} catch {
|
|
90
|
-
/*
|
|
91
|
-
* FAILS OPEN as an empty list, never a throw. This runs at module load in
|
|
92
|
-
* the console; a composable that changes shape must not take the whole
|
|
93
|
-
* client-configuration screen down with it — the screen falls back to the
|
|
94
|
-
* ungrouped catalogue, which is exactly what it showed before this existed.
|
|
95
|
-
*/
|
|
96
|
-
return [];
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/** Every application with the modules it offers, derived from the apps themselves. */
|
|
101
|
-
export function applicationModules(): ApplicationModules[] {
|
|
102
|
-
return APPLICATIONS.map((app) => ({
|
|
103
|
-
key: app.key,
|
|
104
|
-
label: app.label,
|
|
105
|
-
modules: modulesOf(app.composable as never),
|
|
106
|
-
}));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/** Which applications offer this module. Empty means none of the seven do. */
|
|
110
|
-
export function applicationsForModule(resource: string): string[] {
|
|
111
|
-
if (!resource) return [];
|
|
112
|
-
return applicationModules()
|
|
113
|
-
.filter((app) => app.modules.includes(resource))
|
|
114
|
-
.map((app) => app.label);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Group a catalogue's keys by application, plus everything left over.
|
|
119
|
-
*
|
|
120
|
-
* The leftovers matter: `constants/permissions.ts` and the seven composables are
|
|
121
|
-
* two different lists and they do NOT agree — `customers`, `sites`,
|
|
122
|
-
* `subscriptions` and `robot-mgmt` appear in the flat catalogue but in no
|
|
123
|
-
* application, and `access-control`, `passes-and-keys-mgmt`, `online-forms`,
|
|
124
|
-
* `blocklist` and `resident-transactions` are the reverse. Dropping either set
|
|
125
|
-
* silently would be worse than showing it: an unticked module a client needs is
|
|
126
|
-
* a module they cannot be given.
|
|
127
|
-
*/
|
|
128
|
-
export function groupModulesByApplication(catalogueKeys: readonly string[]): {
|
|
129
|
-
groups: ApplicationModules[];
|
|
130
|
-
ungrouped: string[];
|
|
131
|
-
} {
|
|
132
|
-
const keys = Array.isArray(catalogueKeys) ? catalogueKeys.filter(Boolean) : [];
|
|
133
|
-
const apps = applicationModules();
|
|
134
|
-
|
|
135
|
-
const groups = apps
|
|
136
|
-
.map((app) => ({
|
|
137
|
-
...app,
|
|
138
|
-
modules: app.modules.filter((module) => keys.includes(module)),
|
|
139
|
-
}))
|
|
140
|
-
.filter((app) => app.modules.length > 0);
|
|
141
|
-
|
|
142
|
-
const claimed = new Set(groups.flatMap((app) => app.modules));
|
|
143
|
-
const ungrouped = keys.filter((key) => !claimed.has(key));
|
|
144
|
-
|
|
145
|
-
return { groups, ungrouped };
|
|
146
|
-
}
|