import { CSSProperties } from "react"; //#region src/components/smartLocker/types.d.ts interface SmartLockerContext { tenantDomain: string; shopId: string; deviceId: string; locale?: string; } type IdentificationMethod = 'scan' | 'phone' | 'email'; type VerificationCodeMethod = 'sms' | 'email_code'; type VerificationMethod = 'last4' | 'full' | 'password' | VerificationCodeMethod; type LockerIntent = 'store' | 'collect'; type DoorResult = 'opened' | 'failed' | 'unknown'; interface SmartLockerMember { id: string; name: string; mobile: string; email?: string; wristbandId?: string; registered: boolean; /** Whether this member has an active locker booking anywhere in the shop. */ hasActiveLockerBooking?: boolean; /** Missing means unknown; password validation is owned by the customer verification API. */ hasPassword?: boolean; /** Wallet/receipt codes may be available without a physical wristband. */ hasScanCode?: boolean; } interface AuthenticationPolicy { methodOrder: IdentificationMethod[]; methods: Record; } /** Frontend configuration contract. API DTOs are mapped by the service adapter. */ interface SmartLockerConfiguration { revision: string; channelEnabled: boolean; multipleLockers: boolean; authentication: AuthenticationPolicy; } interface LockerView { id: string; number: string; layoutId: string; cabinetId: string; region?: string; enabled: boolean; validation: 'verified' | 'unverified' | 'failed'; door: 'open' | 'closed' | 'unknown'; /** Explicit business occupancy; raw IS available_quantity is not free capacity. */ occupancy?: 'free' | 'reserved' | 'occupied' | 'unknown'; /** Adapter's free-capacity projection, independent of physical stock counters. */ availableQuantity?: number; } interface LockerStoreQuote { id: string; productName: string; durationMinutes: number; amount: string; currency: string; } interface LockerLayout { id: string; name: string; deviceName: string; cabinets: Array<{ id: string; name: string; region?: string; columns?: number; controlPanel?: boolean; lockerIds: string[]; }>; } interface StorageSessionView { id: string; memberId: string; lockerId: string; status: 'reserved' | 'active' | 'attention' | 'ended'; storedAt: number; collectionPolicy: AuthenticationPolicy; collectionPolicyRevision: string; } interface StaffLockerDetails { displayName?: string; phone?: string; email?: string; otherLockerIds?: string[]; } /** Display data only. Backend records and physical controller addresses stay in adapters. */ interface SmartLockerData { pendingOperations?: Array<{ operation: LockerOperation; doorOpened?: boolean; stockReleaseAccepted?: boolean; phase: 'prepare' | 'confirm' | 'complete' | 'cancel'; }>; device: { online: boolean; available: boolean; }; settings: SmartLockerConfiguration & { layoutId: string; }; members: SmartLockerMember[]; layouts: LockerLayout[]; lockers: LockerView[]; storageSessions: StorageSessionView[]; clockMinutes: number; /** Time zone used to display the host's clock and booking timestamps. */ timeZone?: string; } interface SmartLockerOperator { id?: string; name?: string; canOperateLockers: boolean; } interface LockerOperation { id: string; kind: LockerIntent | 'staff'; lockerIds: string[]; memberId?: string; endStorage?: boolean; operatorId?: string; } interface CustomerAuthenticationContext { sessionId: string; configurationRevision: string; intent: LockerIntent; memberId: string; identificationMethod: IdentificationMethod; } interface IdentificationRequest extends Omit { value: string; } interface CustomerOperationRequest extends CustomerAuthenticationContext { /** Optional future server proof. A boolean verification response need not invent a token. */ authorization?: string; /** Quote explicitly reviewed by the customer; never silently change its amount. */ quoteId?: string; } /** * Async adapter seam: an order-backed implementation can finish its prerequisite * workflow inside prepareStore/prepareCollect before returning an operation. * prepare* signals own the operation lifetime, including deliberate retries. * Aborting them releases unsent work; adapters must preserve applied/unknown commands. * Publish authoritative locker/session data before resolving openDoor. A transport * failure after dispatch must be persisted as unknown, including for other subscribers. * finishOperation is idempotent and does not reset physical door state. * Neither the pages nor this contract require a sales/order/stock schema. */ interface SmartLockerService { readonly mode: 'live'; load(context: SmartLockerContext, signal: AbortSignal): Promise; subscribe(context: SmartLockerContext, listener: (data: SmartLockerData) => void): () => void; /** Staff-only projections, guarded by the host's employee authorization adapter. */ loadStaff?(context: SmartLockerContext, signal: AbortSignal): Promise; subscribeStaff?(context: SmartLockerContext, listener: (data: SmartLockerData) => void): () => void; getStaffLockerDetails?(context: SmartLockerContext, lockerId: string, bookingUuid: string, signal: AbortSignal): Promise; /** Check whether this device can offer storage before identifying the customer. Does not reserve a locker. */ checkStoreAvailability(context: SmartLockerContext, signal: AbortSignal): Promise; identify(context: SmartLockerContext, request: IdentificationRequest, signal: AbortSignal): Promise; requestVerification(context: SmartLockerContext, request: CustomerAuthenticationContext & { method: VerificationCodeMethod; }, signal: AbortSignal): Promise<{ retryAfterSeconds: number; } | void>; verifyIdentity(context: SmartLockerContext, request: CustomerAuthenticationContext & { method: VerificationMethod; value: string; }, signal: AbortSignal): Promise<{ verified: boolean; message?: string; authorization?: string; }>; /** Release only this entrance's transient authentication state; never its storage. */ releaseCustomerSession(context: SmartLockerContext, sessionId: string): void; quoteStore(context: SmartLockerContext, request: CustomerOperationRequest, signal: AbortSignal): Promise; prepareStore(context: SmartLockerContext, request: CustomerOperationRequest, signal: AbortSignal): Promise; prepareCollect(context: SmartLockerContext, request: CustomerOperationRequest & { lockerIds: string[]; /** Booking seen on the selection screen, keyed by the physical locker ID. */ bookingUuids?: Record; }, signal: AbortSignal): Promise; prepareStaffOpen(context: SmartLockerContext, lockerIds: string[], operator: SmartLockerOperator | undefined, signal: AbortSignal, endStorage: boolean): Promise; openDoor(context: SmartLockerContext, operation: LockerOperation, lockerId: string, signal: AbortSignal): Promise; finishOperation(context: SmartLockerContext, operation: LockerOperation, signal: AbortSignal): Promise; /** Explicit user cancellation, separate from ordinary page/session cleanup. */ cancelStore?(context: SmartLockerContext, operation: LockerOperation, signal: AbortSignal): Promise; /** Reconcile/finish business steps; never dispatch another physical open. */ retryOperation?(context: SmartLockerContext, operation: LockerOperation, signal: AbortSignal): Promise<{ doors: Record; } | void>; } interface SmartLockerScanSource { subscribe(listener: (payload: { data?: unknown; }) => void, options?: { priority?: number; }): () => void; } interface SmartLockerPhoneCountry { code: string; name: string; callingCode: string; } /** Host-owned system data; an unavailable list must not invent a calling code. */ interface SmartLockerPhoneCountries { status: 'loading' | 'ready' | 'error'; options: readonly SmartLockerPhoneCountry[]; defaultCountry?: string; retry?: () => void; } interface SmartLockerProps { context: SmartLockerContext; service: SmartLockerService; brand?: string; machine?: string; location?: string; registrationUrl?: string; isActive?: boolean; idleRequest?: number; scanSource?: SmartLockerScanSource; phoneCountries?: SmartLockerPhoneCountries; onLocaleChange?(locale: string): void; onRequestSettings?(): void; settingsVerificationOpen?: boolean; onHomePageActiveChange?(active: boolean): void; onIdleBlockedChange?(blocked: boolean): void; onPrerenderComplete?(): void; className?: string; style?: CSSProperties; } interface SmartLockerLockersProps extends Omit { /** Supplied by the existing host; this component has no staff sign-in flow. */ operator?: SmartLockerOperator; } //#endregion export { AuthenticationPolicy, CustomerAuthenticationContext, CustomerOperationRequest, DoorResult, IdentificationMethod, IdentificationRequest, LockerIntent, LockerLayout, LockerOperation, LockerStoreQuote, LockerView, SmartLockerConfiguration, SmartLockerContext, SmartLockerData, SmartLockerLockersProps, SmartLockerMember, SmartLockerOperator, SmartLockerPhoneCountries, SmartLockerPhoneCountry, SmartLockerProps, SmartLockerScanSource, SmartLockerService, StaffLockerDetails, StorageSessionView, VerificationCodeMethod, VerificationMethod };