/** * WorkspaceUser Module — business logic + API integration * * This module wires the generic module state (created by * `createGenericModule`) to network actions using `useModuleEntityV2`. * It contains the domain-specific handlers (create/view/edit/delete), * local validation wiring, and optimistic UI helpers. * * Key responsibilities: * - Expose `useWorkspaceUserModule()` which UI components call for actions * - Keep module-specific `apiParams` and callbacks in one place * - Ensure toast notifications on mutation * * Exported utilities: * - `WorkspaceUserProvider` — provider component used by the page * - `WORKSPACE_USER_ACTION_TYPES` — action type constants (from factory) * - `WORKSPACE_USER_DRAWER` — drawer type constants * - `useWorkspaceUserModule()` — hook that returns handlers and state */ import { RoleBE, WorkspaceBE, WorkspaceUserBE } from "../../type"; import { type RowAction } from "@appcorp/shadcn/components/enhanced-table"; export declare const WORKSPACE_USER_DRAWER: { readonly FILTER_DRAWER: string; readonly FORM_DRAWER: string; readonly MORE_ACTIONS_DRAWER: string; readonly VIEW_DRAWER: string; }; export declare const WORKSPACE_USER_ACTION_TYPES: { readonly RESET_FORM: "RESET_FORM"; readonly SET_CURRENT_PAGE: "SET_CURRENT_PAGE"; readonly SET_PAGE_LIMIT: "SET_PAGE_LIMIT"; readonly SET_SEARCH_QUERY: "SET_SEARCH_QUERY"; readonly SET_DRAWER: "SET_DRAWER"; readonly SET_ITEMS: "SET_ITEMS"; readonly SET_FORM_DATA: "SET_FORM_DATA"; readonly SET_DISABLE_SAVE_BUTTON: "SET_DISABLE_SAVE_BUTTON"; readonly SET_INPUT_FIELD: "SET_INPUT_FIELD"; readonly SET_ERRORS: "SET_ERRORS"; readonly SET_FILTERS: "SET_FILTERS"; }, workspaceUserModuleConfig: import("@react-pakistan/util-functions/factory/generic-module-factory").ModuleConfig<{ items: WorkspaceUserBE[]; count: number; currentPage: number; pageLimit: number; searchQuery: string; disableSaveButton: boolean; drawer: string | null; enabled: boolean; errors: Record; filterEnabled: boolean | undefined; id: string; roleId: string | null; userId: string; workspaceId: string; role: RoleBE | undefined; workspace: WorkspaceBE | undefined; }>, initialWorkspaceUserState: { items: WorkspaceUserBE[]; count: number; currentPage: number; pageLimit: number; searchQuery: string; disableSaveButton: boolean; drawer: string | null; enabled: boolean; errors: Record; filterEnabled: boolean | undefined; id: string; roleId: string | null; userId: string; workspaceId: string; role: RoleBE | undefined; workspace: WorkspaceBE | undefined; }, WorkspaceUserProvider: import("react").FC<{ children: React.ReactNode; }>, workspaceUserReducer: (state: { items: WorkspaceUserBE[]; count: number; currentPage: number; pageLimit: number; searchQuery: string; disableSaveButton: boolean; drawer: string | null; enabled: boolean; errors: Record; filterEnabled: boolean | undefined; id: string; roleId: string | null; userId: string; workspaceId: string; role: RoleBE | undefined; workspace: WorkspaceBE | undefined; }, action: any) => { items: WorkspaceUserBE[]; count: number; currentPage: number; pageLimit: number; searchQuery: string; disableSaveButton: boolean; drawer: string | null; enabled: boolean; errors: Record; filterEnabled: boolean | undefined; id: string; roleId: string | null; userId: string; workspaceId: string; role: RoleBE | undefined; workspace: WorkspaceBE | undefined; }, useWorkspaceUserContext: () => import("@react-pakistan/util-functions/factory/generic-module-factory").GenericModuleContextWithHandlers<{ items: WorkspaceUserBE[]; count: number; currentPage: number; pageLimit: number; searchQuery: string; disableSaveButton: boolean; drawer: string | null; enabled: boolean; errors: Record; filterEnabled: boolean | undefined; id: string; roleId: string | null; userId: string; workspaceId: string; role: RoleBE | undefined; workspace: WorkspaceBE | undefined; }>; export declare const useWorkspaceUserModule: () => { applyFilters: () => void; byIdLoading: boolean; clearFilters: () => void; deleteLoading: boolean; handleChange: (field: string, value: string | number | boolean | undefined | Record) => void; handleCloseDrawer: () => void; handleCreate: () => void; handleDelete: (row?: WorkspaceUserBE) => void; handleEdit: () => void; handleFilters: () => void; handleMoreActions: () => void; handlePageChange: (page: number | unknown) => void; handlePageLimitChange: (limit: number) => void; handleSearch: (query: string) => void; handleSubmit: () => void; handleView: () => void; headerActions: { enabled: boolean; handleOnClick: () => void; label: string; order: number; icon: import("react").ForwardRefExoticComponent & import("react").RefAttributes>; }[]; listLoading: boolean; resetRecordFormState: () => void; rowActions: RowAction[]; updateLoading: boolean; state: { items: WorkspaceUserBE[]; count: number; currentPage: number; pageLimit: number; searchQuery: string; disableSaveButton: boolean; drawer: string | null; enabled: boolean; errors: Record; filterEnabled: boolean | undefined; id: string; roleId: string | null; userId: string; workspaceId: string; role: RoleBE | undefined; workspace: WorkspaceBE | undefined; }; dispatch: React.Dispatch; };