@7365admin1/layer-common 4.2.20 → 4.2.21-staging.282

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.
@@ -33,6 +33,37 @@ export const cameraAlertMessage = (messages: string[]): string => {
33
33
  );
34
34
  };
35
35
 
36
+ /**
37
+ * The two halves of the plate toast.
38
+ *
39
+ * The camera's read is the payload, so it is returned SEPARATELY from the
40
+ * label rather than concatenated into one sentence - the toast sets it at its
41
+ * own size and weight, and a run-on `"New plate detected: SLD7537A"` cannot be
42
+ * typeset that way.
43
+ *
44
+ * `plate` is never empty: the socket only raises this toast when a plate was
45
+ * read, but a build that ever calls it without one gets a word rather than a
46
+ * dangling label. A read is a handful of characters - anything past
47
+ * `MAX_PLATE_CHARS` is a malformed payload, not a number plate, and is cut so
48
+ * it cannot stretch the toast off the screen.
49
+ */
50
+ export const MAX_PLATE_CHARS = 24;
51
+
52
+ export const plateToast = (
53
+ plateNumber?: string | null,
54
+ ): { label: string; plate: string } => {
55
+ const plate = (plateNumber ?? "").trim();
56
+
57
+ return {
58
+ label: "New plate detected",
59
+ plate: plate
60
+ ? plate.length > MAX_PLATE_CHARS
61
+ ? `${plate.slice(0, MAX_PLATE_CHARS)}…`
62
+ : plate
63
+ : "Unknown",
64
+ };
65
+ };
66
+
36
67
  export const useVisitorSocket = () => {
37
68
  const socketUnregisteredVisitorTrigger = useState(
38
69
  "socketUnregisteredVisitorTrigger",
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.2.20",
5
+ "version": "4.2.21-staging.282",
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.",
@@ -36,7 +36,7 @@
36
36
  "build": "nuxt build .playground",
37
37
  "generate": "nuxt generate .playground",
38
38
  "preview": "nuxt preview .playground",
39
- "test": "esbuild composables/useVisitorSocket.ts --format=esm --outfile=test/.build/useVisitorSocket.mjs --log-level=error && node --experimental-strip-types --test \"test/*.test.mjs\" && yarn test:units",
39
+ "test": "esbuild composables/useVisitorSocket.ts --format=esm --outfile=test/.build/useVisitorSocket.mjs --log-level=error && esbuild composables/usePlateToastWindow.ts --format=esm --outfile=test/.build/usePlateToastWindow.mjs --log-level=error && node --experimental-strip-types --test \"test/*.test.mjs\" && yarn test:units",
40
40
  "test:units": "node --experimental-strip-types --test \"utils/*.test.ts\"",
41
41
  "release": "yarn run build && changeset publish"
42
42
  },
@@ -73,6 +73,10 @@ declare type TFacility = {
73
73
  hourInterval?: number;
74
74
  isBookingFeeEnabled: boolean;
75
75
  isGuestEnabled: boolean;
76
+ /** Residents may complete this facility's checklist themselves. */
77
+ isResidentChecklistEnabled?: boolean;
78
+ /** Security may complete it. Mutually exclusive with the above. */
79
+ isSecurityChecklistEnabled?: boolean;
76
80
  bookingAmount: number | null;
77
81
  peakBookingFeeAmount?: number | null;
78
82
  bookingFeeGuestAmount?: number | null;