Refactored `DocReceiverElementService` and `EnvelopeService` to use `IHttpClientFactory` instead of directly injecting `HttpClient`, improving flexibility and testability.
Updated constructors to accept `IHttpClientFactory` and replaced direct `HttpClient` usage with named clients (`"EnvelopeGenerator.Server"`). Adjusted methods to use the factory-created clients for HTTP requests.
Added `using Microsoft.Extensions.Options;` in `Program.cs` and registered `EnvelopeService` and `DocReceiverElementService` in the dependency injection container for proper resolution. Clarified their usage in SSR scenarios with comments.
Removed redundant `using` directives and aligned imports with the updated implementation.
These changes enhance maintainability, scalability, and testability by leveraging `IHttpClientFactory` for better HTTP client management and dependency injection.
Simplified `DocReceiverElementService` and `EnvelopeService` by removing the `ApiOptions` dependency. Updated constructors to eliminate the `IOptions<ApiOptions>` parameter and switched to using relative URLs directly for API requests.
Removed unused `BaseUrl` and `UsePredefinedReports` properties from `ApiOptions`. Cleaned up redundant fields, constructor logic, and unused `using` directives in affected services.
Registered `EnvelopeService` in `Program.cs` with `AddScoped`. These changes improve maintainability, reduce configuration overhead, and make the services more self-contained.
Included `EnvelopeGenerator.Application.Common.Dto`, `EnvelopeGenerator.Server.Client.Models`, `EnvelopeGenerator.Server.Client.Options`, and `Microsoft.AspNetCore.WebUtilities` to support new functionality or dependencies in the `EnvelopeService.cs` file.
Refactored `AuthService` to introduce a reusable `CreateDefaultClient` method, reducing code duplication. Updated all relevant methods in `AuthService` to use this new method.
Added `CultureService` to manage application culture/localization, including support for setting, getting, and initializing culture from `localStorage` or browser settings.
Introduced `DocReceiverElementService` for retrieving document receiver elements (signatures) and `EnvelopeService` for managing envelope data retrieval with optional filters. Both services include error handling and consistent JSON deserialization.
These changes improve code maintainability, reusability, and adhere to the single responsibility principle.