/** * Organization SDK Types * * TypeScript type definitions for the Organization SDK. * * @see {@link https://ktw-organization-docs.netlify.app/ | Full Documentation} */ /** * Role is now a flexible string to support different applications. * Common roles: ADMIN, MANAGER, SALES, SUPPORT, USER * * Each application can define its own roles: * - Business: ADMIN, MANAGER, SALES, SUPPORT * - Hospital: ADMIN, DOCTOR, NURSE, PATIENT * - School: ADMIN, TEACHER, STUDENT */ export type MemberRole = string; export declare const CommonRoles: { readonly ADMIN: "ADMIN"; readonly MANAGER: "MANAGER"; readonly SALES: "SALES"; readonly SUPPORT: "SUPPORT"; readonly USER: "USER"; }; export declare const SystemRoles: readonly ["ADMIN", "MANAGER"]; export type SystemRole = typeof SystemRoles[number]; export declare const isSystemRole: (role: string) => role is SystemRole; export declare const hasAdminPermission: (role: string) => boolean; export declare enum InvitationStatus { PENDING = "PENDING", ACCEPTED = "ACCEPTED", REJECTED = "REJECTED", EXPIRED = "EXPIRED" } /** * Organization Role - Custom roles defined by each organization */ export interface OrganizationRole { id: string; organizationId: string; name: string; displayName: string; description?: string; permissions?: Record; isSystem: boolean; isActive: boolean; createdAt: string; updatedAt: string; } export interface CreateRoleDto { name: string; displayName: string; description?: string; permissions?: Record; } export interface UpdateRoleDto { displayName?: string; description?: string; permissions?: Record; isActive?: boolean; } export interface Organization { id: string; name: string; slug: string; description?: string; logoUrl?: string; website?: string; email?: string; phone?: string; address?: string; industry?: string; size?: string; isActive: boolean; createdAt: string; updatedAt: string; members?: OrganizationMember[]; groups?: UserGroup[]; stores?: Store[]; warehouses?: Warehouse[]; roles?: OrganizationRole[]; } export interface Store { id: string; name: string; slug: string; description?: string; address?: string; phone?: string; email?: string; isActive: boolean; organizationId?: string; createdAt: string; updatedAt: string; organization?: Organization; members?: StoreMember[]; warehouses?: StoreWarehouse[]; } export interface Warehouse { id: string; name: string; slug: string; description?: string; address?: string; capacity?: string; isActive: boolean; organizationId?: string; createdAt: string; updatedAt: string; organization?: Organization; members?: WarehouseMember[]; stores?: StoreWarehouse[]; } export interface StoreWarehouse { id: string; storeId: string; warehouseId: string; createdAt: string; store?: Store; warehouse?: Warehouse; } export interface StoreMember { id: string; storeId: string; userId: string; role: string; isActive: boolean; joinedAt: string; updatedAt: string; } export interface WarehouseMember { id: string; warehouseId: string; userId: string; role: string; isActive: boolean; joinedAt: string; updatedAt: string; } export interface OrganizationMember { id: string; organizationId: string; userId: string; role: string; isActive: boolean; joinedAt: string; updatedAt: string; } export interface UserGroup { id: string; organizationId: string; name: string; description?: string; permissions?: Record; createdAt: string; updatedAt: string; members?: GroupMember[]; } export interface GroupMember { id: string; groupId: string; memberId: string; addedAt: string; } export interface Invitation { id: string; organizationId: string; email: string; role: string; token: string; status: InvitationStatus; invitedBy: string; expiresAt: string; createdAt: string; updatedAt: string; } export interface CreateOrganizationDto { name: string; slug: string; description?: string; logoUrl?: string; website?: string; email?: string; phone?: string; address?: string; industry?: string; size?: string; } export interface UpdateOrganizationDto { name?: string; description?: string; logoUrl?: string; website?: string; email?: string; phone?: string; address?: string; industry?: string; size?: string; isActive?: boolean; } export interface AddMemberDto { userId: string; role: string; } export interface UpdateMemberDto { role?: string; isActive?: boolean; } export interface CreateGroupDto { name: string; description?: string; permissions?: Record; } export interface InviteMemberDto { email: string; role: string; frontendUrl?: string; } export interface CreateStoreDto { name: string; slug: string; description?: string; address?: string; phone?: string; email?: string; organizationId?: string; } export interface UpdateStoreDto { name?: string; description?: string; address?: string; phone?: string; email?: string; isActive?: boolean; organizationId?: string; } export interface CreateWarehouseDto { name: string; slug: string; description?: string; address?: string; capacity?: string; organizationId?: string; } export interface UpdateWarehouseDto { name?: string; description?: string; address?: string; capacity?: string; isActive?: boolean; organizationId?: string; } export interface AddStoreMemberDto { userId: string; role: string; } export interface AddWarehouseMemberDto { userId: string; role: string; } export interface LinkStoreWarehouseDto { warehouseId: string; } export interface UpfilesClientOptions { baseUrl?: string; presignPath?: string; presignUrl?: string; headers?: Record; withCredentials?: boolean; apiKey?: string; apiKeyHeader?: 'authorization' | 'x-api-key' | 'x-up-api-key'; completionPath?: string; callCompletionEndpoint?: boolean; }