@techextensor/tab-sdk 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/.editorconfig +16 -0
  2. package/.vscode/extensions.json +6 -0
  3. package/.vscode/launch.json +20 -0
  4. package/.vscode/tasks.json +42 -0
  5. package/README.md +27 -0
  6. package/documents/LibraryCreationGuide.md +82 -0
  7. package/documents/Method Access/analytics.md +6 -0
  8. package/documents/Method Access/app.md +22 -0
  9. package/documents/Method Access/auth.md +14 -0
  10. package/documents/Method Access/crud.md +17 -0
  11. package/documents/Method Access/file.md +5 -0
  12. package/documents/Method Access/form.md +14 -0
  13. package/documents/Method Access/http.md +4 -0
  14. package/documents/Method Access/metadata-utils.md +62 -0
  15. package/documents/Method Access/release.md +5 -0
  16. package/documents/Method Access/report.md +6 -0
  17. package/documents/Method Access/store.md +75 -0
  18. package/documents/Method Access/transition.md +5 -0
  19. package/documents/Method Access/translator.md +16 -0
  20. package/documents/Method Access/ui-actions.md +22 -0
  21. package/nx.json +35 -0
  22. package/package.json +46 -0
  23. package/projects/tab-sdk/README.md +24 -0
  24. package/projects/tab-sdk/ng-package.json +7 -0
  25. package/projects/tab-sdk/package.json +19 -0
  26. package/projects/tab-sdk/project.json +37 -0
  27. package/projects/tab-sdk/src/lib/app/analytics.service.ts +54 -0
  28. package/projects/tab-sdk/src/lib/app/app.service.ts +188 -0
  29. package/projects/tab-sdk/src/lib/app/file.service.ts +92 -0
  30. package/projects/tab-sdk/src/lib/app/release.service.ts +38 -0
  31. package/projects/tab-sdk/src/lib/app/report.service.ts +51 -0
  32. package/projects/tab-sdk/src/lib/app/translator.service.ts +80 -0
  33. package/projects/tab-sdk/src/lib/auth/auth.service.ts +119 -0
  34. package/projects/tab-sdk/src/lib/crud/crud.service.ts +187 -0
  35. package/projects/tab-sdk/src/lib/enum/store.enum.ts +4 -0
  36. package/projects/tab-sdk/src/lib/enum/ui.enum.ts +11 -0
  37. package/projects/tab-sdk/src/lib/http/http.service.ts +63 -0
  38. package/projects/tab-sdk/src/lib/interface/http.interface.ts +8 -0
  39. package/projects/tab-sdk/src/lib/interface/ui.interface.ts +28 -0
  40. package/projects/tab-sdk/src/lib/store/store.service.ts +831 -0
  41. package/projects/tab-sdk/src/lib/tab-sdk.service.ts +84 -0
  42. package/projects/tab-sdk/src/lib/ui/form.service.ts +92 -0
  43. package/projects/tab-sdk/src/lib/ui/ui.service.ts +404 -0
  44. package/projects/tab-sdk/src/lib/util/util.service.ts +53 -0
  45. package/projects/tab-sdk/src/lib/workflow/transition.service.ts +40 -0
  46. package/projects/tab-sdk/src/public-api.ts +10 -0
  47. package/projects/tab-sdk/tsconfig.lib.json +15 -0
  48. package/projects/tab-sdk/tsconfig.lib.prod.json +11 -0
  49. package/projects/tab-sdk/tsconfig.spec.json +15 -0
  50. package/tsconfig.json +37 -0
