export type TLoginChannels = 'userqr' | 'password' | 'phoneotp' | 'numchallenge'; export type TRolePayloadObj = { role: string; role_namespace: string; role_uuid: string; conditions?: { condition_uuid: any; operator: string; field: string; value: string | string[]; }[]; }; export interface IIAMResponse { success: boolean; data: Record; error: null | string; requestID: string; } export interface ICreateProjectUserPayload { username: string; display_name?: string; channels: TLoginChannels[]; channel_details: { phone_number?: string; password?: string; }; role?: string; } export interface IUpdateProjectUserPayload { user_code: string; username?: string; display_name?: string; is_active?: boolean; } export type TProjectUserListPayload = { page: number; per_page: number; search: string; is_active: boolean | undefined; }; export type TGetProjectUserDetailsPayload = { user_code: string; }; export interface ICreateChannelPayload { user_code: string; channels: TLoginChannels[]; details: { phone_number?: string; password?: string; }; } export interface IRemoveChannelPayload { user_code: string; channels: string[]; details: { key_id?: string; phone_number?: string; }; } export interface IRegenerateCredPayload { user_code: string; channel_code: string; whitelisted_ips?: string[]; expires_at?: string; } export interface IManageProjectChannelsPayload { userCode: string; selectedChannels: TLoginChannels[]; originalChannels: TLoginChannels[]; channelDetails: { password?: string; phoneNumber?: string; originalPhone?: string; }; } export interface ICreateAccessUserPayload { resourceNamespace: string; resource: string; resourceType: string; rolesAdd?: TRolePayloadObj[]; rolesUpdate?: TRolePayloadObj[]; rolesRemove?: TRolePayloadObj[]; principalName: string; principal: string; } export interface IGetRelationPayload { principal: string; resource: string; } export interface IUpdateRelationPayload { resourceNamespace: string; resource: string; resourceType: string; rolesAdd?: TRolePayloadObj[]; rolesUpdate?: TRolePayloadObj[]; rolesRemove?: TRolePayloadObj[]; principalName: string; principal: string; } export type TUserAccessListPayload = { search: string; per_page: number; page: number; }; export type TServiceAccountCreatePayload = { username: string; display_name?: string; channels: ['apijwt']; role?: string; channel_details: { whitelisted_ips?: string[]; expires_at?: string; }; }; export type TGetApiUserPayload = { user_code: string; }; export type TUpdateApiUserPayload = { user_code: string; display_name: string; is_active: boolean; }; export type TGetQuotaPayload = Record; export type TGetGroupPayload = { search: string; page: number; limit: number; }; export type TGroupCreatePayload = { groupName: string; }; export type TGroupUpdatePayload = { groupCode: string; groupName?: string; isActive: boolean; }; export type TGroupDetailsPayload = { groupCode: string; }; export type TAddGroupMemberPayload = { groupCode: string; member_name: string; }; export type TRemoveGroupMemberPayload = { groupCode: string; members: string[]; }; export type TGetRolesPayload = { namespace_code?: string; search?: string; page?: number; per_page?: number; }; export type TGetRolePermissionsPayload = { role_uuid: string; page: number; per_page: number; search: string; }; export interface IGetLabelValuesPayload { keys: string[]; } export interface IGetLabelValuesResponse { success: boolean; error: string | null; data: { key: string; value: boolean | null; }[]; } export interface IPermissionCheckPayload { permissions: string[]; } export type TEvaluateUnifiedResult = { value: boolean | string | null; payload: Record | null; reason: string; }; export interface IEvaluateFlagPayload { flagKey: string; properties?: Record; } export interface IEvaluateFlagResponse { result: TEvaluateUnifiedResult; error: string | null; } export interface IAMActionMap { createProjectUser: ICreateProjectUserPayload; updateProjectUser: IUpdateProjectUserPayload; getProjectUserList: TProjectUserListPayload; getProjectUserDetails: TGetProjectUserDetailsPayload; createChannel: ICreateChannelPayload; removeChannel: IRemoveChannelPayload; regenerateCred: IRegenerateCredPayload; manageProjectChannels: IManageProjectChannelsPayload; createApiUser: TServiceAccountCreatePayload; getApiUser: TGetApiUserPayload; updateApiUser: TUpdateApiUserPayload; getApiUserList: TProjectUserListPayload; getQuota: TGetQuotaPayload; getGroupList: TGetGroupPayload; groupCreate: TGroupCreatePayload; updateGroup: TGroupUpdatePayload; getGroupDetails: TGroupDetailsPayload; removeGroupMember: TRemoveGroupMemberPayload; addGroupMember: TAddGroupMemberPayload; getRoles: TGetRolesPayload; getRolePermissions: TGetRolePermissionsPayload; getRoleHierarchy: Record; getUserAccessList: TUserAccessListPayload; createAccessUser: ICreateAccessUserPayload; getRelation: IGetRelationPayload; updateRelation: IUpdateRelationPayload; getLabelValues: IGetLabelValuesPayload; permissionCheck: IPermissionCheckPayload; getFlag: IEvaluateFlagPayload; } export type TActionType = keyof IAMActionMap; declare global { interface Window { IAMRequest?: (actiontype: string, payload: any, requestID: string, project?: string) => void; } } /** * Send an IAM request to manage users, roles, and access control * * @param actiontype - The type of IAM action to perform. Available actions: * - **Project User Actions:** * - `createProjectUser` - Create a new project user with authentication channels * - `updateProjectUser` - Update an existing project user's information * - `getProjectUserList` - Get a list of project users * - `getProjectUserDetails` - Get details for a specific project user * * - **Channel Management Actions:** * - `createChannel` - Create a new authentication channel for a user * - `removeChannel` - Remove an authentication channel from a user * - `regenerateCred` - Regenerate credentials for a user's authentication channel * - `manageProjectChannels` - Manage multiple authentication channels at once * * - **Access Control Actions:** * - `createAccessUser` - Grant access to a user by assigning roles to a resource * - `getRelation` - Get relation details between a principal (user) and a resource * - `updateRelation` - Update relation between principal and resource * * - **API User (Service Account) Actions:** * - `createApiUser` - Create a new service account * - `getApiUser` - Get details for a specific service account * - `updateApiUser` - Update a service account * - `getApiUserList` - Get a list of service accounts * * - **Group Management Actions:** * - `getGroupList` - Get a list of groups * - `groupCreate` - Create a new group * - `updateGroup` - Update group details * - `getGroupDetails` - Get details for a specific group * - `addGroupMember` - Add a member to a group * - `removeGroupMember` - Remove member(s) from a group * * - **Role & Permission Actions:** * - `getRoles` - Get available roles * - `getRolePermissions` - Get permissions for a specific role * - `getRoleHierarchy` - Get the role hierarchy * * - **User Access Actions:** * - `getUserAccessList` - Get list of user access entries * * - **Quota Actions:** * - `getQuota` - Get project quota information * * - **Label Values Actions:** * - `getLabelValues` - Get label values for specified keys * * - **Permission Check Actions:** * - `permissionCheck` - Test whether the current user has the given permissions * * - **Feature Flag Actions:** * - `getFlag` - Evaluate a feature flag for the current project context * * @param payload - The payload specific to the action type. TypeScript will autocomplete the correct structure based on your selected action. * * @param project - Optional project code (e.g., 'PRJ1455'). When provided, will be added to request headers. * * @returns Promise that resolves with the API response data * * @example Creating a project user * ```typescript * const result = await IAMRequest('createProjectUser', { * username: 'john.doe@noon.com', * display_name: 'John Doe', * channels: ['password'], * channel_details: { password: 'secure123' } * }, 'PRJ1455'); * ``` * * @example Granting access to a user * ```typescript * const result = await IAMRequest('createAccessUser', { * resourceNamespace: 'platform', * resource: 'PRJ1455', * resourceType: 'project', * rolesAdd: [{ * role: 'platform.project.viewer', * role_namespace: 'platform', * role_uuid: 'fb7475ad-6e66-419f-930c-29e68e0cb825' * }], * principalName: 'user@noon.com', * principal: 'USR12345' * }, 'PRJ1455'); * ``` * * @example Managing user channels * ```typescript * const result = await IAMRequest('manageProjectChannels', { * userCode: 'USR12345', * selectedChannels: ['password', 'phoneotp'], * originalChannels: ['password'], * channelDetails: { * phoneNumber: '+971501234567', * password: 'newpass123' * } * }, 'PRJ1455'); * ``` * * @example Getting role information * ```typescript * const result = await IAMRequest('getRoles', { * namespace_code: 'platform', * search: 'viewer', * page: 1, * per_page: 20 * }, 'PRJ1455'); * ``` * * @example Getting label values * ```typescript * const result = await IAMRequest('getLabelValues', { * keys: ['feature_flag_1', 'feature_flag_2', 'setting_enabled'] * }, 'PRJ1455'); * ``` * * @example Checking permissions * ```typescript * const result = await IAMRequest('permissionCheck', { * permissions: ['platform.project.viewer'] * }, 'PRJ1455'); * ``` * * @example Evaluating a feature flag * ```typescript * const result = await IAMRequest('getFlag', { * flagKey: 'my_feature_flag', * properties: { country: 'ae' } * }, 'PRJ1455'); * ``` * * @see Partner Platform documentation: https://docs.noon.partners * @see For detailed payload structures, TypeScript autocomplete will guide you based on your selected action */ export declare const IAMRequest: (actiontype: K, payload: IAMActionMap[K], project?: string) => Promise; export default IAMRequest; //# sourceMappingURL=requestHandler.d.ts.map