@7365admin1/layer-common 4.97.1-staging.569 → 4.97.1-staging.571
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.
|
@@ -622,6 +622,7 @@ import useSiteEntryPassSettings from "../composables/useSiteEntryPassSettings";
|
|
|
622
622
|
import useAccessManagement from "../composables/useAccessManagement";
|
|
623
623
|
import usePeople from "../composables/usePeople";
|
|
624
624
|
import useHidAmico from "../composables/useHidAmico";
|
|
625
|
+
import { minutesUntilEndOfDay } from "../utils/hid-qr-validity";
|
|
625
626
|
|
|
626
627
|
const prop = defineProps({
|
|
627
628
|
type: {
|
|
@@ -947,11 +948,6 @@ const hidQrTemplate = computed(() => {
|
|
|
947
948
|
return hidQrCodePassConfig.value?.template || {};
|
|
948
949
|
});
|
|
949
950
|
|
|
950
|
-
const hidQrValidityMinutes = computed(() => {
|
|
951
|
-
const value = Number(hidQrCodePassConfig.value?.validityMinutes);
|
|
952
|
-
return Number.isFinite(value) && value > 0 ? value : 60;
|
|
953
|
-
});
|
|
954
|
-
|
|
955
951
|
const hidQrConfiguredReaderId = computed(() => String(hidQrCodePassConfig.value?.readerId || ""));
|
|
956
952
|
type HidQrReaderSummary = {
|
|
957
953
|
_id: string;
|
|
@@ -973,7 +969,7 @@ const hidQrReaderId = computed(() => (
|
|
|
973
969
|
* `hidQrCodePassAllowed`, which is why the switch belongs here and not in each
|
|
974
970
|
* of them.
|
|
975
971
|
*/
|
|
976
|
-
const HID_VISITOR_QR_ENABLED =
|
|
972
|
+
const HID_VISITOR_QR_ENABLED = true;
|
|
977
973
|
|
|
978
974
|
const hidQrCodePassAllowed = computed(() => {
|
|
979
975
|
return (
|
|
@@ -2299,7 +2295,9 @@ async function prepareHidQrCodePreview(visitorId: string) {
|
|
|
2299
2295
|
hidQrVisitorId.value = visitorId;
|
|
2300
2296
|
const response = await issueVisitorQr(hidQrReaderId.value, {
|
|
2301
2297
|
visitorId,
|
|
2302
|
-
|
|
2298
|
+
// The whole visit day, as the resident app issues it. Worked out per
|
|
2299
|
+
// call so a regenerate later in the day still ends at midnight.
|
|
2300
|
+
validityMinutes: minutesUntilEndOfDay(),
|
|
2303
2301
|
});
|
|
2304
2302
|
const credential = "data" in response ? response.data : response;
|
|
2305
2303
|
hidQrPrintPayload.value = credential.qrValue;
|
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.571",
|
|
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,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minutes from `now` to the next local midnight, so a visitor HID QR runs to
|
|
3
|
+
* the end of the visit day. The resident app's invite form does the same
|
|
4
|
+
* (`minutesUntilEndOfDay` in its VisitorForm.tsx). Never less than 1: the API
|
|
5
|
+
* refuses a zero validity.
|
|
6
|
+
*/
|
|
7
|
+
export function minutesUntilEndOfDay(now: Date = new Date()) {
|
|
8
|
+
const midnight = new Date(now);
|
|
9
|
+
midnight.setHours(24, 0, 0, 0);
|
|
10
|
+
return Math.max(1, Math.floor((midnight.getTime() - now.getTime()) / 60_000));
|
|
11
|
+
}
|
package/utils/robot-setup.ts
CHANGED
|
@@ -88,6 +88,7 @@ export function offlineReason(robot: Record<string, any>, state: Record<string,
|
|
|
88
88
|
const why = state.reason ? ` (${state.reason})` : "";
|
|
89
89
|
if (robot?.brand === "ounitech") return `${name}: the Ounitech cloud did not answer${why}. Ask Ounitech to link this robot's serial to our account.`;
|
|
90
90
|
if (robot?.brand === "padbot") return `${name}: the PadBot cloud did not answer${why}. Check the robot's key and token.`;
|
|
91
|
+
if (robot?.brand === "oneway") return `${name}: OneWay's RMS did not answer${why}. Check the robot's API key and server address, and ask OneWay to put this robot under our company key.`;
|
|
91
92
|
return `${name}: its cloud did not answer${why}.`;
|
|
92
93
|
}
|
|
93
94
|
return `${name}: its cloud says it is offline - switched off, charging dock unplugged or out of Wi-Fi.`;
|
|
@@ -129,7 +130,7 @@ export function robotSetupSteps(input: TSetupInput): TSetupStep[] {
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
// 2. Robots added.
|
|
132
|
-
const prereq = "Before adding: Ounitech must link each robot's serial to our Seven365 account; for PadBot, save the robot's points (charger, stops) in the PadBot app first.";
|
|
133
|
+
const prereq = "Before adding: Ounitech must link each robot's serial to our Seven365 account; for PadBot, save the robot's points (charger, stops) in the PadBot app first; for OneWay, get our company API key from OneWay and have the robot's routes and charging point set in OneWay's RMS.";
|
|
133
134
|
if (!robots) {
|
|
134
135
|
steps.push({ key: "robots", title: "Robots added", status: "check", reason: "Could not read this site's robots.", button: { label: "Open fleet", target: "fleet" } });
|
|
135
136
|
} else {
|