@@ -0,0 +1,54 @@
1
+ import { inject, Injectable } from '@angular/core';
2
+ import { AppHelper, CommonApiResponse, PerformanceAnalyticsPayload, ScreenPerformancePayload } from '@techextensor/tab-core-utility';
3
+ import { firstValueFrom } from 'rxjs';
4
+
5
+ @Injectable({
6
+ providedIn: 'root'
7
+ })
8
+ export class AnalyticsService {
9
+ private _appHelper: AppHelper = inject(AppHelper);
10
+
11
+ /**
12
+ * Retrieves the summary of performance analytics based on the provided payload.
13
+ *
14
+ * @param payload The performance analytics payload.
15
+ * @returns A promise that resolves to a common API response containing the performance analytics summary.
16
+ */
17
+ async getSummaryOfPerformance(payload: PerformanceAnalyticsPayload): Promise<CommonApiResponse> {
18
+ const response = await firstValueFrom(
19
+ this._appHelper.getSummaryOfPerformanceAnalytics(payload)
20
+ );
21
+ // Return the response from the server
22
+ return response;
23
+ }
24
+
25
+ /**
26
+ * Retrieves the detail of performance analytics based on the provided payload.
27
+ *
28
+ * @param payload The performance analytics payload.
29
+ * @returns A promise that resolves to a common API response containing the performance analytics detail.
30
+ */
31
+ async getDetailOfPerformance(payload: PerformanceAnalyticsPayload): Promise<CommonApiResponse> {
32
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
33
+ const response = await firstValueFrom(
34
+ this._appHelper.getDetailOfPerformanceAnalytics(payload)
35
+ );
36
+ // Return the response from the server
37
+ return response;
38
+ }
39
+
40
+ /**
41
+ * Inserts the screen performance statistics based on the provided payload.
42
+ *
43
+ * @param payload The screen performance payload containing the statistics to be inserted.
44
+ * @returns A promise that resolves to a common API response containing the result of the insertion.
45
+ */
46
+ async insertScreenPerformance(payload: ScreenPerformancePayload): Promise<CommonApiResponse> {
47
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
48
+ const response = await firstValueFrom(
49
+ this._appHelper.insertScreenPerformanceStatistics(payload)
50
+ );
51
+ // Return the response from the server
52
+ return response;
53
+ }
54
+ }
@@ -0,0 +1,188 @@
1
+ import { inject, Injectable } from '@angular/core';
2
+ import { AppHelper, CloneDsqPayload, CommonApiResponse, GetDataJsonByTypePayload, RefreshGlobalSearchDataPayload, RefreshRecordInfoDataPayload, RegisterAppObjectsPayload, SyncAppFieldsPayload } from '@techextensor/tab-core-utility';
3
+ import { firstValueFrom } from 'rxjs';
4
+
5
+ @Injectable({
6
+ providedIn: 'root'
7
+ })
8
+ export class AppService {
9
+ private _appHelper: AppHelper = inject(AppHelper);
10
+
11
+ /**
12
+ * Rebuilds the current app.
13
+ *
14
+ * @returns A promise that resolves to a common API response.
15
+ */
16
+ async rebuild(): Promise<CommonApiResponse> {
17
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
18
+ const response = await firstValueFrom(
19
+ this._appHelper.rebuildApp()
20
+ );
21
+ // Return the response from the server.
22
+ return response;
23
+ }
24
+
25
+ /**
26
+ * Retrieves the schema for the current app.
27
+ *
28
+ * @returns A promise that resolves to a common API response containing the schema.
29
+ */
30
+ async getSchema(): Promise<CommonApiResponse> {
31
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
32
+ const response = await firstValueFrom(
33
+ this._appHelper.getSchema()
34
+ );
35
+ // Return the response from the server
36
+ return response;
37
+ }
38
+
39
+ /**
40
+ * Retrieves the current app's permission.
41
+ *
42
+ * @returns A promise that resolves to a common API response containing the permission information.
43
+ */
44
+ async getPermission(): Promise<CommonApiResponse> {
45
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
46
+ const response = await firstValueFrom(
47
+ this._appHelper.getPermission()
48
+ );
49
+ // Return the response from the server
50
+ return response;
51
+ }
52
+
53
+ /**
54
+ * Registers app objects based on the provided payload.
55
+ *
56
+ * @param payload The register app objects payload.
57
+ * @returns A promise that resolves to a common API response.
58
+ */
59
+ async registerAppObject(payload: RegisterAppObjectsPayload): Promise<CommonApiResponse> {
60
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
61
+ const response = await firstValueFrom(
62
+ this._appHelper.registerAppObjects(payload)
63
+ );
64
+ // Return the response from the server
65
+ return response;
66
+ }
67
+
68
+ /**
69
+ * Clones a data source query (DSQ) based on the provided payload.
70
+ *
71
+ * @param payload The clone DSQ payload.
72
+ * @returns A promise that resolves to a common API response.
73
+ */
74
+ async cloneDsq(payload: CloneDsqPayload): Promise<CommonApiResponse> {
75
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
76
+ const response = await firstValueFrom(
77
+ this._appHelper.cloneDsq(payload)
78
+ );
79
+ // Return the response from the server
80
+ return response;
81
+ }
82
+
83
+ /**
84
+ * Retrieves data in JSON format based on the provided payload.
85
+ *
86
+ * @param payload The get data JSON by type payload.
87
+ * @returns A promise that resolves to a common API response containing the data in JSON format.
88
+ */
89
+ async getDataJsonByType(payload: GetDataJsonByTypePayload): Promise<CommonApiResponse> {
90
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
91
+ const response = await firstValueFrom(
92
+ this._appHelper.getDataJsonByType(payload)
93
+ );
94
+ // Return the response from the server
95
+ return response;
96
+ }
97
+
98
+ /**
99
+ * Synchronizes the current app's fields based on the provided payload.
100
+ *
101
+ * @param payload The sync app fields payload.
102
+ * @returns A promise that resolves to a common API response.
103
+ */
104
+ async syncAppFields(payload: SyncAppFieldsPayload): Promise<CommonApiResponse> {
105
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
106
+ const response = await firstValueFrom(
107
+ this._appHelper.syncAppFields(payload)
108
+ );
109
+ // Return the response from the server
110
+ return response;
111
+ }
112
+
113
+ /**
114
+ * Sets the tab components based on the provided connection ID.
115
+ *
116
+ * @param connectionId The ID of the connection to set the components for.
117
+ * @returns A promise that resolves to a common API response.
118
+ */
119
+ async setTabComponents(connectionId: string): Promise<CommonApiResponse> {
120
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
121
+ const response = await firstValueFrom(
122
+ this._appHelper.setTabComponents(connectionId)
123
+ );
124
+ // Return the response from the server
125
+ return response;
126
+ }
127
+
128
+ /**
129
+ * Performs validation for the connection with the provided ID.
130
+ *
131
+ * @param connectionId The ID of the connection to validate.
132
+ * @returns A promise that resolves to a common API response containing the validation result.
133
+ */
134
+ async performValidation(connectionId: string): Promise<CommonApiResponse> {
135
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
136
+ const response = await firstValueFrom(
137
+ this._appHelper.performValidation(connectionId)
138
+ );
139
+ // Return the response from the server
140
+ return response;
141
+ }
142
+
143
+ /**
144
+ * Tests the connection with the provided connection ID.
145
+ *
146
+ * @param connectionId The ID of the connection to test.
147
+ * @returns A promise that resolves to a common API response containing the test result.
148
+ */
149
+ async testConnection(connectionId: string): Promise<CommonApiResponse> {
150
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
151
+ const response = await firstValueFrom(
152
+ this._appHelper.testConnection(connectionId)
153
+ );
154
+ // Return the response from the server
155
+ return response;
156
+ }
157
+
158
+ /**
159
+ * Refreshes the global search data based on the provided payload.
160
+ *
161
+ * @param payload The refresh global search data payload.
162
+ * @returns A promise that resolves to a common API response containing the refreshed global search data.
163
+ */
164
+ async refreshGlobalSearchData(payload: RefreshGlobalSearchDataPayload): Promise<CommonApiResponse> {
165
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
166
+ const response = await firstValueFrom(
167
+ this._appHelper.refreshGlobalSearchData(payload)
168
+ );
169
+ // Return the response from the server
170
+ return response;
171
+ }
172
+
173
+ /**
174
+ * Refreshes the record information data based on the provided payload.
175
+ *
176
+ * @param payload The refresh record info data payload.
177
+ * @returns A promise that resolves to a common API response containing the refreshed record info data.
178
+ */
179
+ async refreshRecordInfoData(payload: RefreshRecordInfoDataPayload): Promise<CommonApiResponse> {
180
+ // Use the firstValueFrom RxJs operator to await the completion of the observable
181
+ const response = await firstValueFrom(
182
+ this._appHelper.refreshRecordInfoData(payload)
183
+ );
184
+
185
+ // Return the response from the server
186
+ return response;
187
+ }
188
+ }
@@ -0,0 +1,92 @@
1
+ import { inject, Injectable } from '@angular/core';
2
+ import { ApiService, CommonApiResponse, MediaUploadHelper, UploadMediaFilesPayload } from '@techextensor/tab-core-utility';
3
+ import { firstValueFrom } from 'rxjs';
4
+ import { TabSdk } from '../tab-sdk.service';
5
+
6
+ @Injectable({
7
+ providedIn: 'root'
8
+ })
9
+ export class FileService {
10
+ private _mediaUploadHelper: MediaUploadHelper = inject(MediaUploadHelper);
11
+ private apiService: ApiService = inject(ApiService);
12
+
13
+ /**
14
+ * Uploads media files using the provided payload and optional headers.
15
+ *
16
+ * @param payload The payload containing the media files to upload.
17
+ * @param headers Optional headers to pass to the server.
18
+ * @returns A promise that resolves to a common API response.
19
+ */
20
+ async uploadMediaFiles(payload: UploadMediaFilesPayload, headers?: any): Promise<CommonApiResponse> {
21
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
22
+ const response = await firstValueFrom(
23
+ this._mediaUploadHelper.uploadMediaFiles(payload, headers)
24
+ );
25
+ // Return the response from the server
26
+ return response;
27
+ }
28
+
29
+ /**
30
+ * Removes a media file from the server using the provided media ID.
31
+ *
32
+ * @param mediaId The ID of the media file to remove.
33
+ * @returns A promise that resolves to a common API response.
34
+ */
35
+ async removeMediaFile(mediaId: string): Promise<CommonApiResponse> {
36
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
37
+ const response = await firstValueFrom(
38
+ this._mediaUploadHelper.removeMediaFile(mediaId)
39
+ );
40
+ // Return the response from the server
41
+ return response;
42
+ }
43
+
44
+ /**
45
+ * Processes an FTP URL and returns a processed URL.
46
+ *
47
+ * @param params - The parameters containing data, an optional defaultHeader, and an optional imgElement.
48
+ * @returns A promise that resolves to the processed URL or null if an error occurs.
49
+ */
50
+ async processFtpUrl(params: { data: string, defaultHeader?: boolean, imgElement?: HTMLImageElement }): Promise<any> {
51
+ // Return null if the data is invalid
52
+ if (!params?.data || params?.data === 'null' || params?.data === 'undefined') return null;
53
+
54
+ try {
55
+ let url = params.data;
56
+
57
+ // Extract the value from a JSON string if it contains 'value'
58
+ if (url?.includes('value')) {
59
+ url = JSON.parse(url).value;
60
+ }
61
+
62
+ // Check if the URL is an image from the FileManager service
63
+ if (url.includes('FileManager/GetImage')) {
64
+ const options: any = { responseType: 'blob' };
65
+
66
+ // Add default headers if specified
67
+ if (params.defaultHeader) {
68
+ options.headers = TabSdk.util?.getDefaultAppHeaders();
69
+ }
70
+
71
+ // Fetch the image as a blob
72
+ const blob = await firstValueFrom(this.apiService.getByUrl(url, options));
73
+
74
+ // Create an object URL from the blob
75
+ url = URL.createObjectURL(blob);
76
+ }
77
+
78
+ // Set the image element's source to the processed URL
79
+ if (params.imgElement) {
80
+ params.imgElement.src = url;
81
+ params.imgElement.onload = null;
82
+ }
83
+
84
+ return url;
85
+
86
+ } catch (e) {
87
+ // Log any errors that occur during processing
88
+ console.error("Error processing FTP", e);
89
+ return null;
90
+ }
91
+ }
92
+ }
@@ -0,0 +1,38 @@
1
+ import { inject, Injectable } from '@angular/core';
2
+ import { CommonApiResponse, TabReleaseService } from '@techextensor/tab-core-utility';
3
+ import { firstValueFrom } from 'rxjs';
4
+
5
+ @Injectable({
6
+ providedIn: 'root'
7
+ })
8
+ export class ReleaseService {
9
+ private _tabReleaseService: TabReleaseService = inject(TabReleaseService);
10
+
11
+ /**
12
+ * Retrieves the data differences between the current app version and the latest
13
+ * released version of the app.
14
+ *
15
+ * @returns A promise that resolves to a common API response containing the data
16
+ * differences in JSON format.
17
+ */
18
+ async getTabDataDiff(): Promise<CommonApiResponse> {
19
+ const response = await firstValueFrom(
20
+ this._tabReleaseService.getDataJsonDiff()
21
+ );
22
+ return response;
23
+ }
24
+
25
+ /**
26
+ * Retrieves the metadata differences between the current app version and the latest
27
+ * released version of the app.
28
+ *
29
+ * @returns A promise that resolves to a common API response containing the metadata
30
+ * differences in JSON format.
31
+ */
32
+ async getMetaDataDiff(): Promise<CommonApiResponse> {
33
+ const response = await firstValueFrom(
34
+ this._tabReleaseService.getMetaDataJsonDiff()
35
+ );
36
+ return response;
37
+ }
38
+ }
@@ -0,0 +1,51 @@
1
+ import { inject, Injectable } from '@angular/core';
2
+ import { AppHelper, CommonApiResponse, ReportPayload } from '@techextensor/tab-core-utility';
3
+ import { firstValueFrom } from 'rxjs';
4
+
5
+ @Injectable({
6
+ providedIn: 'root'
7
+ })
8
+ export class ReportService {
9
+ private _appHelper: AppHelper = inject(AppHelper);
10
+
11
+ /**
12
+ * Exports a report based on the provided payload.
13
+ *
14
+ * @param payload The payload containing the parameters for the report.
15
+ * @returns A promise that resolves to a common API response containing the report.
16
+ */
17
+ async export(payload: ReportPayload): Promise<CommonApiResponse> {
18
+ const response = await firstValueFrom(
19
+ this._appHelper.exportReport(payload)
20
+ );
21
+ return response;
22
+ }
23
+
24
+ /**
25
+ * Downloads a report based on the provided payload.
26
+ *
27
+ * @param payload The payload containing the parameters for the report.
28
+ * @returns A promise that resolves to a common API response containing the report.
29
+ */
30
+ async download(payload: ReportPayload): Promise<Blob> {
31
+ const response = await firstValueFrom(
32
+ this._appHelper.downloadReport(payload)
33
+ );
34
+ return response;
35
+ }
36
+
37
+ /**
38
+ * Sends a report based on the provided payload.
39
+ *
40
+ * @param payload The payload containing the parameters for the report.
41
+ * @returns A promise that resolves to a common API response containing the report.
42
+ */
43
+ async send(payload: ReportPayload): Promise<CommonApiResponse> {
44
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
45
+ const response = await firstValueFrom(
46
+ this._appHelper.sendReport(payload)
47
+ );
48
+ // Return the response from the server
49
+ return response;
50
+ }
51
+ }
@@ -0,0 +1,80 @@
1
+ import { inject, Injectable } from '@angular/core';
2
+ import { firstValueFrom, Observable } from 'rxjs';
3
+ import { translatePayload, TranslationService } from '@techextensor/tab-core-utility';
4
+
5
+ @Injectable({
6
+ providedIn: 'root'
7
+ })
8
+ export class TranslatorService {
9
+ private readonly _translationService: TranslationService = inject(TranslationService);
10
+
11
+ /**
12
+ * Gets the current active language
13
+ *
14
+ * @returns The current language code
15
+ */
16
+ getCurrentLanguage(): string {
17
+ return this._translationService.getCurrentLanguage();
18
+ }
19
+
20
+ /**
21
+ * Gets an observable of the current language changes
22
+ *
23
+ * @returns An observable of the current language code
24
+ */
25
+ getLanguageChanges(): Observable<string> {
26
+ return this._translationService.currentLanguage$;
27
+ }
28
+
29
+ /**
30
+ * Changes the application language
31
+ *
32
+ * @param payload The translate payload containing language and languageCode
33
+ * @returns A promise that resolves when the language has been changed
34
+ */
35
+ async changeLanguage(payload: translatePayload): Promise<any> {
36
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
37
+ const response = await firstValueFrom(
38
+ this._translationService.changeLanguage(payload)
39
+ );
40
+ // Return the response
41
+ return response;
42
+ }
43
+
44
+ /**
45
+ * Translates a key to the current language
46
+ *
47
+ * @param key The translation key
48
+ * @param params Optional parameters for interpolation
49
+ * @returns The translated string
50
+ */
51
+ translate(key: string, params?: any): string {
52
+ if(!key?.length) return key;
53
+ return this._translationService.translate(key, params);
54
+ }
55
+
56
+ /**
57
+ * Gets a translation as an observable for async operations
58
+ *
59
+ * @param key The translation key
60
+ * @param params Optional parameters for interpolation
61
+ * @returns An observable of the translated string
62
+ */
63
+ async getTranslation(key: string, params?: any): Promise<string> {
64
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
65
+ const translation = await firstValueFrom(
66
+ this._translationService.getTranslation(key, params)
67
+ );
68
+ // Return the translated string
69
+ return translation;
70
+ }
71
+
72
+ /**
73
+ * Registers an external library integration for translations
74
+ *
75
+ * @param handler Function to handle the integration with language and translations
76
+ */
77
+ registerIntegration(handler: (lang: string, translations: any) => void): void {
78
+ this._translationService.registerIntegration(handler);
79
+ }
80
+ }
@@ -0,0 +1,119 @@
1
+ import { inject, Injectable } from '@angular/core';
2
+ import {
3
+ LoginUserRequest,
4
+ AuthService,
5
+ CommonApiResponse,
6
+ RegisterTenant,
7
+ ResetPasswordUserRequest,
8
+ RefreshTokenRequest,
9
+ UserDetailsRequest,
10
+ ChangePasswordUserRequest
11
+ } from '@techextensor/tab-core-utility';
12
+ import { firstValueFrom } from 'rxjs';
13
+
14
+ @Injectable({
15
+ providedIn: 'root'
16
+ })
17
+ export class AuthUtilService {
18
+ private readonly _authService: AuthService = inject(AuthService);
19
+
20
+ /**
21
+ * Authenticates a user based on the provided login credentials.
22
+ *
23
+ * @param credentials The login credentials.
24
+ * @returns The response from the server.
25
+ */
26
+ async login(credentials: LoginUserRequest): Promise<CommonApiResponse> {
27
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
28
+ const response = await firstValueFrom(
29
+ this._authService.signIn(credentials)
30
+ );
31
+ return response;
32
+ }
33
+
34
+ /**
35
+ * Registers a new tenant based on the provided details.
36
+ *
37
+ * @param tenantDetails The tenant details.
38
+ * @returns The response from the server.
39
+ */
40
+ async registerTenant(tenantDetails: RegisterTenant): Promise<CommonApiResponse> {
41
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
42
+ const response = await firstValueFrom(
43
+ this._authService.registerTenant(tenantDetails)
44
+ );
45
+ return response;
46
+ }
47
+
48
+ /**
49
+ * Registers a new user based on the provided user details.
50
+ *
51
+ * @param userDetails The user details.
52
+ * @param headers Optional headers to pass to the server.
53
+ * @returns The response from the server.
54
+ */
55
+ async registerUser(userDetails: any, headers?: Record<string, string>): Promise<CommonApiResponse> {
56
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
57
+ const response = await firstValueFrom(
58
+ this._authService.register(userDetails, headers)
59
+ );
60
+ return response;
61
+ }
62
+
63
+ /**
64
+ * Resets a user's password based on the provided reset password credentials.
65
+ *
66
+ * @param credentials The reset password credentials.
67
+ * @returns The response from the server.
68
+ */
69
+ async resetPassword(credentials: ResetPasswordUserRequest): Promise<CommonApiResponse> {
70
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
71
+ const response = await firstValueFrom(
72
+ this._authService.resetPassword(credentials)
73
+ );
74
+ return response;
75
+ }
76
+
77
+ /**
78
+ * Changes a user's password based on the provided credentials.
79
+ *
80
+ * @param credentials The credentials containing the user's current and new password.
81
+ * @returns The response from the server.
82
+ */
83
+ async changePassword(credentials: ChangePasswordUserRequest): Promise<CommonApiResponse> {
84
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
85
+ const response = await firstValueFrom(
86
+ this._authService.changePassword(credentials)
87
+ );
88
+ return response;
89
+ }
90
+
91
+ /**
92
+ * Refreshes a user's token based on the provided refresh token details.
93
+ *
94
+ * @param tokenDetails The refresh token details.
95
+ * @returns The response from the server.
96
+ */
97
+ async refreshToken(tokenDetails: RefreshTokenRequest): Promise<CommonApiResponse> {
98
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
99
+ const response = await firstValueFrom(
100
+ this._authService.refreshToken(tokenDetails)
101
+ );
102
+ return response;
103
+ }
104
+
105
+ /**
106
+ * Gets the user details for the provided user details request.
107
+ *
108
+ * @param userDetailsRequest The user details request.
109
+ * @param headers Optional headers to pass to the server.
110
+ * @returns The response from the server.
111
+ */
112
+ async getUserDetails(userDetailsRequest: UserDetailsRequest, headers?: Record<string, string>): Promise<CommonApiResponse> {
113
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
114
+ const response = await firstValueFrom(
115
+ this._authService.getUserDetails(userDetailsRequest, headers)
116
+ );
117
+ return response;
118
+ }
119
+ }