@7365admin1/core 3.46.1-staging.115 → 3.46.1-staging.116

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.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@7365admin1/core": patch
3
+ ---
4
+
5
+ Promo codes: enforce expiry and disabled at redemption, and let staff edit, disable and remove a code
package/dist/index.d.ts CHANGED
@@ -1363,15 +1363,41 @@ type TPromoCode = {
1363
1363
  expiresAt?: string;
1364
1364
  assignedTo?: string | ObjectId;
1365
1365
  status?: "active" | "expired" | "disabled";
1366
+ deletedAt?: string;
1367
+ deletedBy?: string;
1366
1368
  };
1367
1369
 
1368
1370
  declare const promoCodeSchema: Joi.ObjectSchema<any>;
1371
+ /**
1372
+ * The schema for an EDIT, which is not the schema for a create.
1373
+ *
1374
+ * `code` is immutable: a subscription records the promo code it was bought
1375
+ * with as text, so renaming a code rewrites history for every invoice that
1376
+ * already quotes it. It is accepted here and ignored rather than refused,
1377
+ * because the console loads a record and sends it back whole - and so are
1378
+ * `_id`, `status`, `appliesTo`, `createdAt` and `assignedTo`, none of which
1379
+ * `promoCodeSchema` allows. Joi rejects unknown keys, so reusing that schema
1380
+ * would 400 every save the console could ever make. Only the five fields in
1381
+ * `promoCodeUpdate()` below are ever written.
1382
+ */
1383
+ declare const promoCodeUpdateSchema: Joi.ObjectSchema<any>;
1384
+ /** The only two states a person may put a code into. */
1385
+ declare const promoCodeStatusSchema: Joi.ObjectSchema<any>;
1369
1386
  declare function MPromoCode(data: TPromoCode): TPromoCode;
1387
+ /**
1388
+ * The editable half of a promo code, and nothing else. Whatever else the
1389
+ * console sends back with the record is dropped here rather than written.
1390
+ */
1391
+ declare function promoCodeUpdate(data: TPromoCode): Partial<TPromoCode>;
1370
1392
 
