@7365admin1/layer-common 4.97.1-staging.681 → 4.97.1-staging.683
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.
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span
|
|
2
|
+
<span
|
|
3
|
+
class="access-owner-badge"
|
|
4
|
+
:class="{
|
|
5
|
+
'access-owner-badge--me': label === 'Me',
|
|
6
|
+
'access-owner-badge--unlinked': label === 'Not linked',
|
|
7
|
+
}"
|
|
8
|
+
>
|
|
3
9
|
{{ label }}
|
|
10
|
+
<v-tooltip v-if="label === 'Not linked'" activator="parent" location="top">
|
|
11
|
+
{{ NOT_LINKED_HINT }}
|
|
12
|
+
</v-tooltip>
|
|
4
13
|
</span>
|
|
5
14
|
</template>
|
|
6
15
|
|
|
@@ -23,4 +32,8 @@ defineProps<{ label: string }>();
|
|
|
23
32
|
color: rgb(var(--v-theme-primary));
|
|
24
33
|
font-weight: 600;
|
|
25
34
|
}
|
|
35
|
+
.access-owner-badge--unlinked {
|
|
36
|
+
border-style: dashed;
|
|
37
|
+
color: rgba(var(--v-theme-on-surface), 0.7);
|
|
38
|
+
}
|
|
26
39
|
</style>
|
|
@@ -1151,7 +1151,7 @@ function mapAccessLogToRow(rawLog: HidAccessRecord, event: HidAccessRecord, inde
|
|
|
1151
1151
|
owner: accessOwnerLabel(
|
|
1152
1152
|
identity || eventIdentity,
|
|
1153
1153
|
currentUser.value?._id,
|
|
1154
|
-
identity && isVisitorIdentity(identity) ? "Visitor" : "
|
|
1154
|
+
identity && isVisitorIdentity(identity) ? "Visitor" : "Not linked",
|
|
1155
1155
|
),
|
|
1156
1156
|
name: getRawLogName(rawLog, event, identity),
|
|
1157
1157
|
hidUserId: formatHidUid(rawLog.user_id ?? rawLog.userId ?? rawLog.hidUserId ?? identity?.hidUserId),
|
|
@@ -212,7 +212,7 @@ const { currentUser } = useLocalAuth();
|
|
|
212
212
|
// Whose access: own ("Me") or a person the site manages. Filters this page.
|
|
213
213
|
const ownerFilter = ref("all");
|
|
214
214
|
const ownerOf = (user: HidReaderUser) =>
|
|
215
|
-
accessOwnerLabel(user, currentUser.value?._id, isVisitor(user) ? "Visitor" : "
|
|
215
|
+
accessOwnerLabel(user, currentUser.value?._id, isVisitor(user) ? "Visitor" : "Not linked");
|
|
216
216
|
const visibleUsers = computed(() =>
|
|
217
217
|
ownerFilter.value === "all" ? users.value : users.value.filter((user) => ownerOf(user) === ownerFilter.value),
|
|
218
218
|
);
|
|
@@ -298,6 +298,18 @@
|
|
|
298
298
|
@update:model-value="onSubjectCategoryChanged"
|
|
299
299
|
/>
|
|
300
300
|
<p v-else-if="selectedUser" class="field-hint mb-3">{{ subjectCategoryLabel }}</p>
|
|
301
|
+
<!-- An UNMAPPED user (created on the reader itself, or enrolled before
|
|
302
|
+
enrolment linked a person) belongs to nobody in iService365, so no
|
|
303
|
+
Service365 / member app can show it. An edit cannot add the link -
|
|
304
|
+
the subject is chosen at enrolment - so say so before the save,
|
|
305
|
+
not after the person asks why their access is missing. -->
|
|
306
|
+
<p
|
|
307
|
+
v-if="selectedUser && !hasMappedRecord(selectedUser)"
|
|
308
|
+
class="field-hint field-hint--error mb-3"
|
|
309
|
+
data-test="hid-unlinked-warning"
|
|
310
|
+
>
|
|
311
|
+
{{ UNLINKED_HID_USER_WARNING }}
|
|
312
|
+
</p>
|
|
301
313
|
<!-- WHY THERE IS NOTHING TO PICK. Drawn in place of the dropdown when
|
|
302
314
|
the reader serves nobody, and beneath it when only some types were
|
|
303
315
|
removed. Without it, a missing option reads as a screen that failed
|
|
@@ -3339,9 +3351,15 @@ async function saveUser() {
|
|
|
3339
3351
|
fanOutRunning.value = false;
|
|
3340
3352
|
|
|
3341
3353
|
const summary = editFanOutSummary(readerOutcomes.value, Boolean(form.accessPin));
|
|
3354
|
+
const savedUnlinked = !hasMappedRecord(selectedUser.value as HidUser);
|
|
3342
3355
|
await loadUsers();
|
|
3343
3356
|
if (summary.tone === "success") formDialog.value = false;
|
|
3344
|
-
showToast(
|
|
3357
|
+
showToast(
|
|
3358
|
+
summary.tone === "success" && savedUnlinked
|
|
3359
|
+
? `${summary.message} ${UNLINKED_HID_USER_WARNING}`
|
|
3360
|
+
: summary.message,
|
|
3361
|
+
summary.tone !== "success" ? "error" : savedUnlinked ? "warning" : "success",
|
|
3362
|
+
);
|
|
3345
3363
|
return;
|
|
3346
3364
|
} else {
|
|
3347
3365
|
/*
|
|
@@ -4542,7 +4560,15 @@ function getMappingStatus(user: HidUser) {
|
|
|
4542
4560
|
return hasMappedRecord(user) ? "Mapped" : "Unmapped";
|
|
4543
4561
|
}
|
|
4544
4562
|
|
|
4563
|
+
/** Shown on an edit of, and after saving, a HID user linked to nobody. */
|
|
4564
|
+
const UNLINKED_HID_USER_WARNING =
|
|
4565
|
+
"Not linked to anyone in iService365, so this access will not show in their"
|
|
4566
|
+
+ " Service365 app. To give the person app access, delete this HID user and"
|
|
4567
|
+
+ " enroll them again with their name selected.";
|
|
4568
|
+
|
|
4545
4569
|
function hasMappedRecord(user: HidUser) {
|
|
4570
|
+
// Reader-user rows carry the link flag on `identity` (API `linked`).
|
|
4571
|
+
if (toRecord(user?.identity).linked === true) return true;
|
|
4546
4572
|
return Boolean(
|
|
4547
4573
|
user?.person ||
|
|
4548
4574
|
user?.user ||
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.97.1-staging.
|
|
5
|
+
"version": "4.97.1-staging.683",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Reads the identity the API attaches to a reader user / access log
|
|
7
7
|
* (`identity.type`, `identity.user`, `identity.serviceProvider`) or an
|
|
8
|
-
* Entrypass card (`holderType`, `userId`). Anything it cannot place is
|
|
8
|
+
* Entrypass card (`holderType`, `userId`). Anything it cannot place is
|
|
9
|
+
* "Not linked" - the record names nobody in iService365 (Edit → choose the
|
|
10
|
+
* member to link). Never guessed from a name.
|
|
9
11
|
*/
|
|
10
12
|
export const ACCESS_OWNER_LABELS = [
|
|
11
13
|
"Me",
|
|
@@ -15,9 +17,12 @@ export const ACCESS_OWNER_LABELS = [
|
|
|
15
17
|
"Service Provider",
|
|
16
18
|
"Visitor",
|
|
17
19
|
"Management",
|
|
20
|
+
"Not linked",
|
|
18
21
|
] as const;
|
|
19
22
|
|
|
20
|
-
export
|
|
23
|
+
export const NOT_LINKED_HINT = "Edit → choose the member to link";
|
|
24
|
+
|
|
25
|
+
export type AccessOwnerLabel = (typeof ACCESS_OWNER_LABELS)[number];
|
|
21
26
|
|
|
22
27
|
type Rec = Record<string, unknown>;
|
|
23
28
|
|
|
@@ -45,7 +50,7 @@ const TYPE_LABELS: Record<string, AccessOwnerLabel> = {
|
|
|
45
50
|
export function accessOwnerLabel(
|
|
46
51
|
record: unknown,
|
|
47
52
|
myUserId: unknown,
|
|
48
|
-
fallback: AccessOwnerLabel = "
|
|
53
|
+
fallback: AccessOwnerLabel = "Not linked",
|
|
49
54
|
): AccessOwnerLabel {
|
|
50
55
|
const row = asRec(record);
|
|
51
56
|
const identity = { ...row, ...asRec(row.identity) };
|
|
@@ -58,12 +63,15 @@ export function accessOwnerLabel(
|
|
|
58
63
|
return TYPE_LABELS[type] ?? fallback;
|
|
59
64
|
}
|
|
60
65
|
|
|
61
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* "Name · 13 Nov 2026"; "Before tracking started" when the API flags a record
|
|
68
|
+
* written before issuers were kept (`preTracking`); else "Not recorded".
|
|
69
|
+
*/
|
|
62
70
|
export function issuedByLabel(record: unknown): string {
|
|
63
71
|
const row = asRec(record);
|
|
64
72
|
const name = text(row.issuedByName);
|
|
65
73
|
const at = text(row.issuedAt);
|
|
66
|
-
if (!name && !at) return "Not recorded";
|
|
74
|
+
if (!name && !at) return row.preTracking === true ? "Before tracking started" : "Not recorded";
|
|
67
75
|
const date = at ? new Date(at) : null;
|
|
68
76
|
const when =
|
|
69
77
|
date && !Number.isNaN(date.getTime())
|