{ "version": 3, "sources": ["src/app/services/userclaims/userinfo.service.ts"], "sourcesContent": ["import { HttpClient } from '@angular/common/http';\r\nimport { Injectable } from '@angular/core';\r\nimport { MsalService } from '@azure/msal-angular';\r\nimport { Observable, of } from 'rxjs';\r\nimport { map } from 'rxjs/operators'; // Add this import\r\nimport { environment } from 'src/environments/environment';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class UserInfoService {\r\n private apiUrl = environment.apiUrl;\r\n constructor(private msalService: MsalService, private http: HttpClient) {}\r\n\r\n getUserClaims(): Observable {\r\n const account = this.msalService.instance.getActiveAccount();\r\n if (account) {\r\n // Extract claims from account's ID token\r\n const claims = account.idTokenClaims;\r\n return of(claims);\r\n }\r\n return of(null);\r\n }\r\n\r\n getUserInfo(): Observable {\r\n // Example to get a specific claim\r\n return this.getUserClaims().pipe(\r\n map((claims) => ({\r\n name: claims?.name,\r\n email: claims?.preferred_username,\r\n roles: claims?.roles,\r\n }))\r\n );\r\n }\r\n // Save info into UserRole table\r\n createProfile(formData: any): Observable {\r\n return this.http.post(`${this.apiUrl}/user/profile/create`, formData);\r\n }\r\n}\r\n"], "mappings": ";;;;;;;;;;;;;;;AAUM,IAAO,mBAAP,MAAO,iBAAe;EAE1B,YAAoB,aAAkC,MAAgB;AAAlD,SAAA,cAAA;AAAkC,SAAA,OAAA;AAD9C,SAAA,SAAS,YAAY;EAC4C;EAEzE,gBAAa;AACX,UAAM,UAAU,KAAK,YAAY,SAAS,iBAAgB;AAC1D,QAAI,SAAS;AAEX,YAAM,SAAS,QAAQ;AACvB,aAAO,GAAG,MAAM;IAClB;AACA,WAAO,GAAG,IAAI;EAChB;EAEA,cAAW;AAET,WAAO,KAAK,cAAa,EAAG,KAC1B,IAAI,CAAC,YAAY;MACf,MAAM,QAAQ;MACd,OAAO,QAAQ;MACf,OAAO,QAAQ;MACf,CAAC;EAEP;;EAEA,cAAc,UAAa;AACzB,WAAO,KAAK,KAAK,KAAU,GAAG,KAAK,MAAM,wBAAwB,QAAQ;EAC3E;;;mBA3BW,kBAAe,mBAAA,WAAA,GAAA,mBAAA,UAAA,CAAA;AAAA;oFAAf,kBAAe,SAAf,iBAAe,WAAA,YAFd,OAAM,CAAA;AAEd,IAAO,kBAAP;", "names": [] }