import { Injectable } from '@angular/core'; import { HttpRestService } from '@core/services/http-rest.service'; import { ClientUserSetPasswordPayload, ResetPasswordApiResponse, RootUserResetPasswordPayload, UpdateUserProfile } from '@core/typings/client-user.typing'; @Injectable({ providedIn: 'root' }) export class ClientUserResources { constructor ( private httpRestService: HttpRestService ) { } getUser (includeRoles = true) { return this.httpRestService.get( 'api/manager/user?includeRoles=' + includeRoles ); } requestPasswordEmail (email: string) { return this.httpRestService.post('api/manager/user/RequestPasswordChange', { email }); } requestAccessToUploadImage (data: T) { return this.httpRestService.post('api/manager/user/uploadimageurl', data); } saveProfileImage ( url: string, file: Blob, contentType: string ) { return this.httpRestService.putS3PublicRead(url, file, contentType); } updateProfile ( data: Partial ): Promise { return this.httpRestService.post('api/manager/user/updateprofile', data); } resetPassword ( payload: ClientUserSetPasswordPayload ): Promise { return this.httpRestService.post('api/manager/user/reset', payload); } resetRootUserPassword ( payload: RootUserResetPasswordPayload ): Promise { return this.httpRestService.post('api/manager/user/ChangePassword', payload); } setPassword ( payload: ClientUserSetPasswordPayload ): Promise { return this.httpRestService.post('api/manager/user/setpassword', payload); } deactivateAccount () { const endpoint = 'api/manager/user/DeactivateAccount'; return this.httpRestService.post(endpoint, { clearPersonalData: true }); } confirmUser (token: string) { const endpoint = 'api/manager/user/ConfirmEmail'; return this.httpRestService.post(endpoint, { token }); } getClientAffiliateInfo () { const endpoint = '/api/client/AffiliateInfo'; return this.httpRestService.get(endpoint); } }