@7365admin1/layer-common 4.97.1-staging.699 → 4.97.1-staging.701
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.
|
@@ -202,6 +202,7 @@ import usePassKey from "../composables/usePassKey";
|
|
|
202
202
|
import useUtils from "../composables/useUtils";
|
|
203
203
|
import usePeople from "../composables/usePeople";
|
|
204
204
|
import { errorConverter } from "../utils/data";
|
|
205
|
+
import { isCompletePhoneNumber } from "../utils/phone-complete";
|
|
205
206
|
import {
|
|
206
207
|
DELETE_PERSON_TITLE,
|
|
207
208
|
PERSON_DELETED_MESSAGE,
|
|
@@ -502,13 +503,16 @@ const memberSelectedContactOptions = computed(() => {
|
|
|
502
503
|
: [];
|
|
503
504
|
});
|
|
504
505
|
|
|
505
|
-
// Member NRIC / phone lookups (isecure365 `scheduleMemberLookup`): 4
|
|
506
|
-
// characters or more, 500 ms after the last
|
|
506
|
+
// Member NRIC / phone lookups (isecure365 `scheduleMemberLookup`): NRIC 4
|
|
507
|
+
// characters or more, the phone only once complete, 500 ms after the last
|
|
508
|
+
// keystroke, across every visitor
|
|
507
509
|
// type. One person is filled in straight away (or the chooser opens).
|
|
508
510
|
const lookupTimers: Record<string, ReturnType<typeof setTimeout> | undefined> = {};
|
|
509
511
|
|
|
510
512
|
function memberTerm(by: "nric" | "contact") {
|
|
511
|
-
|
|
513
|
+
if (by === "nric") return memberForm.nric?.trim() || "";
|
|
514
|
+
// The phone only once the whole number is typed (see isCompletePhoneNumber).
|
|
515
|
+
return isCompletePhoneNumber(memberForm.contact) ? memberForm.contact.trim() : "";
|
|
512
516
|
}
|
|
513
517
|
|
|
514
518
|
function scheduleMemberLookup(by: "nric" | "contact") {
|
|
@@ -34,7 +34,12 @@
|
|
|
34
34
|
</v-row>
|
|
35
35
|
</v-col>
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
<!--
|
|
38
|
+
Read-only: a role made inside a site belongs to that site. With no
|
|
39
|
+
site (organisation-level roles) there is nothing to show, so say
|
|
40
|
+
where per-site roles are made instead of an empty locked box.
|
|
41
|
+
-->
|
|
42
|
+
<v-col v-if="props.siteState && props.siteId" cols="12" class="mt-2">
|
|
38
43
|
<v-row no-gutters>
|
|
39
44
|
<InputLabel title="Site" />
|
|
40
45
|
<v-col cols="12">
|
|
@@ -48,6 +53,12 @@
|
|
|
48
53
|
</v-col>
|
|
49
54
|
</v-row>
|
|
50
55
|
</v-col>
|
|
56
|
+
<v-col v-else-if="props.siteState" cols="12" class="mt-2">
|
|
57
|
+
<p class="text-body-2 text-medium-emphasis mb-0" data-test="role-form-no-site-hint">
|
|
58
|
+
This role is for the whole organisation. To make a role for one site, open
|
|
59
|
+
Sites, choose the site, then Roles & Permissions.
|
|
60
|
+
</p>
|
|
61
|
+
</v-col>
|
|
51
62
|
|
|
52
63
|
<v-col cols="12" class="mt-2">
|
|
53
64
|
<AppButton
|
|
@@ -846,6 +846,7 @@ import { hidQrUsageFromSettings, minutesUntilEndOfDay } from "../utils/hid-qr-va
|
|
|
846
846
|
import useFile from "../composables/useFile";
|
|
847
847
|
import usePassKey from "../composables/usePassKey";
|
|
848
848
|
import { defaultGateForSite } from "../utils/visitor-camera";
|
|
849
|
+
import { isCompletePhoneNumber } from "../utils/phone-complete";
|
|
849
850
|
import { barrierCameraOf, barrierOf, type TBarrierOutcome } from "../utils/visitor-barrier";
|
|
850
851
|
import VisitorPassKeyQRScanner from "./VisitorPassKeyQRScanner.vue";
|
|
851
852
|
import {
|
|
@@ -1389,8 +1390,9 @@ const companyCombo = ref(null);
|
|
|
1389
1390
|
/*
|
|
1390
1391
|
* People lookup and autofill, as the security mobile app (isecure365 `add.tsx`
|
|
1391
1392
|
* lookup / choosePerson / applyPerson):
|
|
1392
|
-
* - typing 4 characters or more of the NRIC
|
|
1393
|
-
*
|
|
1393
|
+
* - typing 4 characters or more of the NRIC or plate, or a COMPLETE phone
|
|
1394
|
+
* number (isCompletePhoneNumber), looks the person up, 500 ms after the
|
|
1395
|
+
* last keystroke, across EVERY
|
|
1394
1396
|
* visitor type (the type being registered first); not for pick-up /
|
|
1395
1397
|
* drop-off, which carry no person;
|
|
1396
1398
|
* - exactly one person is filled in straight away (or, with several phone
|
|
@@ -1413,7 +1415,8 @@ const lookupTimers: Partial<Record<LookupField, ReturnType<typeof setTimeout>>>
|
|
|
1413
1415
|
|
|
1414
1416
|
function lookupTerm(by: LookupField) {
|
|
1415
1417
|
if (by === "nric") return visitor.nric?.trim() || "";
|
|
1416
|
-
|
|
1418
|
+
// The phone only once the whole number is typed (see isCompletePhoneNumber).
|
|
1419
|
+
if (by === "contact") return isCompletePhoneNumber(visitor.contact) ? visitor.contact.trim() : "";
|
|
1417
1420
|
return visitor.plateNumber?.trim()?.toUpperCase() || "";
|
|
1418
1421
|
}
|
|
1419
1422
|
|
|
@@ -1523,7 +1526,7 @@ watch(
|
|
|
1523
1526
|
watch(
|
|
1524
1527
|
() => visitor.contact,
|
|
1525
1528
|
(value) => {
|
|
1526
|
-
if (!value
|
|
1529
|
+
if (!isCompletePhoneNumber(value)) {
|
|
1527
1530
|
phoneSearchMenu.value = false;
|
|
1528
1531
|
phoneSearchResults.value = [];
|
|
1529
1532
|
}
|
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.701",
|
|
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.",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import phoneMasks from "./phoneMasks";
|
|
2
|
+
|
|
3
|
+
type TPhoneMask = { dial_code: string; regex: string };
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* True only for a WHOLE phone number in the stored E.164 shape (`+6591234567`):
|
|
7
|
+
* it matches the pattern of a country whose dial code it starts with (the same
|
|
8
|
+
* patterns InputPhoneNumberV2 validates with). A part-typed number is not
|
|
9
|
+
* complete. The visitor form looks saved people up by phone only once this is
|
|
10
|
+
* true: the people search matches numbers that CONTAIN the term, so a partial
|
|
11
|
+
* number found unrelated people and a single match was filled in straight away.
|
|
12
|
+
*/
|
|
13
|
+
export function isCompletePhoneNumber(value: string | null | undefined): boolean {
|
|
14
|
+
const phone = String(value ?? "").trim();
|
|
15
|
+
if (!phone.startsWith("+")) return false;
|
|
16
|
+
return (phoneMasks as TPhoneMask[]).some(
|
|
17
|
+
(country) => phone.startsWith(country.dial_code) && new RegExp(country.regex).test(phone)
|
|
18
|
+
);
|
|
19
|
+
}
|