@7365admin1/layer-common 4.149.2 → 4.151.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +16 -4
  2. package/components/EntryPassInformation.vue +13 -0
  3. package/components/HidAccessPermissions.vue +202 -40
  4. package/components/HidEnabledGate.vue +29 -10
  5. package/components/HidIntercomManagement.vue +26 -13
  6. package/components/HidProfileQrCode.vue +6 -2
  7. package/components/HidQrCodeConfiguration.vue +2 -2
  8. package/components/HidReaderForm.vue +239 -1
  9. package/components/HidReaderManagement.vue +26 -8
  10. package/components/HidReaderUserRoster.vue +3 -1
  11. package/components/HidServiceSettingsPanel.vue +2 -2
  12. package/components/HidUserEnrollment.vue +1662 -162
  13. package/components/OvernightParkingAvailability.vue +123 -11
  14. package/components/Robot/Detail.vue +23 -4
  15. package/components/SiteSettings.vue +5 -2
  16. package/components/VisitorForm.vue +39 -11
  17. package/composables/useCleaningPermission.ts +11 -0
  18. package/composables/useHidAccessPermission.ts +176 -81
  19. package/composables/useHidAmico.ts +37 -0
  20. package/composables/useHidNavigation.ts +44 -23
  21. package/composables/useLandscapingPermission.ts +11 -0
  22. package/composables/useMechanicalElectricalPermission.ts +5 -0
  23. package/composables/usePestControlPermission.ts +11 -0
  24. package/composables/usePoolMaintenancePermission.ts +11 -0
  25. package/composables/usePropertyPermission.ts +31 -7
  26. package/composables/useSecurityPermission.ts +33 -13
  27. package/composables/useServiceProvider.ts +9 -4
  28. package/constants/permissions.ts +73 -21
  29. package/package.json +1 -1
  30. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +3 -0
  31. package/types/overnight-parking.d.ts +14 -0
  32. package/types/site.d.ts +7 -1
  33. package/utils/hid-enrolment-subject.ts +226 -4
  34. package/utils/hid-permission-assignments.ts +75 -6
  35. package/utils/hid-qr-validity.ts +25 -0
  36. package/utils/hid-reader-audiences.ts +557 -0
  37. package/utils/hid-registration.ts +24 -0
  38. package/utils/module-routes.ts +15 -2
  39. package/utils/nav-sections.ts +1 -1
  40. package/utils/robot-credential-form.ts +4 -2
  41. package/utils/robot-display.ts +28 -6
  42. package/utils/robot-setup.ts +1 -0
@@ -1968,33 +1968,51 @@ export const PATROL_ROUND_CHOICES = [
1968
1968
  { title: "Until stopped", value: 0 },
1969
1969
  ];
1970
1970
 
1971
- export type TJobOptions = { modeFlag: number; subModeFlag: number; levelFlag: number; cleanTimes: number; rounds: number };
1972
- export const JOB_OPTION_DEFAULTS: TJobOptions = { modeFlag: 1, subModeFlag: 0, levelFlag: 1, cleanTimes: 1, rounds: 1 };
1971
+ export type TJobOptions = { modeFlag: number; subModeFlag: number; levelFlag: number; cleanTimes: number; rounds: number; cleanModeId: number | null };
1972
+ export const JOB_OPTION_DEFAULTS: TJobOptions = { modeFlag: 1, subModeFlag: 0, levelFlag: 1, cleanTimes: 1, rounds: 1, cleanModeId: null };
1973
+
1974
+ /** A cleaning mode from the robot's OWN list (VIGGO 1.1 clean_mode, via records `cleanModes`). */
1975
+ export type TRobotCleanMode = { id: number; name: string };
1976
+
1977
+ /** The robot's own modes as picker choices, its default first (null = whatever the robot uses). */
1978
+ export function robotModeChoices(modes: TRobotCleanMode[] | null | undefined) {
1979
+ const list = (Array.isArray(modes) ? modes : []).filter((m) => Number.isInteger(m?.id) && typeof m?.name === "string" && m.name.trim());
1980
+ return [{ title: "The robot's default", value: null as number | null }, ...list.map((m) => ({ title: m.name.trim(), value: m.id as number | null }))];
1981
+ }
1973
1982
 
1974
1983
  /**
1975
1984
  * Which job options the confirm offers: clean options for a cleaning robot whose
1976
1985
  * brand declares `cleanOptions`, rounds for a security robot whose brand declares
1977
1986
  * `patrolRounds` - only on a start (full / area), never on any other command.
1978
1987
  */