1371
1393
  declare function usePromoCodeRepo(): {
1372
1394
  createIndex: () => Promise<void>;
1373
1395
  createUniqueIndex: () => Promise<void>;
1396
+ createTextIndex: () => Promise<void>;
1374
1397
  add: (value: TPromoCode) => Promise<mongodb.InsertOneResult<bson.Document>>;
1398
+ updateById: (_id: string | ObjectId, value: TPromoCode) => Promise<mongodb.UpdateResult<bson.Document>>;
1399
+ updateStatusById: (_id: string | ObjectId, status: "active" | "disabled") => Promise<mongodb.UpdateResult<bson.Document>>;
1400
+ softDeleteById: (_id: string | ObjectId, deletedBy?: string) => Promise<mongodb.UpdateResult<bson.Document>>;
1375
1401
  getByCode: (code: string, type?: string, assigned?: boolean | null) => Promise<TPromoCode>;
1376
1402
  getById: (_id: string | ObjectId) => Promise<TPromoCode>;
1377
1403
  getPromoCodes: ({ search, page, limit, sort, type, status, }: {
@@ -1393,7 +1419,52 @@ declare function usePromoCodeController(): {
1393
1419
  getByCode: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1394
1420
  getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1395
1421
  getPromoCodes: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1422
+ update: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1423
+ updateStatus: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1424
+ remove: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1425
+ };
1426
+
1427
+ /**
1428
+ * Is a promo code still good, right now?
1429
+ *
1430
+ * Two fields decide it and until now neither was ever read on the way in:
1431
+ * `status`, which `MPromoCode` writes once as "active", and `expiresAt`, which
1432
+ * was stored and consulted by nobody. So every code that has ever been minted
1433
+ * is redeemable for ever — a code the console prints as Expired or Disabled is
1434
+ * still accepted at checkout, which is money off our own invoices.
1435
+ *
1436
+ * The parsing rules are deliberately the SAME as the console's
1437
+ * `utils/promo-code.js` in `web-app-org`. If the screen says Expired and the
1438
+ * server disagrees, one of them is wrong in front of a customer; keeping the
1439
+ * two readings identical is the only way that cannot happen.
1440
+ *
1441
+ * No database, no clock beyond the one passed in — so it is unit-testable, and
1442
+ * it is the single place the rule lives for every caller of `getByCode`.
1443
+ */
1444
+ type TPromoCurrencyInput = {
1445
+ status?: string | null;
1446
+ expiresAt?: string | null;
1396
1447
  };
1448
+ /**
1449
+ * `expiresAt` is free text in the database — Joi validates it as
1450
+ * `Joi.string()`, and the console's date input writes MM/DD/YYYY. ISO is
1451
+ * accepted too, because nothing has ever stopped another caller storing one.
1452
+ *
1453
+ * Returns the END of the expiry day: a code dated today is good all of today.
1454
+ * An unparseable value returns null, which reads as "no expiry recorded" — a
1455
+ * date nobody can read must never be the reason a live code is refused.
1456
+ */
1457
+ declare function parsePromoExpiry(value?: string | null): Date | null;
1458
+ /** True when the recorded expiry day is already behind us. */
1459
+ declare function isPromoCodeExpired(value?: string | null, now?: Date): boolean;
1460
+ /**
1461
+ * Why this code may not be redeemed, or null when it may be.
1462
+ *
1463
+ * The two refusals are worded differently on purpose: "expired" is a date the
1464
+ * customer can see on their own voucher, "no longer available" covers a code
1465
+ * Seven365 has disabled or deleted and says nothing about why.
1466
+ */
1467
+ declare function promoCodeRefusal(code: TPromoCurrencyInput | null | undefined, now?: Date): string | null;
1397
1468
 
1398
1469
  type TFeedbackMetadata = {
1399
1470
  serviceProvider?: string | ObjectId;
@@ -10882,4 +10953,4 @@ declare function useNotificationPreferenceController(): {
10882
10953
  update: (req: Request, res: Response, next: NextFunction) => Promise<void>;
10883
10954
  };
10884
10955
 
10885
- export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BidStatus, BidType, BuildingLevelStatus, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, CAMERA_ANPR_PERMISSIONS, CAMERA_CAPABILITIES, CAMERA_CAPABILITY_REASONS, CAMERA_NOT_PATROL_OR_CCTV, CAMERA_NO_SUB_STREAM_TTL_SECONDS, CAMERA_PTZ_PERMISSIONS, CAMERA_REQUEST_TIMEOUT_MS, CAMERA_RTSP_TIMEOUT_MS, CAMERA_SETUP_PERMISSIONS, CAMERA_SNAPSHOT_CACHE_SECONDS, CAMERA_SNAPSHOT_MAX_BYTES, CAMERA_TEST_MIN_INTERVAL_SECONDS, CAMERA_TEST_ROUND_LIMIT, CAMERA_TEST_ROUND_SECONDS, CAMERA_TYPE_ANPR, CAMERA_TYPE_IP, CAMERA_VIEW_PERMISSIONS, CLOCK_DRIFT_WARN_SECONDS, CURRENT_TIME_ENDPOINT, Camera, CameraAddressInput, CameraCapability, CameraCapabilityContext, CameraCapabilityDescriptor, CameraCapabilityEntry, CameraCapabilityReason, CameraCapabilityState, CameraCapabilityTrace, CameraDevice, CameraFrame, CameraMembership, CameraStream, CameraTestStatus, CameraTransport, CameraType, DEVICE_STATUS, DOBStatus, DUPLICATE_TERMS_VERSION_MESSAGE, DayOfWeek, DeviceHttpTarget, DeviceProbeResult, DynamicFormFields, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, FormEntryStatus, GuestSort, GuestStatus, HID_CARD_VALUE_FACTOR, HID_PERMISSION_CATEGORIES, IAccessCard, IAccessCardTransaction, InviteActor, MAX_CAMERA_CHANNEL, MAccessCard, MAccessCardTransaction, MAddress, MAttendance, MAttendanceSettings, MBidPreloved, MBillingConfiguration, MBillingItem, MBuilding, MBuildingLevel, MBuildingUnit, MBulletinBoard, MBulletinVideo, MCategoryPreloved, MChannelPreloved, MChat, MChatPreloved, MCustomer, MCustomerSite, MDocumentManagement, MEntryPassSettings, MEventManagement, MFeedback, MFile, MFormEntry, MGuestManagement, MHidAmicoEvent, MHidAmicoIdentity, MHidAmicoReader, MHidSipAccount, MHidSitePermissions, MIncidentReport, MManpowerDesignations, MManpowerMonitoring, MManpowerRemarks, MManpowerSites, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MNotification, MNotificationPreference, MOccurrenceBook, MOccurrenceEntry, MOccurrenceSubject, MOnlineForm, MOrg, MOvernightParkingApprovalHours, MOvernightParkingRequest, MPatrolLog, MPatrolQuestion, MPatrolRoute, MPerson, MPlatformTerms, MPost, MPostFavorite, MPromoCode, MRobot, MRole, MRoleV2, MServiceProvider, MServiceProviderBilling, MSession, MSite, MSiteCamera, MSiteFacility, MSiteFacilityBooking, MStatementOfAccount, MSubcategoryPreloved, MSubscription, MSubscriptionPlan, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVerificationV2, MVisitorTransaction, MWorkOrder, NOTIFICATION_CATEGORIES, NOTIFICATION_CHANNELS, NOTIFICATION_CHANNEL_LABELS, NOTIFICATION_NAMESPACE, NotificationAppSlug, NotificationCategory, NotificationChannel, NotificationModule, NotificationPreferenceView, NotificationService, ORG_MARKETPLACE_VENDOR_FIELD, OrgNature, OvernightParkingRequestSort, OvernightParkingRequestStatus, PATROL_CCTV_CAMERA_FILTER, PERSON_TYPES, PROPERTY_MANAGEMENT_MEMBER_TYPES, PStatus, PTZ_ALLOWED_ACTIONS, PTZ_ALLOWED_CODES, Period, PersonStatus, PersonType, PersonTypes, PlatformTermsStatus, PostOrder, PostSort, PostStatus, QrTagProps, REALTIME_MAX_FANOUT, ResidentAppModuleKey, SERVICE_PROVIDER_INVITE_LABELS, SERVICE_PROVIDER_INVITE_TRANSITIONS, SERVICE_PROVIDER_SIGN_IN_SUBJECT, SERVICE_PROVIDER_SIGN_IN_TYPE, SERVICE_PROVIDER_SIGN_UP_SUBJECT, SERVICE_PROVIDER_SIGN_UP_TYPE, SOFTWARE_VERSION_ENDPOINT, ServiceProviderInviteAction, ServiceProviderInviteDecision, ServiceProviderInviteFacts, SiteAddress, SiteCategories, SiteStatus, SortFields, SortOrder, Status, SubjectOrder, SubjectSort, SubscriptionBillingMode, SubscriptionType, TAccessMngmntSettings, TActionStatus, TAddress, TAffectedEntities, TAffectedInjured, TAppServiceType, TApprovedBy, TApprover, TAttendance, TAttendanceCheckIn, TAttendanceCheckOut, TAttendanceCheckTime, TAttendanceLocation, TAttendanceSettings, TAttendanceSettingsGetBySite, TAuthorities, TAuthoritiesCalled, TBidPreloved, TBilling, TBillingConfiguration, TBillingItem, TBuilding, TBuildingLevel, TBuildingUnit, TBulletinBoard, TBulletinVideo, TCamera, TCameraHealthClaim, TCategoryPreloved, TChannelPreloved, TChat, TChatPreloved, TCheckPoint$1 as TCheckPoint, TComplaintInfo, TComplaintReceivedTo, TCounter, TCreateNfcPatrolLog, TCustomer, TCustomerSite, TCustomerSitePropertyField, TDayNumber, TDaySchedule, TDefaultAccessCard, TDesignations, TDocs, TDocumentCreate, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TFolderUpdate, TFormEntry, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, THidAmicoEvent, THidAmicoGatewayJob, THidAmicoIdentity, THidAmicoPhysicalCard, THidAmicoReader, THidPermissionAssignment, THidPermissionCategory, THidPhysicalCardInput, THidPhysicalCardType$1 as THidPhysicalCardType, THidSipAccount, THidSitePermissions, TIncidentInformation, TIncidentReport, TIncidentTypeAndTime, TInvoice, TKeyRef, TManpowerDesignations, TManpowerDesignationsUpdate, TManpowerMonitoring, TManpowerMonitoringUpdate, TManpowerRemarks, TManpowerRemarksStatusUpdate, TManpowerRemarksUpdate, TManpowerSearchFilter, TManpowerSites, TMember, TMemberUpdateStatus, TMessagePreloved, TMiniRole, TNfcPatrolLog, TNfcPatrolRoute, TNfcPatrolRouteEdit, TNfcPatrolSettings, TNfcPatrolSettingsGetBySite, TNfcPatrolSettingsUpdate, TNfcPatrolTag, TNfcPatrolTagConfigureReset, TNfcPatrolTagEdit, TNfcPatrolTagUpdateData, TNotification, TNotificationPreference, TNotificationPreferenceOff, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TOvernightParkingApprovalHours, TOvernightParkingRequest, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPlatformTerms, TPost, TPostFavorite, TPrice, TPriceType, TPromoCode, TPromoTier, TRANSPORT_DEVICE_HTTP, TRANSPORT_RELAY_PLAYER, TRANSPORT_RTSP_FRAME, TRecipientOfComplaint, TRemarks, TResident, TResidentAppModules, TRobot, TRobotMetadata, TRole, TRoleV2, TRoute, TSOABillingItem, TSOAStatus, TServiceProvider, TServiceProviderBilling, TSession, TSessionCreate, TShifts, TSignNfcPatrolLog, TSite, TSiteCamera, TSiteFacility, TSiteFacilityBooking, TSiteInfo, TSiteInformation, TSiteMetadata, TSiteUpdateBlock, TStatementOfAccount, TSubcategoryPreloved, TSubmissionForm, TSubscription, TSubscriptionPlan, TSubscriptionPlanApplication, TUnitBilling, TUnits, TUpdateFormEntry, TUpdateName, TUser, TUserCreate, TVehicle, TVehicleTransaction, TVehicleUpdate, TVerification, TVerificationEvent, TVerificationMetadata, TVerificationMetadataV2, TVerificationV2, TVisitorTransaction, TWorkOrder, TWorkOrderMetadata, TWorkOrderUpdate, TWorkOrderUpdateStatus, TWorkOrderUpdateToCompleted, TanyoneDamageToProperty, UseAccessManagementRepo, UserStatus, VERIFICATION_OPEN_STATUSES, VehicleCategory, VehicleOrder, VehicleSort, VehicleStatus, VehicleType, VerificationLinkType, VerificationStatus, VerificationSubjectType, VerificationType, VisitorSort, VisitorStatus, addressSchema, allowedFieldsSite, allowedNatures, allowedPlanApplications, attendanceSchema, attendanceSettingsSchema, building_level_namespace_collection, building_units_namespace_collection, buildings_namespace_collection, bulletin_boards_namespace_collection, cameraBaseUrl, cameraCapabilitiesFor, cameraDevices, cameraGrant, cameraHealthClaim, cameraHealthSummary, cameraManagePermissions, cameraProbeCacheKey, cameraTransports, canRevokeRefreshTokenFamily, categoriesForPermissions, categorySupportsChannel, chatPrelovedEvents, chatSchema, clampPtzSpeed, clockDriftSeconds, createManpowerRemarksDaily, customerSchema, customerSitePropertyFields, decideServiceProviderInvite, decodeHidPacsCard, deriveCameraHost, describeCameraCapabilities, designationsSchema, deviceControlEnabled, deviceHttpEnabled, deviceHttpTargets, deviceHttpTimeoutMs, deviceProbeTtlSeconds, emitNotificationCreated, encodeHidPacsCard, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, ffmpegFrameArgs, ffmpegPath, formatCapabilityTrace, formatDahuaDate, getIO, getSessionIdFromRequest, grabWithSubStreamFallback, guests_namespace_collection, hasAnyCapability, hasAnyPermission, incidentReport, incidentReportLog, incidents_namespace_collection, isCameraEntitled, isDuplicateVersionError, isPatrolCctvCamera, isRelayPlayerUrl, isSuperAdmin, isTermsCurrent, logCamera, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, mapWithLimit, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, normalizeAcceptedTerms, normalizeHidCardValue, notificationCategory, notificationCategoryLabel, notificationEvents, notificationRoom, occurrence_book_namespace_collection, online_forms_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseCameraChannel, parseCameraHost, parseDahuaFind, parseDeviceTime, parseSoftwareVersion, pickCustomerSiteProperties, platform_terms_namespace_collection, promoCodeSchema, ptzEndpoint, publicCameraFields, refuseServiceProviderInviteAction, registerCameraTransport, relayForRecorder, remarksSchema, resetCameraTransports, residentAppModuleKeys, residentFormEntry, resolutionRefusalReason, resolveCamera, resolveDeviceHttp, resolveHidPhysicalCardValue, resolveInviteActor, robotSchema, rtspUrl, schema, schemaAppSlugNotification, schemaApprovedBy, schemaApprover, schemaBidPreloved, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingLevel, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCategoryPreloved, schemaChannelPreloved, schemaChatPreloved, schemaCreateHidAmicoIdentity, schemaCreateNfcPatrolLog, schemaCreateNotification, schemaCustomerSite, schemaDiscoverHidAmicoReader, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaFormEntry, schemaGuestManagement, schemaHidAmicoAssignUserCard, schemaHidAmicoConfiguration, schemaHidAmicoEnrollUserCard, schemaHidAmicoEvent, schemaHidAmicoExecuteActions, schemaHidAmicoIdentity, schemaHidAmicoIdentityIdParams, schemaHidAmicoIdentityQuery, schemaHidAmicoIntercomCall, schemaHidAmicoLogQuery, schemaHidAmicoNotificationParams, schemaHidAmicoObjectOperation, schemaHidAmicoReader, schemaHidAmicoReaderIdParams, schemaHidAmicoReaderListQuery, schemaHidAmicoSetConfiguration, schemaHidAmicoSiteIdParams, schemaHidAmicoSync, schemaHidAmicoUserCardIdParams, schemaHidAmicoUserCardParams, schemaHidAmicoUserImageParams, schemaHidAmicoUserImageUploadQuery, schemaHidAmicoUserPin, schemaHidAmicoUserPinParams, schemaHidAmicoVisitorImageParams, schemaHidAmicoVisitorImageUploadQuery, schemaHidAmicoVisitorQr, schemaHidPermissionCandidateQuery, schemaHidPermissionScopeQuery, schemaHidSipAccountRequest, schemaIncidentReport, schemaListNotification, schemaMultipleDocumentManagement, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaNotification, schemaNotificationPreference, schemaNotificationPreferenceOff, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaOvernightParkingApprovalHours, schemaOvernightParkingRequest, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaPlatformTerms, schemaPost, schemaPostFavorite, schemaServiceProvider, schemaServiceProviderBilling, schemaSignNfcPatrolLog, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaSubcategoryPreloved, schemaUnitBilling, schemaUpdateBidPreloved, schemaUpdateBuildingLevel, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateCategoryPreloved, schemaUpdateChatPreloved, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateFolderManagement, schemaUpdateFormEntry, schemaUpdateGuestManagement, schemaUpdateHidAmicoIdentity, schemaUpdateHidAmicoReader, schemaUpdateHidSitePermissions, schemaUpdateIncidentReport, schemaUpdateNotification, schemaUpdateNotificationPreference, schemaUpdateOccurrenceBook, schemaUpdateOccurrenceEntry, schemaUpdateOccurrenceSubject, schemaUpdateOnlineForm, schemaUpdateOptions, schemaUpdateOvernightParkingRequest, schemaUpdatePatrolLog, schemaUpdatePatrolQuestion, schemaUpdatePatrolRoute, schemaUpdatePerson, schemaUpdatePost, schemaUpdatePostFavorite, schemaUpdateServiceProviderBilling, schemaUpdateSiteBillingConfiguration, schemaUpdateSiteBillingItem, schemaUpdateSiteCamera, schemaUpdateSiteFacility, schemaUpdateSiteFacilityBooking, schemaUpdateSiteUnitBilling, schemaUpdateStatementOfAccount, schemaUpdateSubcategoryPreloved, schemaUpdateVisTrans, schemaVehicleTransaction, schemaVisitorTransaction, schemeCamera, schemeLogCamera, serviceProviderInviteLabel, sessionSchema, setIO, shiftSchema, siteSchema, site_people_namespace_collection, snapshotEndpoint, snapshotRefusalReason, subscriptionPlanSchema, updateRemarksStatusEod, updateRemarksisAcknowledged, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthControllerV2, useAuthService, useAuthServiceV2, useBidPrelovedController, useBidPrelovedRepo, useBidPrelovedService, useBuildingController, useBuildingLevelController, useBuildingLevelRepo, useBuildingLevelService, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useBulletinBoardController, useBulletinBoardRepo, useBulletinBoardService, useBulletinVideoController, useBulletinVideoRepo, useBulletinVideoService, useCameraViewController, useCameraViewService, useCategoryPrelovedController, useCategoryPrelovedRepo, useChannelPrelovedController, useChannelPrelovedRepo, useChatController, useChatPrelovedController, useChatPrelovedRepo, useChatPrelovedService, useChatRepo, useCounterModel, useCounterRepo, useCustomerController, useCustomerRepo, useCustomerSiteController, useCustomerSiteRepo, useCustomerSiteService, useDahuaService, useDashboardController, useDashboardRepo, useDocumentManagementController, useDocumentManagementRepo, useDocumentManagementService, useEntryPassSettingsController, useEntryPassSettingsRepo, useEventManagementController, useEventManagementRepo, useEventManagementService, useFeedbackController, useFeedbackRepo, useFeedbackService, useFileController, useFileRepo, useFileService, useFormEntryController, useFormEntryRepo, useGuestManagementController, useGuestManagementRepo, useGuestManagementService, useHidAmicoController, useHidAmicoRepo, useHidAmicoService, useHrmLabsAttendanceCtrl, useHrmLabsAttendanceSrvc, useIncidentReportController, useIncidentReportRepo, useIncidentReportService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useManpowerDesignationCtrl, useManpowerDesignationRepo, useManpowerMonitoringCtrl, useManpowerMonitoringRepo, useManpowerMonitoringSrvc, useManpowerRemarkCtrl, useManpowerRemarksRepo, useManpowerSitesCtrl, useManpowerSitesRepo, useManpowerSitesSrvc, useMemberController, useMemberRepo, useMemberService, useNewDashboardController, useNewDashboardRepo, useNfcPatrolLogController, useNfcPatrolLogRepo, useNfcPatrolLogService, useNfcPatrolRouteController, useNfcPatrolRouteRepo, useNfcPatrolRouteService, useNfcPatrolSettingsController, useNfcPatrolSettingsRepository, useNfcPatrolSettingsService, useNfcPatrolTagController, useNfcPatrolTagRepo, useNfcPatrolTagService, useNotificationController, useNotificationPreferenceController, useNotificationPreferenceRepo, useNotificationPreferenceService, useNotificationRepo, useOccurrenceBookController, useOccurrenceBookRepo, useOccurrenceBookService, useOccurrenceEntryController, useOccurrenceEntryRepo, useOccurrenceEntryService, useOccurrenceSubjectController, useOccurrenceSubjectRepo, useOccurrenceSubjectService, useOnlineFormController, useOnlineFormRepo, useOrgController, useOrgControllerV2, useOrgRepo, useOvernightParkingController, useOvernightParkingRepo, useOvernightParkingRequestController, useOvernightParkingRequestRepo, useOvernightParkingRequestService, usePatrolLogController, usePatrolLogRepo, usePatrolLogService, usePatrolQuestionController, usePatrolQuestionRepo, usePatrolRouteController, usePatrolRouteRepo, usePersonController, usePersonRepo, usePlatformTermsController, usePlatformTermsRepo, usePlatformTermsService, usePostFavoriteController, usePostFavoriteRepo, usePostFavoriteService, usePostPrelovedController, usePostPrelovedRepo, usePriceController, usePriceModel, usePriceRepo, usePromoCodeController, usePromoCodeRepo, useRedDotPaymentController, useRedDotPaymentRepo, useRedDotPaymentSvc, useRobotController, useRobotRepo, useRobotService, useRoleController, useRoleControllerV2, useRoleRepo, useRoleRepoV2, useRoleServiceV2, useServiceProviderBillingController, useServiceProviderBillingRepo, useServiceProviderBillingService, useServiceProviderController, useServiceProviderInviteController, useServiceProviderInviteService, useServiceProviderRepo, useSessionRepo, useSiteBillingConfigurationController, useSiteBillingConfigurationRepo, useSiteBillingItemController, useSiteBillingItemRepo, useSiteCameraController, useSiteCameraRepo, useSiteCameraService, useSiteController, useSiteFacilityBookingController, useSiteFacilityBookingRepo, useSiteFacilityBookingService, useSiteFacilityController, useSiteFacilityRepo, useSiteFacilityService, useSiteRepo, useSiteService, useSiteUnitBillingController, useSiteUnitBillingRepo, useSiteUnitBillingService, useStatementOfAccountController, useStatementOfAccountRepo, useSubcategoryPrelovedController, useSubcategoryPrelovedRepo, useSubscriptionController, useSubscriptionPlanController, useSubscriptionPlanRepo, useSubscriptionRepo, useSubscriptionService, useUserController, useUserControllerV2, useUserRepo, useUserRepoV2, useUserService, useUserServiceV2, useVehicleController, useVehicleRepo, useVehicleService, useVerificationController, useVerificationControllerV2, useVerificationRepo, useVerificationRepoV2, useVerificationService, useVerificationServiceV2, useVisitorTransactionController, useVisitorTransactionRepo, useVisitorTransactionService, useWorkOrderController, useWorkOrderRepo, useWorkOrderService, userSchema, vehicleSchema, vehicles_namespace_collection, visitorPersonRepo, visitorPersonService, visitorType, visitors_namespace_collection, wallConfig, workOrderSchema, work_orders2_namespace_collection, work_orders_namespace_collection };
10956
+ export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BidStatus, BidType, BuildingLevelStatus, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, CAMERA_ANPR_PERMISSIONS, CAMERA_CAPABILITIES, CAMERA_CAPABILITY_REASONS, CAMERA_NOT_PATROL_OR_CCTV, CAMERA_NO_SUB_STREAM_TTL_SECONDS, CAMERA_PTZ_PERMISSIONS, CAMERA_REQUEST_TIMEOUT_MS, CAMERA_RTSP_TIMEOUT_MS, CAMERA_SETUP_PERMISSIONS, CAMERA_SNAPSHOT_CACHE_SECONDS, CAMERA_SNAPSHOT_MAX_BYTES, CAMERA_TEST_MIN_INTERVAL_SECONDS, CAMERA_TEST_ROUND_LIMIT, CAMERA_TEST_ROUND_SECONDS, CAMERA_TYPE_ANPR, CAMERA_TYPE_IP, CAMERA_VIEW_PERMISSIONS, CLOCK_DRIFT_WARN_SECONDS, CURRENT_TIME_ENDPOINT, Camera, CameraAddressInput, CameraCapability, CameraCapabilityContext, CameraCapabilityDescriptor, CameraCapabilityEntry, CameraCapabilityReason, CameraCapabilityState, CameraCapabilityTrace, CameraDevice, CameraFrame, CameraMembership, CameraStream, CameraTestStatus, CameraTransport, CameraType, DEVICE_STATUS, DOBStatus, DUPLICATE_TERMS_VERSION_MESSAGE, DayOfWeek, DeviceHttpTarget, DeviceProbeResult, DynamicFormFields, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, FormEntryStatus, GuestSort, GuestStatus, HID_CARD_VALUE_FACTOR, HID_PERMISSION_CATEGORIES, IAccessCard, IAccessCardTransaction, InviteActor, MAX_CAMERA_CHANNEL, MAccessCard, MAccessCardTransaction, MAddress, MAttendance, MAttendanceSettings, MBidPreloved, MBillingConfiguration, MBillingItem, MBuilding, MBuildingLevel, MBuildingUnit, MBulletinBoard, MBulletinVideo, MCategoryPreloved, MChannelPreloved, MChat, MChatPreloved, MCustomer, MCustomerSite, MDocumentManagement, MEntryPassSettings, MEventManagement, MFeedback, MFile, MFormEntry, MGuestManagement, MHidAmicoEvent, MHidAmicoIdentity, MHidAmicoReader, MHidSipAccount, MHidSitePermissions, MIncidentReport, MManpowerDesignations, MManpowerMonitoring, MManpowerRemarks, MManpowerSites, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MNotification, MNotificationPreference, MOccurrenceBook, MOccurrenceEntry, MOccurrenceSubject, MOnlineForm, MOrg, MOvernightParkingApprovalHours, MOvernightParkingRequest, MPatrolLog, MPatrolQuestion, MPatrolRoute, MPerson, MPlatformTerms, MPost, MPostFavorite, MPromoCode, MRobot, MRole, MRoleV2, MServiceProvider, MServiceProviderBilling, MSession, MSite, MSiteCamera, MSiteFacility, MSiteFacilityBooking, MStatementOfAccount, MSubcategoryPreloved, MSubscription, MSubscriptionPlan, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVerificationV2, MVisitorTransaction, MWorkOrder, NOTIFICATION_CATEGORIES, NOTIFICATION_CHANNELS, NOTIFICATION_CHANNEL_LABELS, NOTIFICATION_NAMESPACE, NotificationAppSlug, NotificationCategory, NotificationChannel, NotificationModule, NotificationPreferenceView, NotificationService, ORG_MARKETPLACE_VENDOR_FIELD, OrgNature, OvernightParkingRequestSort, OvernightParkingRequestStatus, PATROL_CCTV_CAMERA_FILTER, PERSON_TYPES, PROPERTY_MANAGEMENT_MEMBER_TYPES, PStatus, PTZ_ALLOWED_ACTIONS, PTZ_ALLOWED_CODES, Period, PersonStatus, PersonType, PersonTypes, PlatformTermsStatus, PostOrder, PostSort, PostStatus, QrTagProps, REALTIME_MAX_FANOUT, ResidentAppModuleKey, SERVICE_PROVIDER_INVITE_LABELS, SERVICE_PROVIDER_INVITE_TRANSITIONS, SERVICE_PROVIDER_SIGN_IN_SUBJECT, SERVICE_PROVIDER_SIGN_IN_TYPE, SERVICE_PROVIDER_SIGN_UP_SUBJECT, SERVICE_PROVIDER_SIGN_UP_TYPE, SOFTWARE_VERSION_ENDPOINT, ServiceProviderInviteAction, ServiceProviderInviteDecision, ServiceProviderInviteFacts, SiteAddress, SiteCategories, SiteStatus, SortFields, SortOrder, Status, SubjectOrder, SubjectSort, SubscriptionBillingMode, SubscriptionType, TAccessMngmntSettings, TActionStatus, TAddress, TAffectedEntities, TAffectedInjured, TAppServiceType, TApprovedBy, TApprover, TAttendance, TAttendanceCheckIn, TAttendanceCheckOut, TAttendanceCheckTime, TAttendanceLocation, TAttendanceSettings, TAttendanceSettingsGetBySite, TAuthorities, TAuthoritiesCalled, TBidPreloved, TBilling, TBillingConfiguration, TBillingItem, TBuilding, TBuildingLevel, TBuildingUnit, TBulletinBoard, TBulletinVideo, TCamera, TCameraHealthClaim, TCategoryPreloved, TChannelPreloved, TChat, TChatPreloved, TCheckPoint$1 as TCheckPoint, TComplaintInfo, TComplaintReceivedTo, TCounter, TCreateNfcPatrolLog, TCustomer, TCustomerSite, TCustomerSitePropertyField, TDayNumber, TDaySchedule, TDefaultAccessCard, TDesignations, TDocs, TDocumentCreate, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TFolderUpdate, TFormEntry, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, THidAmicoEvent, THidAmicoGatewayJob, THidAmicoIdentity, THidAmicoPhysicalCard, THidAmicoReader, THidPermissionAssignment, THidPermissionCategory, THidPhysicalCardInput, THidPhysicalCardType$1 as THidPhysicalCardType, THidSipAccount, THidSitePermissions, TIncidentInformation, TIncidentReport, TIncidentTypeAndTime, TInvoice, TKeyRef, TManpowerDesignations, TManpowerDesignationsUpdate, TManpowerMonitoring, TManpowerMonitoringUpdate, TManpowerRemarks, TManpowerRemarksStatusUpdate, TManpowerRemarksUpdate, TManpowerSearchFilter, TManpowerSites, TMember, TMemberUpdateStatus, TMessagePreloved, TMiniRole, TNfcPatrolLog, TNfcPatrolRoute, TNfcPatrolRouteEdit, TNfcPatrolSettings, TNfcPatrolSettingsGetBySite, TNfcPatrolSettingsUpdate, TNfcPatrolTag, TNfcPatrolTagConfigureReset, TNfcPatrolTagEdit, TNfcPatrolTagUpdateData, TNotification, TNotificationPreference, TNotificationPreferenceOff, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TOvernightParkingApprovalHours, TOvernightParkingRequest, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPlatformTerms, TPost, TPostFavorite, TPrice, TPriceType, TPromoCode, TPromoCurrencyInput, TPromoTier, TRANSPORT_DEVICE_HTTP, TRANSPORT_RELAY_PLAYER, TRANSPORT_RTSP_FRAME, TRecipientOfComplaint, TRemarks, TResident, TResidentAppModules, TRobot, TRobotMetadata, TRole, TRoleV2, TRoute, TSOABillingItem, TSOAStatus, TServiceProvider, TServiceProviderBilling, TSession, TSessionCreate, TShifts, TSignNfcPatrolLog, TSite, TSiteCamera, TSiteFacility, TSiteFacilityBooking, TSiteInfo, TSiteInformation, TSiteMetadata, TSiteUpdateBlock, TStatementOfAccount, TSubcategoryPreloved, TSubmissionForm, TSubscription, TSubscriptionPlan, TSubscriptionPlanApplication, TUnitBilling, TUnits, TUpdateFormEntry, TUpdateName, TUser, TUserCreate, TVehicle, TVehicleTransaction, TVehicleUpdate, TVerification, TVerificationEvent, TVerificationMetadata, TVerificationMetadataV2, TVerificationV2, TVisitorTransaction, TWorkOrder, TWorkOrderMetadata, TWorkOrderUpdate, TWorkOrderUpdateStatus, TWorkOrderUpdateToCompleted, TanyoneDamageToProperty, UseAccessManagementRepo, UserStatus, VERIFICATION_OPEN_STATUSES, VehicleCategory, VehicleOrder, VehicleSort, VehicleStatus, VehicleType, VerificationLinkType, VerificationStatus, VerificationSubjectType, VerificationType, VisitorSort, VisitorStatus, addressSchema, allowedFieldsSite, allowedNatures, allowedPlanApplications, attendanceSchema, attendanceSettingsSchema, building_level_namespace_collection, building_units_namespace_collection, buildings_namespace_collection, bulletin_boards_namespace_collection, cameraBaseUrl, cameraCapabilitiesFor, cameraDevices, cameraGrant, cameraHealthClaim, cameraHealthSummary, cameraManagePermissions, cameraProbeCacheKey, cameraTransports, canRevokeRefreshTokenFamily, categoriesForPermissions, categorySupportsChannel, chatPrelovedEvents, chatSchema, clampPtzSpeed, clockDriftSeconds, createManpowerRemarksDaily, customerSchema, customerSitePropertyFields, decideServiceProviderInvite, decodeHidPacsCard, deriveCameraHost, describeCameraCapabilities, designationsSchema, deviceControlEnabled, deviceHttpEnabled, deviceHttpTargets, deviceHttpTimeoutMs, deviceProbeTtlSeconds, emitNotificationCreated, encodeHidPacsCard, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, ffmpegFrameArgs, ffmpegPath, formatCapabilityTrace, formatDahuaDate, getIO, getSessionIdFromRequest, grabWithSubStreamFallback, guests_namespace_collection, hasAnyCapability, hasAnyPermission, incidentReport, incidentReportLog, incidents_namespace_collection, isCameraEntitled, isDuplicateVersionError, isPatrolCctvCamera, isPromoCodeExpired, isRelayPlayerUrl, isSuperAdmin, isTermsCurrent, logCamera, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, mapWithLimit, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, normalizeAcceptedTerms, normalizeHidCardValue, notificationCategory, notificationCategoryLabel, notificationEvents, notificationRoom, occurrence_book_namespace_collection, online_forms_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseCameraChannel, parseCameraHost, parseDahuaFind, parseDeviceTime, parsePromoExpiry, parseSoftwareVersion, pickCustomerSiteProperties, platform_terms_namespace_collection, promoCodeRefusal, promoCodeSchema, promoCodeStatusSchema, promoCodeUpdate, promoCodeUpdateSchema, ptzEndpoint, publicCameraFields, refuseServiceProviderInviteAction, registerCameraTransport, relayForRecorder, remarksSchema, resetCameraTransports, residentAppModuleKeys, residentFormEntry, resolutionRefusalReason, resolveCamera, resolveDeviceHttp, resolveHidPhysicalCardValue, resolveInviteActor, robotSchema, rtspUrl, schema, schemaAppSlugNotification, schemaApprovedBy, schemaApprover, schemaBidPreloved, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingLevel, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCategoryPreloved, schemaChannelPreloved, schemaChatPreloved, schemaCreateHidAmicoIdentity, schemaCreateNfcPatrolLog, schemaCreateNotification, schemaCustomerSite, schemaDiscoverHidAmicoReader, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaFormEntry, schemaGuestManagement, schemaHidAmicoAssignUserCard, schemaHidAmicoConfiguration, schemaHidAmicoEnrollUserCard, schemaHidAmicoEvent, schemaHidAmicoExecuteActions, schemaHidAmicoIdentity, schemaHidAmicoIdentityIdParams, schemaHidAmicoIdentityQuery, schemaHidAmicoIntercomCall, schemaHidAmicoLogQuery, schemaHidAmicoNotificationParams, schemaHidAmicoObjectOperation, schemaHidAmicoReader, schemaHidAmicoReaderIdParams, schemaHidAmicoReaderListQuery, schemaHidAmicoSetConfiguration, schemaHidAmicoSiteIdParams, schemaHidAmicoSync, schemaHidAmicoUserCardIdParams, schemaHidAmicoUserCardParams, schemaHidAmicoUserImageParams, schemaHidAmicoUserImageUploadQuery, schemaHidAmicoUserPin, schemaHidAmicoUserPinParams, schemaHidAmicoVisitorImageParams, schemaHidAmicoVisitorImageUploadQuery, schemaHidAmicoVisitorQr, schemaHidPermissionCandidateQuery, schemaHidPermissionScopeQuery, schemaHidSipAccountRequest, schemaIncidentReport, schemaListNotification, schemaMultipleDocumentManagement, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaNotification, schemaNotificationPreference, schemaNotificationPreferenceOff, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaOvernightParkingApprovalHours, schemaOvernightParkingRequest, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaPlatformTerms, schemaPost, schemaPostFavorite, schemaServiceProvider, schemaServiceProviderBilling, schemaSignNfcPatrolLog, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaSubcategoryPreloved, schemaUnitBilling, schemaUpdateBidPreloved, schemaUpdateBuildingLevel, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateCategoryPreloved, schemaUpdateChatPreloved, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateFolderManagement, schemaUpdateFormEntry, schemaUpdateGuestManagement, schemaUpdateHidAmicoIdentity, schemaUpdateHidAmicoReader, schemaUpdateHidSitePermissions, schemaUpdateIncidentReport, schemaUpdateNotification, schemaUpdateNotificationPreference, schemaUpdateOccurrenceBook, schemaUpdateOccurrenceEntry, schemaUpdateOccurrenceSubject, schemaUpdateOnlineForm, schemaUpdateOptions, schemaUpdateOvernightParkingRequest, schemaUpdatePatrolLog, schemaUpdatePatrolQuestion, schemaUpdatePatrolRoute, schemaUpdatePerson, schemaUpdatePost, schemaUpdatePostFavorite, schemaUpdateServiceProviderBilling, schemaUpdateSiteBillingConfiguration, schemaUpdateSiteBillingItem, schemaUpdateSiteCamera, schemaUpdateSiteFacility, schemaUpdateSiteFacilityBooking, schemaUpdateSiteUnitBilling, schemaUpdateStatementOfAccount, schemaUpdateSubcategoryPreloved, schemaUpdateVisTrans, schemaVehicleTransaction, schemaVisitorTransaction, schemeCamera, schemeLogCamera, serviceProviderInviteLabel, sessionSchema, setIO, shiftSchema, siteSchema, site_people_namespace_collection, snapshotEndpoint, snapshotRefusalReason, subscriptionPlanSchema, updateRemarksStatusEod, updateRemarksisAcknowledged, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthControllerV2, useAuthService, useAuthServiceV2, useBidPrelovedController, useBidPrelovedRepo, useBidPrelovedService, useBuildingController, useBuildingLevelController, useBuildingLevelRepo, useBuildingLevelService, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useBulletinBoardController, useBulletinBoardRepo, useBulletinBoardService, useBulletinVideoController, useBulletinVideoRepo, useBulletinVideoService, useCameraViewController, useCameraViewService, useCategoryPrelovedController, useCategoryPrelovedRepo, useChannelPrelovedController, useChannelPrelovedRepo, useChatController, useChatPrelovedController, useChatPrelovedRepo, useChatPrelovedService, useChatRepo, useCounterModel, useCounterRepo, useCustomerController, useCustomerRepo, useCustomerSiteController, useCustomerSiteRepo, useCustomerSiteService, useDahuaService, useDashboardController, useDashboardRepo, useDocumentManagementController, useDocumentManagementRepo, useDocumentManagementService, useEntryPassSettingsController, useEntryPassSettingsRepo, useEventManagementController, useEventManagementRepo, useEventManagementService, useFeedbackController, useFeedbackRepo, useFeedbackService, useFileController, useFileRepo, useFileService, useFormEntryController, useFormEntryRepo, useGuestManagementController, useGuestManagementRepo, useGuestManagementService, useHidAmicoController, useHidAmicoRepo, useHidAmicoService, useHrmLabsAttendanceCtrl, useHrmLabsAttendanceSrvc, useIncidentReportController, useIncidentReportRepo, useIncidentReportService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useManpowerDesignationCtrl, useManpowerDesignationRepo, useManpowerMonitoringCtrl, useManpowerMonitoringRepo, useManpowerMonitoringSrvc, useManpowerRemarkCtrl, useManpowerRemarksRepo, useManpowerSitesCtrl, useManpowerSitesRepo, useManpowerSitesSrvc, useMemberController, useMemberRepo, useMemberService, useNewDashboardController, useNewDashboardRepo, useNfcPatrolLogController, useNfcPatrolLogRepo, useNfcPatrolLogService, useNfcPatrolRouteController, useNfcPatrolRouteRepo, useNfcPatrolRouteService, useNfcPatrolSettingsController, useNfcPatrolSettingsRepository, useNfcPatrolSettingsService, useNfcPatrolTagController, useNfcPatrolTagRepo, useNfcPatrolTagService, useNotificationController, useNotificationPreferenceController, useNotificationPreferenceRepo, useNotificationPreferenceService, useNotificationRepo, useOccurrenceBookController, useOccurrenceBookRepo, useOccurrenceBookService, useOccurrenceEntryController, useOccurrenceEntryRepo, useOccurrenceEntryService, useOccurrenceSubjectController, useOccurrenceSubjectRepo, useOccurrenceSubjectService, useOnlineFormController, useOnlineFormRepo, useOrgController, useOrgControllerV2, useOrgRepo, useOvernightParkingController, useOvernightParkingRepo, useOvernightParkingRequestController, useOvernightParkingRequestRepo, useOvernightParkingRequestService, usePatrolLogController, usePatrolLogRepo, usePatrolLogService, usePatrolQuestionController, usePatrolQuestionRepo, usePatrolRouteController, usePatrolRouteRepo, usePersonController, usePersonRepo, usePlatformTermsController, usePlatformTermsRepo, usePlatformTermsService, usePostFavoriteController, usePostFavoriteRepo, usePostFavoriteService, usePostPrelovedController, usePostPrelovedRepo, usePriceController, usePriceModel, usePriceRepo, usePromoCodeController, usePromoCodeRepo, useRedDotPaymentController, useRedDotPaymentRepo, useRedDotPaymentSvc, useRobotController, useRobotRepo, useRobotService, useRoleController, useRoleControllerV2, useRoleRepo, useRoleRepoV2, useRoleServiceV2, useServiceProviderBillingController, useServiceProviderBillingRepo, useServiceProviderBillingService, useServiceProviderController, useServiceProviderInviteController, useServiceProviderInviteService, useServiceProviderRepo, useSessionRepo, useSiteBillingConfigurationController, useSiteBillingConfigurationRepo, useSiteBillingItemController, useSiteBillingItemRepo, useSiteCameraController, useSiteCameraRepo, useSiteCameraService, useSiteController, useSiteFacilityBookingController, useSiteFacilityBookingRepo, useSiteFacilityBookingService, useSiteFacilityController, useSiteFacilityRepo, useSiteFacilityService, useSiteRepo, useSiteService, useSiteUnitBillingController, useSiteUnitBillingRepo, useSiteUnitBillingService, useStatementOfAccountController, useStatementOfAccountRepo, useSubcategoryPrelovedController, useSubcategoryPrelovedRepo, useSubscriptionController, useSubscriptionPlanController, useSubscriptionPlanRepo, useSubscriptionRepo, useSubscriptionService, useUserController, useUserControllerV2, useUserRepo, useUserRepoV2, useUserService, useUserServiceV2, useVehicleController, useVehicleRepo, useVehicleService, useVerificationController, useVerificationControllerV2, useVerificationRepo, useVerificationRepoV2, useVerificationService, useVerificationServiceV2, useVisitorTransactionController, useVisitorTransactionRepo, useVisitorTransactionService, useWorkOrderController, useWorkOrderRepo, useWorkOrderService, userSchema, vehicleSchema, vehicles_namespace_collection, visitorPersonRepo, visitorPersonService, visitorType, visitors_namespace_collection, wallConfig, workOrderSchema, work_orders2_namespace_collection, work_orders_namespace_collection };
package/dist/index.js CHANGED
@@ -6143,6 +6143,7 @@ __export(src_exports, {
6143
6143
  isCameraEntitled: () => isCameraEntitled,
6144
6144
  isDuplicateVersionError: () => isDuplicateVersionError,
6145
6145
  isPatrolCctvCamera: () => isPatrolCctvCamera,
6146
+ isPromoCodeExpired: () => isPromoCodeExpired,
6146
6147
  isRelayPlayerUrl: () => isRelayPlayerUrl,
6147
6148
  isSuperAdmin: () => isSuperAdmin,
6148
6149
  isTermsCurrent: () => isTermsCurrent,
@@ -6168,10 +6169,15 @@ __export(src_exports, {
6168
6169
  parseCameraHost: () => parseCameraHost,
6169
6170
  parseDahuaFind: () => parseDahuaFind,
6170
6171
  parseDeviceTime: () => parseDeviceTime,
6172
+ parsePromoExpiry: () => parsePromoExpiry,
6171
6173
  parseSoftwareVersion: () => parseSoftwareVersion,
6172
6174
  pickCustomerSiteProperties: () => pickCustomerSiteProperties,
6173
6175
  platform_terms_namespace_collection: () => platform_terms_namespace_collection,
6176
+ promoCodeRefusal: () => promoCodeRefusal,
6174
6177
  promoCodeSchema: () => promoCodeSchema,
6178
+ promoCodeStatusSchema: () => promoCodeStatusSchema,
6179
+ promoCodeUpdate: () => promoCodeUpdate,
6180
+ promoCodeUpdateSchema: () => promoCodeUpdateSchema,
6175
6181
  ptzEndpoint: () => ptzEndpoint,
6176
6182
  publicCameraFields: () => publicCameraFields,
6177
6183
  refuseServiceProviderInviteAction: () => refuseServiceProviderInviteAction,
@@ -21052,6 +21058,31 @@ var promoCodeSchema = import_joi27.default.object({
21052
21058
  }),
21053
21059
  expiresAt: import_joi27.default.string().optional().allow("", null)
21054
21060
  });
21061
+ var promoCodeUpdateSchema = import_joi27.default.object({
21062
+ _id: import_joi27.default.any().optional(),
21063
+ code: import_joi27.default.any().optional(),
21064
+ status: import_joi27.default.any().optional(),
21065
+ appliesTo: import_joi27.default.any().optional(),
21066
+ createdAt: import_joi27.default.any().optional(),
21067
+ assignedTo: import_joi27.default.any().optional(),
21068
+ deletedAt: import_joi27.default.any().optional(),
21069
+ description: import_joi27.default.string().trim().optional().allow("", null),
21070
+ type: promoTypeSchema,
21071
+ tiers: import_joi27.default.alternatives().conditional("type", {
21072
+ is: "tiered",
21073
+ then: import_joi27.default.array().items(promoTierSchema).min(1).required(),
21074
+ otherwise: import_joi27.default.forbidden()
21075
+ }),
21076
+ fixed_rate: import_joi27.default.alternatives().conditional("type", {
21077
+ is: "fixed",
21078
+ then: import_joi27.default.number().required().min(0),
21079
+ otherwise: import_joi27.default.number().integer().allow(0)
21080
+ }),
21081
+ expiresAt: import_joi27.default.string().optional().allow("", null)
21082
+ });
21083
+ var promoCodeStatusSchema = import_joi27.default.object({
21084
+ status: import_joi27.default.string().valid("active", "disabled").required()
21085
+ });
21055
21086
  function MPromoCode(data) {
21056
21087
  const { error } = promoCodeSchema.validate(data);
21057
21088
  if (error) {
@@ -21071,10 +21102,66 @@ function MPromoCode(data) {
21071
21102
  status: data.status ?? "active"
21072
21103
  };
21073
21104
  }
21105
+ function promoCodeUpdate(data) {
21106
+ const { error } = promoCodeUpdateSchema.validate(data);
21107
+ if (error) {
21108
+ throw new import_node_server_utils55.BadRequestError(error.message);
21109
+ }
21110
+ return {
21111
+ description: data.description ?? "",
21112
+ type: data.type,
21113
+ tiers: data.type === "tiered" ? data.tiers ?? [] : [],
21114
+ fixed_rate: data.type === "fixed" ? data.fixed_rate ?? 0 : 0,
21115
+ expiresAt: data.expiresAt ?? ""
21116
+ };
21117
+ }
21118
+
21119
+ // src/utils/promo-code-currency.util.ts
21120
+ function parsePromoExpiry(value) {
21121
+ if (!value)
21122
+ return null;
21123
+ const raw = String(value).trim();
21124
+ if (!raw)
21125
+ return null;
21126
+ const endOfDay = (y, m, d) => {
21127
+ const date = new Date(Number(y), Number(m) - 1, Number(d), 23, 59, 59, 999);
21128
+ return date.getMonth() === Number(m) - 1 ? date : null;
21129
+ };
21130
+ const us = raw.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
21131
+ if (us)
21132
+ return endOfDay(us[3], us[1], us[2]);
21133
+ const iso = raw.match(/^(\d{4})-(\d{2})-(\d{2})$/);
21134
+ if (iso)
21135
+ return endOfDay(iso[1], iso[2], iso[3]);
21136
+ const parsed = new Date(raw);
21137
+ return Number.isNaN(parsed.getTime()) ? null : parsed;
21138
+ }
21139
+ function isPromoCodeExpired(value, now = /* @__PURE__ */ new Date()) {
21140
+ const expiry = parsePromoExpiry(value);
21141
+ return !!expiry && expiry.getTime() < now.getTime();
21142
+ }
21143
+ function promoCodeRefusal(code, now = /* @__PURE__ */ new Date()) {
21144
+ if (!code)
21145
+ return null;
21146
+ const status = code.status ?? "active";
21147
+ if (status === "expired" || isPromoCodeExpired(code.expiresAt, now)) {
21148
+ return "This promo code has expired.";
21149
+ }
21150
+ if (status !== "active") {
21151
+ return "This promo code is no longer available.";
21152
+ }
21153
+ return null;
21154
+ }
21074
21155
 
21075
21156
  // src/repositories/promo-code.repo.ts
21076
21157
  var import_joi28 = __toESM(require("joi"));
21077
21158
  var import_mongodb40 = require("mongodb");
21159
+ function assertRedeemable(code) {
21160
+ const refusal = promoCodeRefusal(code);
21161
+ if (refusal) {
21162
+ throw new import_node_server_utils56.BadRequestError(refusal);
21163
+ }
21164
+ }
21078
21165
  function usePromoCodeRepo() {
21079
21166
  const db = import_node_server_utils56.useAtlas.getDb();
21080
21167
  if (!db) {
@@ -21105,7 +21192,29 @@ function usePromoCodeRepo() {
21105
21192
  );
21106
21193
  }
21107
21194
  }
21195
+ async function createTextIndex() {
21196
+ try {
21197
+ await collection.createIndexes([
21198
+ { key: { code: "text", description: "text" } }
21199
+ ]);
21200
+ } catch (error) {
21201
+ throw new import_node_server_utils56.InternalServerError(
21202
+ "Failed to create text index for promo code."
21203
+ );
21204
+ }
21205
+ }
21108
21206
  const { delNamespace, setCache, getCache, delCache } = (0, import_node_server_utils56.useCache)(namespace_collection);
21207
+ async function invalidate(context) {
21208
+ try {
21209
+ await delNamespace();
21210
+ import_node_server_utils56.logger.info(`Cache cleared for namespace: ${namespace_collection}`);
21211
+ } catch (err) {
21212
+ import_node_server_utils56.logger.error(
21213
+ `Failed to clear cache for namespace: ${namespace_collection} (${context})`,
21214
+ err
21215
+ );
21216
+ }
21217
+ }
21109
21218
  async function add(value) {
21110
21219
  try {
21111
21220
  value = MPromoCode(value);
@@ -21154,6 +21263,7 @@ function usePromoCodeRepo() {
21154
21263
  const cachedData = await getCache(cacheKey);
21155
21264
  if (cachedData) {
21156
21265
  import_node_server_utils56.logger.info(`Cache hit for key: ${cacheKey}`);
21266
+ assertRedeemable(cachedData);
21157
21267
  return cachedData;
21158
21268
  }
21159
21269
  const data = await collection.findOne(query2);
@@ -21165,6 +21275,7 @@ function usePromoCodeRepo() {
21165
21275
  }).catch((err) => {
21166
21276
  import_node_server_utils56.logger.error(`Failed to set cache for key: ${cacheKey}`, err);
21167
21277
  });
21278
+ assertRedeemable(data);
21168
21279
  return data;
21169
21280
  } catch (error2) {
21170
21281
  throw error2;
@@ -21213,7 +21324,7 @@ function usePromoCodeRepo() {
21213
21324
  status = "active"
21214
21325
  }) {
21215
21326
  page = page > 0 ? page - 1 : 0;
21216
- const query2 = { status };
21327
+ const query2 = { status, deletedAt: null };
21217
21328
  const cacheOptions = { status };
21218
21329
  sort = Object.keys(sort).length > 0 ? sort : { _id: -1 };
21219
21330
  cacheOptions.sort = JSON.stringify(sort);
@@ -21250,6 +21361,58 @@ function usePromoCodeRepo() {
21250
21361
  throw error;
21251
21362
  }
21252
21363
  }
21364
+ async function updateById(_id, value) {
21365
+ const objectId2 = toObjectId24(_id);
21366
+ const changes = promoCodeUpdate(value);
21367
+ const res = await collection.updateOne(
21368
+ { _id: objectId2, deletedAt: null },
21369
+ { $set: changes }
21370
+ );
21371
+ if (!res.matchedCount) {
21372
+ throw new import_node_server_utils56.NotFoundError("Promo code not found.");
21373
+ }
21374
+ await invalidate(`update ${objectId2}`);
21375
+ return res;
21376
+ }
21377
+ async function updateStatusById(_id, status) {
21378
+ const objectId2 = toObjectId24(_id);
21379
+ const res = await collection.updateOne(
21380
+ { _id: objectId2, deletedAt: null },
21381
+ { $set: { status } }
21382
+ );
21383
+ if (!res.matchedCount) {
21384
+ throw new import_node_server_utils56.NotFoundError("Promo code not found.");
21385
+ }
21386
+ await invalidate(`status ${objectId2}`);
21387
+ return res;
21388
+ }
21389
+ async function softDeleteById(_id, deletedBy) {
21390
+ const objectId2 = toObjectId24(_id);
21391
+ const res = await collection.updateOne(
21392
+ { _id: objectId2, deletedAt: null },
21393
+ {
21394
+ $set: {
21395
+ status: "disabled",
21396
+ deletedAt: (/* @__PURE__ */ new Date()).toISOString(),
21397
+ deletedBy: deletedBy ?? ""
21398
+ }
21399
+ }
21400
+ );
21401
+ if (!res.matchedCount) {
21402
+ throw new import_node_server_utils56.NotFoundError("Promo code not found.");
21403
+ }
21404
+ await invalidate(`delete ${objectId2}`);
21405
+ return res;
21406
+ }
21407
+ function toObjectId24(_id) {
21408
+ const { error } = import_joi28.default.object({
21409
+ _id: import_joi28.default.string().hex().length(24).required()
21410
+ }).validate({ _id: String(_id) });
21411
+ if (error) {
21412
+ throw new import_node_server_utils56.BadRequestError("Invalid promo code ID format.");
21413
+ }
21414
+ return new import_mongodb40.ObjectId(_id);
21415
+ }
21253
21416
  async function assignByUserId({ user, code }, session) {
21254
21417
  const schema2 = import_joi28.default.object({
21255
21418
  user: import_joi28.default.string().required(),
@@ -21283,7 +21446,11 @@ function usePromoCodeRepo() {
21283
21446
  return {
21284
21447
  createIndex,
21285
21448
  createUniqueIndex,
21449
+ createTextIndex,
21286
21450
  add,
21451
+ updateById,
21452
+ updateStatusById,
21453
+ softDeleteById,
21287
21454
  getByCode,
21288
21455
  getById,
21289
21456
  getPromoCodes,
@@ -23694,7 +23861,10 @@ function usePromoCodeController() {
23694
23861
  add: _add,
23695
23862
  getByCode: _getByCode,
23696
23863
  getPromoCodes: _getPromoCodes,
23697
- getById: _getById
23864
+ getById: _getById,
23865
+ updateById: _updateById,
23866
+ updateStatusById: _updateStatusById,
23867
+ softDeleteById: _softDeleteById
23698
23868
  } = usePromoCodeRepo();
23699
23869
  async function add(req, res, next) {
23700
23870
  const payload = { ...req.body };
@@ -23795,11 +23965,81 @@ function usePromoCodeController() {
23795
23965
  return;
23796
23966
  }
23797
23967
  }
23968
+ async function update(req, res, next) {
23969
+ const { error } = import_joi34.default.string().hex().length(24).required().validate(
23970
+ req.params.id
23971
+ );
23972
+ if (error) {
23973
+ import_node_server_utils71.logger.log({ level: "error", message: error.message });
23974
+ next(new import_node_server_utils71.BadRequestError(error.message));
23975
+ return;
23976
+ }
23977
+ try {
23978
+ await requirePlatformStaff(req);
23979
+ await _updateById(req.params.id, req.body);
23980
+ res.json({ message: "Successfully updated promo code." });
23981
+ return;
23982
+ } catch (error2) {
23983
+ import_node_server_utils71.logger.log({ level: "error", message: error2.message });
23984
+ next(error2);
23985
+ return;
23986
+ }
23987
+ }
23988
+ async function updateStatus(req, res, next) {
23989
+ const schema2 = import_joi34.default.object({
23990
+ id: import_joi34.default.string().hex().length(24).required()
23991
+ });
23992
+ const { error } = schema2.validate({ id: req.params.id });
23993
+ if (error) {
23994
+ import_node_server_utils71.logger.log({ level: "error", message: error.message });
23995
+ next(new import_node_server_utils71.BadRequestError(error.message));
23996
+ return;
23997
+ }
23998
+ const status = promoCodeStatusSchema.validate({ status: req.body.status });
23999
+ if (status.error) {
24000
+ import_node_server_utils71.logger.log({ level: "error", message: status.error.message });
24001
+ next(new import_node_server_utils71.BadRequestError(status.error.message));
24002
+ return;
24003
+ }
24004
+ try {
24005
+ await requirePlatformStaff(req);
24006
+ await _updateStatusById(req.params.id, status.value.status);
24007
+ res.json({ message: "Successfully updated promo code status." });
24008
+ return;
24009
+ } catch (error2) {
24010
+ import_node_server_utils71.logger.log({ level: "error", message: error2.message });
24011
+ next(error2);
24012
+ return;
24013
+ }
24014
+ }
24015
+ async function remove(req, res, next) {
24016
+ const { error } = import_joi34.default.string().hex().length(24).required().validate(
24017
+ req.params.id
24018
+ );
24019
+ if (error) {
24020
+ import_node_server_utils71.logger.log({ level: "error", message: error.message });
24021
+ next(new import_node_server_utils71.BadRequestError(error.message));
24022
+ return;
24023
+ }
24024
+ try {
24025
+ const staffId = await requirePlatformStaff(req);
24026
+ await _softDeleteById(req.params.id, staffId);
24027
+ res.json({ message: "Successfully removed promo code." });
24028
+ return;
24029
+ } catch (error2) {
24030
+ import_node_server_utils71.logger.log({ level: "error", message: error2.message });
24031
+ next(error2);
24032
+ return;
24033
+ }
24034
+ }
23798
24035
  return {
23799
24036
  add,
23800
24037
  getByCode,
23801
24038
  getById,
23802
- getPromoCodes
24039
+ getPromoCodes,
24040
+ update,
24041
+ updateStatus,
24042
+ remove
23803
24043
  };
23804
24044
  }
23805
24045
 
@@ -83037,6 +83277,7 @@ function useNotificationPreferenceController() {
83037
83277
  isCameraEntitled,
83038
83278
  isDuplicateVersionError,
83039
83279
  isPatrolCctvCamera,
83280
+ isPromoCodeExpired,
83040
83281
  isRelayPlayerUrl,
83041
83282
  isSuperAdmin,
83042
83283
  isTermsCurrent,
@@ -83062,10 +83303,15 @@ function useNotificationPreferenceController() {
83062
83303
  parseCameraHost,
83063
83304
  parseDahuaFind,
83064
83305
  parseDeviceTime,
83306
+ parsePromoExpiry,
83065
83307
  parseSoftwareVersion,
83066
83308
  pickCustomerSiteProperties,
83067
83309
  platform_terms_namespace_collection,
83310
+ promoCodeRefusal,
83068
83311
  promoCodeSchema,
83312
+ promoCodeStatusSchema,
83313
+ promoCodeUpdate,
83314
+ promoCodeUpdateSchema,
83069
83315
  ptzEndpoint,
83070
83316
  publicCameraFields,
83071
83317
  refuseServiceProviderInviteAction,