import { Service } from "../serviceSDK"; import { LoginResponse, RegisterRequest, SendOTPResponse, ValidateOTPResponse, CreateUserLoginResponse, GetAccessTokenByOTPResponse, UpdateInfoResponse } from "../../types/auth"; /** * Represents the authentication service. */ export declare class AuthService extends Service { /** * Constructs a new ProductService instance. * @param endpoint - The endpoint URL for the service. * @param orgId - The organization ID. * @param storeId - The store ID. */ constructor(endpoint: string, orgId: string, storeId: string); /** * Logs in a user with the provided login request. * @param loginRequest - The login request object. * @returns A promise that resolves to the login response. */ login(loginRequest: any): Promise; loginPasswordEmployee(dataQuery: any): Promise; /** * Registers a new user with the provided register request. * @param registerRequest - The register request object. * @returns A promise that resolves when the registration is successful. */ register(registerRequest: RegisterRequest): Promise; getUserDetail(accessToken: string): Promise; getUserDetailV2(accessToken: string): Promise; /** * Retrieves user login information using the provided access token. * * @param {string} accessToken - The access token used to authenticate the request. * @returns {Promise} A promise that resolves to the user login information. * @throws Will throw an error if the GraphQL query fails. */ getUserLoginByToken(accessToken: string): Promise; updateProfile(userLoginId: string, name: string, phone: string, email: string): Promise; getUserLoginByUserLoginId(userLoginId: string): Promise; checkUsernameExisted(username: string): Promise; linkingUserLoginAndUserDetail(userLoginId: string, partyId: string): Promise; createUserDetail(userLoginId: string): Promise; createUserDetailV2(orgId: string, userLoginId: string, phone: string, serviceOperator: string): Promise; createUserDetailV3(userLoginId: string, phone: string, name: string, email: string): Promise; sendSmsVerifyCode(username: string): Promise; verifyCode(username: string, code: string): Promise; resetPassword(username: string, newPassword: string, accessToken: string): Promise; loginGoogle(redirectUrl: string, serviceOperator: string, deviceId: string, appId: string, redirectUrlError?: string): Promise; loginGoogleEmployee(redirectUrl: string, serviceOperator: string, deviceId: string, appId: string, orgId: string, type: string, redirectUrlError?: string): Promise; loginFacebook(redirectUrl: string, serviceOperator: string, deviceId: string, appId: string, redirectUrlError?: string): Promise; /** * Logs in a user via Zalo by executing a GraphQL query. * * @param redirectUrl - The URL to redirect the user to after login. * @returns A promise that resolves to the result of the `loginZalo` GraphQL query. * @throws Will throw an error if the GraphQL query fails. */ loginZalo(redirectUrl: string, serviceOperator: string, deviceId: string, appId: string, redirectUrlError?: string): Promise; loginZaloEmployee(redirectUrl: string, serviceOperator: string, deviceId: string, appId: string, orgId: string, type: string, redirectUrlError?: string): Promise; /** * Creates a new organization. * * @param orgName - The name of the organization to create. * @returns A promise that resolves to the result of the createOrg mutation. * @throws Will throw an error if the GraphQL mutation fails. */ createOrg(orgName: string, providerId: string, groupTenantId: string): Promise; /** * Adds a role to a user in an organization. * * @param role - The role to assign to the user. * @param partyId - The party ID of the user. * @param roleType - Optional role type. * @returns A promise that resolves to the result of the addRoleUser mutation. * @throws Will throw an error if the GraphQL mutation fails. */ addRoleUser(role: string, partyId: string, roleType?: string): Promise; /** * Creates a new user login. * * @param userLoginId - The user login ID to create. * @returns A promise that resolves to the result of the createUserLogin mutation. * @throws Will throw an error if the GraphQL mutation fails. */ createUserLogin(userLoginId: string): Promise; /** * Checks if a user login exists. * * @param userLoginId - The user login ID to check. * @returns A promise that resolves to the result of the checkUserLogin query. * @throws Will throw an error if the GraphQL query fails. */ checkUserLogin(userLoginId: string): Promise; /** * Sends OTP code to the specified phone number. * * @param phone - The phone number to send OTP to. * @param type - The type of OTP delivery ('SMS' or 'ZALO'). Defaults to 'SMS' if not specified. * @returns A promise that resolves to the result of the sendOTP mutation. * @throws Will throw an error if the GraphQL mutation fails. */ sendOTP(phone: string, type?: "SMS" | "ZALO"): Promise; sendOTPV2(orgId: String, phone: string, type?: "SMS" | "ZALO"): Promise; /** * Validates OTP code for the specified phone number. * * @param otpCode - The OTP code to validate. * @param phone - The phone number associated with the OTP. * @param type - The type of OTP delivery ('SMS' or 'ZALO'). Defaults to 'SMS' if not specified. * @returns A promise that resolves to the result of the validateOTP mutation. * @throws Will throw an error if the GraphQL mutation fails. */ validateOTP(otpCode: string, phone: string, type?: "SMS" | "ZALO"): Promise; /** * Gets access token by validating OTP code for the specified phone number. * This function validates the OTP and returns an access token if successful. * * @param otpCode - The OTP code to validate. * @param phone - The phone number associated with the OTP. * @param type - The type of OTP delivery ('SMS' or 'ZALO'). Defaults to 'SMS' if not specified. * @returns A promise that resolves to an object containing the access token. * @throws Will throw an error if the GraphQL query fails. */ getAccessTokenByOTP(otpCode: string, phone: string, type: "SMS" | "ZALO", deviceId: string, appId: string): Promise; /** * Creates/sets a password for a user using the updateInfo mutation. * Uses the SDK's internal orgId and token (accessToken). * * @param password - The new password to set. * @returns A promise that resolves to the updated user information. * @throws Will throw an error if the GraphQL mutation fails. */ createPassword(password: string): Promise; /** * Updates user information using the updateInfo mutation. * Uses the SDK's internal orgId and token (accessToken). * * @param updateUserRequest - The user data to update (optional). * @param type - The type parameter (optional, use 'oauth' if not updating password). * @param password - The password to set (optional). * @returns A promise that resolves to the updated user information. * @throws Will throw an error if the GraphQL mutation fails. */ updateInfo(updateUserRequest?: any, type?: string, password?: string): Promise; createResetKey(userLoginId: string): Promise; checkResetKey(resetKey: string): Promise; resetPasswordV2(orgId: string, username: string, newPassword: string, accessToken: string): Promise; getOrganizationsByPartyId(partyId: String, serviceOperator: string, role: String): Promise; getMenus(partyId: string, workspaceId: string, scope: string): Promise; getWorkspaces(partyId: string, scope: string): Promise; logout(token: string): Promise; getOrganizationById(orgId: string): Promise; showLoginSocial(data: any): Promise; getPartyDetailsByPhone(phone: string, serviceOperator: string): Promise; createPartyDetail(dataQuery: any): Promise; getPartyDetailByPhone(phone: string, orgId: string): Promise; }