1979
- export function jobOptionsOffered(kind: unknown, type: unknown, capabilities: Record<string, unknown> | null | undefined) {
1988
+ export function jobOptionsOffered(
1989
+ kind: unknown,
1990
+ type: unknown,
1991
+ capabilities: Record<string, unknown> | null | undefined,
1992
+ /** The robot's own mode list (a brand without our fixed three, e.g. VIGGO): mode + times are offered from it. */
1993
+ robotModes?: TRobotCleanMode[] | null,
1994
+ ) {
1980
1995
  const start = kind === "full" || kind === "area";
1996
+ const clean = start && type !== "security" && capabilities?.cleanOptions === true;
1981
1997
  return {
1982
- clean: start && type !== "security" && capabilities?.cleanOptions === true,
1998
+ clean,
1983
1999
  rounds: start && type === "security" && capabilities?.patrolRounds === true,
2000
+ modes: start && type !== "security" && !clean && robotModeChoices(robotModes).length > 1,
1984
2001
  };
1985
2002
  }
1986
2003
 
1987
2004
  /** The command body with the picked options (only the offered ones; vacuum-while-washing only for wash). */
1988
- export function withJobOptions(body: Record<string, unknown>, offered: { clean: boolean; rounds: boolean }, o: TJobOptions) {
2005
+ export function withJobOptions(body: Record<string, unknown>, offered: { clean: boolean; rounds: boolean; modes?: boolean }, o: TJobOptions) {
1989
2006
  if (offered.clean) {
1990
2007
  return { ...body, modeFlag: o.modeFlag, subModeFlag: o.modeFlag === 2 ? o.subModeFlag : 0, levelFlag: o.levelFlag, cleanTimes: o.cleanTimes };
1991
2008
  }
1992
2009
  if (offered.rounds) return { ...body, cleanTimes: o.rounds };
2010
+ if (offered.modes) return { ...body, cleanTimes: o.cleanTimes, ...(o.cleanModeId !== null ? { cleanModeId: o.cleanModeId } : {}) };
1993
2011
  return body;
1994
2012
  }
1995
2013
 
1996
2014
  /** One line under the confirm saying what the options mean for this job. */
1997
- export function jobOptionsLine(offered: { clean: boolean; rounds: boolean }, o: TJobOptions): string {
2015
+ export function jobOptionsLine(offered: { clean: boolean; rounds: boolean; modes?: boolean }, o: TJobOptions, robotModes?: TRobotCleanMode[] | null): string {
1998
2016
  if (offered.clean) {
1999
2017
  const mode = CLEAN_MODE_CHOICES.find((c) => c.value === o.modeFlag)?.title ?? "Vacuum";
2000
2018
  const power = CLEAN_POWER_CHOICES.find((c) => c.value === o.levelFlag)?.title ?? "Standard";
@@ -2002,5 +2020,9 @@ export function jobOptionsLine(offered: { clean: boolean; rounds: boolean }, o:
2002
2020
  return `${mode}, ${power.toLowerCase()} power, ${o.cleanTimes === 1 ? "once" : `${o.cleanTimes} times`}${wet}.`;
2003
2021
  }
2004
2022
  if (offered.rounds) return o.rounds === 0 ? "It keeps patrolling until someone presses Cancel." : `It patrols the route ${o.rounds === 1 ? "once" : `${o.rounds} times`}.`;
2023
+ if (offered.modes) {
2024
+ const mode = robotModeChoices(robotModes).find((c) => c.value === o.cleanModeId)?.title ?? "The robot's default";
2025
+ return `${mode} mode, ${o.cleanTimes === 1 ? "once" : `${o.cleanTimes} times`}.`;
2026
+ }
2005
2027
  return "";
2006
2028
  }
@@ -89,6 +89,7 @@ export function offlineReason(robot: Record<string, any>, state: Record<string,
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
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.`;
92
+ if (robot?.brand === "viggo") return `${name}: VIGGO's cloud did not answer${why}. Check the robot's access token (it may have expired) and that its VIN is in the saved VIN list.`;
92
93
  return `${name}: its cloud did not answer${why}.`;
93
94
  }
94
95
  return `${name}: its cloud says it is offline - switched off, charging dock unplugged or out of Wi-Fi.`;