@7365admin1/layer-common 4.97.1-staging.544 → 4.97.1-staging.545

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.
@@ -24,6 +24,30 @@
24
24
  class="flex-grow-0 ml-4"
25
25
  />
26
26
  </div>
27
+ <!-- How long an HID visitor pass lasts. Only asked once HID is on. -->
28
+ <v-radio-group
29
+ v-if="option.type === 'hid' && option.isEnabled"
30
+ v-model="option.usage"
31
+ inline
32
+ hide-details
33
+ density="compact"
34
+ color="success"
35
+ class="pb-3"
36
+ >
37
+ <v-radio
38
+ v-for="usage in hidQrUsageOptions"
39
+ :key="usage.value"
40
+ :value="usage.value"
41
+ class="mr-6"
42
+ >
43
+ <template #label>
44
+ <div>
45
+ <div class="text-body-2">{{ usage.title }}</div>
46
+ <div class="text-caption text-medium-emphasis">{{ usage.description }}</div>
47
+ </div>
48
+ </template>
49
+ </v-radio>
50
+ </v-radio-group>
27
51
  <v-divider />
28
52
  </template>
29
53
  <div class="d-flex align-center justify-space-between py-3">
@@ -260,8 +284,23 @@ const visitorQrLabels: Record<TVisitorQrCodeType, { title: string; description:
260
284
  description: "When enabled, security QR codes will be generated for visitor invitations.",
261
285
  },
262
286
  };
287
+ // Whole day until the end of the visit day, or one entry and then it expires.
288
+ // Sites that saved before this existed have none, and read as whole day.
289
+ const DEFAULT_HID_QR_USAGE: TVisitorQrUsage = "wholeDay";
290
+ const hidQrUsageOptions: { value: TVisitorQrUsage; title: string; description: string }[] = [
291
+ {
292
+ value: "wholeDay",
293
+ title: "Whole day usage",
294
+ description: "The visitor can use the QR code as many times as needed until the end of the visit day.",
295
+ },
296
+ {
297
+ value: "singleUse",
298
+ title: "Single usage",
299
+ description: "The QR code expires after the visitor's first entry.",
300
+ },
301
+ ];
263
302
  const visitorQrCodes = ref<TVisitorQrCode[]>([
264
- { type: "hid", isEnabled: false },
303
+ { type: "hid", isEnabled: false, usage: DEFAULT_HID_QR_USAGE },
265
304
  { type: "security", isEnabled: false },
266
305
  { type: "entryPass", isEnabled: false },
267
306
  ]);
@@ -342,6 +381,9 @@ watch(
342
381
  (q) => q.type === option.type
343
382
  );
344
383
  option.isEnabled = saved?.isEnabled === true;
384
+ if (option.type === "hid") {
385
+ option.usage = saved?.usage ?? DEFAULT_HID_QR_USAGE;
386
+ }
345
387
  });
346
388
  setTimeout(() => {
347
389
  isHydrating.value = false;
@@ -468,7 +510,11 @@ async function handleSave(
468
510
  isAllowPlateNumberOpenBarrier: isAllowPlateNumberOpenBarrier.value,
469
511
  autoApproveOvernightParking: autoApproveOvernightParking.value,
470
512
  isAutoApproved: autoApproveOvernightParking.value,
471
- visitorQrCodes: visitorQrCodes.value.map(({ type, isEnabled }) => ({ type, isEnabled })),
513
+ visitorQrCodes: visitorQrCodes.value.map(({ type, isEnabled, usage }) => ({
514
+ type,
515
+ isEnabled,
516
+ ...(type === "hid" ? { usage: usage ?? DEFAULT_HID_QR_USAGE } : {}),
517
+ })),
472
518
  updatedBy: updatedByValue.value,
473
519
  };
474
520
 
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.544",
5
+ "version": "4.97.1-staging.545",
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.",
@@ -19,9 +19,15 @@ declare type TOvernightParkingAvailability = {
19
19
 
20
20
  declare type TVisitorQrCodeType = "hid" | "entryPass" | "security";
21
21
 
22
+ // How long an HID visitor pass lasts: until the end of the visit day, or
23
+ // until the visitor's first entry.
24
+ declare type TVisitorQrUsage = "wholeDay" | "singleUse";
25
+
22
26
  declare type TVisitorQrCode = {
23
27
  type: TVisitorQrCodeType;
24
28
  isEnabled: boolean;
29
+ // HID only.
30
+ usage?: TVisitorQrUsage;
25
31
  };
26
32
 
27
33
  declare type TOvernightParkingRequestStatus =