@7365admin1/core 3.32.2-staging.94 → 3.32.2-staging.95

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.
package/dist/index.js CHANGED
@@ -42753,13 +42753,6 @@ var HidAmicoClient = class {
42753
42753
  verified: true
42754
42754
  };
42755
42755
  }
42756
- async systemInformation() {
42757
- if (!this.session) {
42758
- await this.login();
42759
- }
42760
- const res = await this.post(this.url("/system_information.fcgi"), {});
42761
- return res.data;
42762
- }
42763
42756
  async deleteUserImage(hidUserId) {
42764
42757
  if (!this.session) {
42765
42758
  await this.login();
@@ -43251,29 +43244,15 @@ function useHidAmicoService() {
43251
43244
  if (!visitorName) {
43252
43245
  throw new import_node_server_utils125.BadRequestError("Visitor name is required to issue a HID QR code.");
43253
43246
  }
43254
- const hasExpectedCheckIn = Boolean(visitor.expectedCheckIn);
43255
- const issuedAt = new Date(visitor.expectedCheckIn || visitor.checkIn || Date.now());
43256
- if (Number.isNaN(issuedAt.getTime())) {
43257
- throw new import_node_server_utils125.BadRequestError("Visitor check-in time is invalid.");
43258
- }
43247
+ const issuedAt = /* @__PURE__ */ new Date();
43259
43248
  const validityMinutes = Math.max(1, Number(value.validityMinutes) || 60);
43260
- const expiresAt = new Date(
43261
- issuedAt.getTime() + (hasExpectedCheckIn ? 24 * 60 : validityMinutes) * 60 * 1e3
43262
- );
43249
+ const expiresAt = new Date(issuedAt.getTime() + validityMinutes * 60 * 1e3);
43263
43250
  const hidUserId = createStableHidId(`visitor:${readerId}:${value.visitorId}`);
43264
43251
  const registration = `VIS-${value.visitorId.slice(-12).toUpperCase()}`;
43265
43252
  const credential = createVisitorQrCredential(value.visitorId, readerId);
43266
43253
  const client = new HidAmicoClient(reader);
43267
43254
  try {
43268
43255
  await client.login();
43269
- const systemInformation = await client.systemInformation();
43270
- const readerNowSeconds = Number(
43271
- isUnknownRecord(systemInformation) ? systemInformation.time : NaN
43272
- );
43273
- const serverNowSeconds = Math.floor(Date.now() / 1e3);
43274
- const readerClockOffsetSeconds = Number.isFinite(readerNowSeconds) ? Math.trunc(readerNowSeconds) - serverNowSeconds : 0;
43275
- const readerBeginTime = Math.floor(issuedAt.getTime() / 1e3) + readerClockOffsetSeconds;
43276
- const readerEndTime = Math.floor(expiresAt.getTime() / 1e3) + readerClockOffsetSeconds;
43277
43256
  const readerConfigurationChanged = await configureVisitorQrReader(client);
43278
43257
  if (readerConfigurationChanged) {
43279
43258
  await repo.addEvent({
@@ -43298,8 +43277,8 @@ function useHidAmicoService() {
43298
43277
  name: visitorName,
43299
43278
  registration,
43300
43279
  user_type_id: 1,
43301
- begin_time: readerBeginTime,
43302
- end_time: readerEndTime
43280
+ begin_time: Math.floor(issuedAt.getTime() / 1e3),
43281
+ end_time: Math.floor(expiresAt.getTime() / 1e3)
43303
43282
  };
43304
43283
  const existingUsers = getHidObjectRows(existingUserResponse, "users");
43305
43284
  const existingIdentity = await repo.findExistingIdentity({ reader: readerId, hidUserId });
@@ -43413,7 +43392,6 @@ function useHidAmicoService() {
43413
43392
  accessRuleId: authorization.accessRuleId,
43414
43393
  portalIds: authorization.portalIds,
43415
43394
  timeZoneId: authorization.timeZoneId,
43416
- readerClockOffsetSeconds,
43417
43395
  issuedAt: issuedAt.toISOString(),
43418
43396
  expiresAt: expiresAt.toISOString()
43419
43397
  }
@@ -43439,7 +43417,6 @@ function useHidAmicoService() {
43439
43417
  accessRuleId: authorization.accessRuleId,
43440
43418
  portalIds: authorization.portalIds,
43441
43419
  timeZoneId: authorization.timeZoneId,
43442
- readerClockOffsetSeconds,
43443
43420
  issuedAt: issuedAt.toISOString(),
43444
43421
  expiresAt: expiresAt.toISOString()
43445
43422
  }