Commit Graph

2501 Commits

Author SHA1 Message Date
ecb7f45f14 Refactor report creation and property initialization
Replaced nullable fields with non-nullable properties for `Report`
and `BasePdfBytes` to improve initialization and encapsulation.
Updated `OnInitializedAsync` to use `BasePdfBytes` and added
error handling for missing PDF bytes.

Refactored report creation logic by removing `BuildFreshBaseReport`
and `CreateReportInstance`, consolidating functionality into a
new `CreateReport` method. Enhanced `CreateReport` to support
both predefined and dynamically generated reports, simplifying
the code structure and improving maintainability.
2026-06-11 13:12:40 +02:00
0ba5578d94 Update appsettings.json configuration options
Removed the `ForceToUseFakeDocument` property from the `Api` section, as it is no longer needed. Added a new property, `UsePredefinedReports`, to the `Api` section with a default value of `false` to enable or disable the use of predefined reports.
2026-06-11 13:11:51 +02:00
e093471a24 Refactor: Replace ForceToUseFakeDocument property
Replaced the `ForceToUseFakeDocument` property in `ApiOptions`
with `UsePredefinedReports` to improve clarity and better align
with business requirements. Updated all references in
`EnvelopeReceiverPage_DxReportViewer.razor` and
`ReportViewer.razor` to use the new property, ensuring
consistency and maintaining functionality.
2026-06-11 13:07:17 +02:00
b16ae70762 Remove signature-related functionality
This commit removes all features and UI elements related to signature handling in the `EnvelopeReceiverPage_DxReportViewer.razor` file.

Key changes include:
- Removed signature creation (drawing, typing, uploading) and associated UI components like the signature popup and action bar.
- Removed annotation handling logic, including toggling checkboxes and applying signatures to annotations.
- Removed PDF export functionality for signed documents.
- Deleted methods and properties related to signature handling, such as `AddSignature`, `OnInitializedAsync`, and `SignaturePopupVisible`.
- Removed `@inject` services and JavaScript interop calls related to signature handling.
- Simplified the `DxReportViewer` usage to only display the report without overlays or interactions.
- Removed envelope metadata display and logout functionality.

The page now focuses solely on displaying reports without any signature-related features.
2026-06-11 13:02:53 +02:00
c3e8f09291 Simplify EnvelopeReceiverPage logic and update settings
Removed redundant `EnvelopeKey` checks in `LogoutAsync` and
`OnInitializedAsync` methods, simplifying logout and initialization
logic. Updated navigation URL to `/envelope/login/`. Streamlined
document fetching logic by removing unnecessary conditions.

Added logging in `CreateReportInstance` to track report creation.
Enabled `ForceToUseFakeDocument` in `appsettings.json` to default
to using fake documents. These changes improve code clarity and
align behavior with updated requirements.
2026-06-11 12:51:04 +02:00
a9fb82bbea Refactor _dotNetRef type and remove unused redirection
Updated the `_dotNetRef` field to use a more specific type, `DotNetObjectReference<EnvelopeReceiverPage_DxReportViewer>`, for better alignment with the component. Removed obsolete redirection logic from `/receiver/{key}` to `/envelope/{key}` in `OnInitializedAsync`, as it is no longer needed or handled elsewhere. Retained envelope access validation logic.
2026-06-11 11:59:21 +02:00
895fd5c509 Add route for DxReportViewer in yarp.json
Introduce a new route configuration for `receiver-ui-envelope-dxreportviewer` in `yarp.json`.
The route matches requests to `/envelope/{EnvelopeKey}/DxReportViewer` for `GET` and `HEAD` methods.
It is part of the `receiver-ui` cluster, with an order of `90`, and includes a transformation to redirect the path to `/index.html`.
This change supports a new endpoint in the application.
2026-06-11 11:58:58 +02:00
3b4278d7e0 Add envelope viewer with signature functionality
Introduced a new Razor page `EnvelopeReceiverPage_DxReportViewer.razor` to manage and sign envelope-related documents. Integrated DevExpress Blazor components for PDF rendering and signature handling.

Key features:
- Added sections for envelope info, signature actions, and a PDF viewer.
- Enabled signature creation via drawing, text input, or image upload.
- Validated and applied signatures to annotated fields in the document.
- Integrated JavaScript interop for signature capture and rendering.
- Supported exporting signed PDFs and dynamic signature overlays.
- Ensured proper resource cleanup with `IDisposable` implementation.
2026-06-11 11:52:11 +02:00
6d1fb05e10 Update solution items in EnvelopeGenerator.sln
Replaced `COPILOT_CONTEXT_EN.md` with `COPILOT_CONTEXT.md`
in the `ProjectSection(SolutionItems)` of the solution file
`EnvelopeGenerator.sln` to reflect updated documentation.
2026-06-11 11:38:59 +02:00
26da78fa22 Refactor ReceiverUI: Rename files, update routes
Renamed Razor component files in ReceiverUI to follow a consistent "Page" naming convention. Updated routes to reference the renamed files. Introduced the root route (`/`) with `Index.razor` as the application entry point.

Updated documentation to reflect the file renames, route changes, and multi-envelope support. Clarified Redis/SQL caching details and deprecated the "Web" frontend in favor of `ReceiverUI`.

These changes improve maintainability, consistency, and developer experience.
2026-06-11 11:38:32 +02:00
9eee2b523d Refactor YARP routes and update configurations
Renamed the `receiver-ui-receiver` route to `receiver-ui-root` and updated its `Order` value from `100` to `300`. Changed the `Match` path for `receiver-ui-root` from `/receiver/{**catch-all}` to `/`. Removed the `receiver-ui-login` route entirely.

Added a `Transforms` section to the `receiver-ui-root` and `receiver-ui-sender` routes, setting the path to `/index.html`.
2026-06-11 11:38:19 +02:00
9dc2b9adef rename Pages\*.razor to Pages\*Page.razor to resolve conflicts 2026-06-11 11:07:32 +02:00
cc3c5ec9f0 Unify architecture with Blazor WASM and YARP proxy
Refactored the deployment architecture to include two distinct
presentation projects: `EnvelopeGenerator.API` (ASP.NET Core Web
API with YARP Reverse Proxy) and `EnvelopeGenerator.ReceiverUI`
(Blazor WebAssembly). The API now acts as the single entry point,
proxying requests to the ReceiverUI and external authentication
services.

Redefined the route structure for clarity, introducing sender
routes (`/sender/login`, `/sender`) and receiver routes
(`/envelope/login/{EnvelopeKey}`, `/envelope/{EnvelopeKey}`).
Added multi-envelope support with per-envelope cookies for
simultaneous authentication.

Renamed `EnvelopeViewer` to `EnvelopeReceiver` to reflect its
expanded functionality for viewing and signing envelopes.
Replaced iText7 and PSPDFKit with PDF.js 3.11.174 for document
viewing and signing, with configurable quality settings.

Updated `AuthService` and `SignatureCacheService` to support the
new route structure and multi-envelope authentication. Adjusted
sender login flow to redirect to `/sender` upon success.

Updated documentation to reflect the new architecture, route
structure, and file renames. Deprecated libraries and past
mistakes were documented to avoid repetition.
2026-06-11 11:02:01 +02:00
2766d963af Update login route and refactor _dotNetRef type
Updated the login route from `/login/{EnvelopeKey}` to
`/envelope/login/{EnvelopeKey}` across the application, including
navigation paths in `EnvelopeReceiver.razor` and the `@page` directive
in `LoginReceiver.razor`.

Refactored `_dotNetRef` in `EnvelopeReceiver.razor` to use
`DotNetObjectReference<enveloperece>?` instead of
`DotNetObjectReference<EnvelopeReceiver>?` to reflect a change in the
referenced type.
2026-06-11 10:59:50 +02:00
8fd9928524 Update routes and add EnvelopeSender component
Added a new `EnvelopeSender.razor` component with the route `/sender`.
Updated the route for `LoginSender.razor` from `/login` to `/sender/login`.
Modified navigation logic in `LoginSender.razor` to redirect to
`/sender` after a successful login instead of the root route.
2026-06-11 10:50:28 +02:00
fb3ee14f8f Initialize _pdfLoaded and update _dotNetRef type
The `_pdfLoaded` variable was initialized to `false` in the `EnvelopeReceiver.razor` file. Additionally, the type of `_dotNetRef` was changed from `DotNetObjectReference<EnvelopeViewer>?` to `DotNetObjectReference<EnvelopeReceiver>?` to reflect the correct object reference.
2026-06-11 10:49:31 +02:00
e3929a99e3 rename EnvelopeViewer to EnvelopeReceiver 2026-06-11 10:48:03 +02:00
b6d86aa3eb Refactor documentation for unified architecture
Updated documentation to reflect the transition to a unified Blazor WASM frontend for both Senders and Receivers. Removed references to PSPDFKit and legacy components, emphasizing the use of PDF.js and DevExpress.

Key changes include:
- Revised purpose and architecture sections.
- Updated solution structure to mark `EnvelopeGenerator.Web` as deprecated.
- Enhanced coordinate system explanation with conversion formulas.
- Documented new `EnvelopeViewer` features and signature workflows.
- Added details on signature caching and login flows for Senders and Receivers.
- Expanded "Mistakes History" to highlight lessons learned.
- Added quick reference for debugging and development consistency.

These changes improve clarity, maintainability, and alignment with the current system architecture.
2026-06-11 10:25:44 +02:00
4171a3138b Add LoginSender.razor for Sender user authentication
Implemented a new `LoginSender.razor` component to provide a login page for "Sender" users. The page includes:
- A responsive card layout with a header, input fields for "Username" and "Password," and a submit button with a loading spinner.
- Error handling for invalid credentials and server errors, with appropriate alerts.
- A password visibility toggle for better user experience.
- Integration with `AuthService` for authentication and `NavigationManager` for redirection.

Added Blazor code-behind logic to manage state, handle login submission, and trigger login on "Enter" key press. The page is styled with a custom theme and includes a footer for support information.
2026-06-11 10:09:59 +02:00
e98e18cfe0 Add sender login functionality to AuthService
Added a `SenderLoginResult` enum to represent outcomes of sender login attempts.
Implemented the `LoginSenderAsync` method in `AuthService` to authenticate sender users via the `/api/auth?cookie=true` endpoint.
The method handles HTTP response codes and returns appropriate `SenderLoginResult` values.
Included the `System.Net.Http.Json` namespace to support JSON-based HTTP requests.
2026-06-11 10:01:33 +02:00
14aff03de4 rename Login.razor as LoginReceiver.razor 2026-06-11 09:59:58 +02:00
d828a5bfe2 Refactor authentication schemes for sender and receiver
Updated `AuthScheme` to introduce a distinct `Sender` scheme
and renamed the `Receiver` scheme for clarity. Updated
`Program.cs` to use the new `Sender` scheme in JWT
authentication and explicitly associate authentication
schemes with `Sender` and `Receiver` policies. Removed the
deprecated `AuthPolicy.ReceiverTFA` policy. These changes
improve the separation and maintainability of authentication
and authorization logic.
2026-06-10 22:25:02 +02:00
a6e174e7c1 Refactor JWT auth scheme configuration
Replaced hardcoded per-envelope receiver JWT auth scheme string with a new `AuthScheme` static class containing a `Receiver` constant. Updated `Program.cs` to use `AuthScheme.Receiver` for authentication and policy configuration. Removed redundant comments and unused constants. Added necessary `using` directive for `AuthScheme`.
2026-06-10 17:14:46 +02:00
fc7aa83513 Refactor authorization policies in Program.cs
Reformatted the `AddAuthorizationBuilder()` method for improved readability and consistency. Updated `AuthPolicy.Receiver` to include an additional role, `"receiver"`, in the `RequireRole` method. No functional changes were made to other policies. These changes enhance code maintainability and introduce a minor adjustment to the `AuthPolicy.Receiver` policy.
2026-06-10 15:39:57 +02:00
90661cb856 Enhance SaveSignatureBehavior with validation and repo logic
Updated SaveSignatureBehavior.cs to improve functionality:
- Added new dependencies: AutoMapper, IRepository, and EF Core.
- Enhanced constructor to initialize new dependencies.
- Updated Handle method to validate signatures and handle errors.
- Introduced repository operations for querying and updating elements.
- Improved error handling with BadRequestException.
- Cleaned up redundant code and resolved namespace conflicts.
2026-06-10 15:18:53 +02:00
04e30b0d79 Add ReceiverAppType property and enum to SigningCommand
Added a new `ReceiverAppType` property to the `SigningCommand`
record, initialized to `ReceiverAppType.ReceiverUI`. Introduced
a `ReceiverAppType` enum with values `ReceiverUI` and `LegacyWeb`.
Updated `SignCommandHandler` to reflect these changes without
modifying its functionality.
2026-06-10 15:18:22 +02:00
d0a50f63db Improve validation and error handling in AnnotationBehavior
Updated `using` directives to include `DigitalData.Core.Exceptions` for enhanced exception handling. Updated the `[Obsolete]` attribute message to reflect PSPDFKit library deprecation. Renamed `cancellationToken` to `cancel` for consistency.

Added validation to ensure `PsPdfKitAnnotation` is only supported for the `LegacyWeb` receiver type. Introduced stricter checks for missing or invalid annotation data, throwing `BadRequestException` when necessary. Updated `await next` calls to use the renamed parameter.

These changes improve code clarity, enforce stricter validation, and enhance error handling.
2026-06-10 15:17:25 +02:00
9d20ba1987 Rename ElementId to Id in Signature record
The `ElementId` property in the `Signature` record was renamed to `Id`. This change simplifies the property name, making it more concise and aligning with standard naming conventions or domain terminology.
2026-06-10 12:38:38 +02:00
66f7b6f5e1 Enhance AutoMapper mappings and add base64 decoding
Updated `MappingProfile` to map `Signature.DataUrl` to
`DocReceiverElement.Ink` using the new `MapDataUrlToRequiredBytes`
extension method. Added `MapDataUrlToRequiredBytes` to handle
base64-encoded data URLs, converting them to byte arrays.

Introduced a `using System;` directive in `AutoMapperAuditingExtensions.cs`
to support `DateTime`. Retained `MapChangedWhen` functionality while
extending mapping capabilities for handling base64 data URLs.
2026-06-10 12:36:35 +02:00
a49dd0ff81 Replace SignatureDto with new Signature record
Replaced the `SignatureDto` record with a new `Signature` record to provide a more robust representation of signature data. Updated `MappingProfile` to map `Signature` to `DocReceiverElement` and removed the old `SignatureDto` mapping. Updated `SigningCommand` to use `IEnumerable<Signature>` instead of `IEnumerable<SignatureDto>`. Removed the old `MappingProfile` class and adjusted namespaces and `using` directives accordingly. These changes improve maintainability and streamline signature handling.
2026-06-10 11:38:02 +02:00
e420e8d47a Update routes to include '/example' prefix in .razor files
Updated the `@page` directives in `DocumentViewer.razor`,
`ReportDesigner.razor`, `ReportViewer.razor`, and `TestViewer.razor`
to prepend the `/example` prefix to their respective routes.

This change modifies the URL paths for accessing these components
to better organize or namespace the routes under the `/example`
prefix. No functional or structural changes were made to the
components themselves.
2026-06-10 11:24:37 +02:00
d7f86adffe Certainly! Please provide the list of code changes so I can help craft a concise and comprehensive commit message for you. 2026-06-10 11:24:12 +02:00
cfb5c15fda Add ReadDocReceiverElementQuery and handler
Introduced `ReadDocReceiverElementQuery` for retrieving document receiver elements and its corresponding handler. Added necessary `using` directives for dependencies like `AutoMapper`, `MediatR`, and `Microsoft.EntityFrameworkCore`.

The handler dynamically filters `DocReceiverElement` data based on optional query parameters (e.g., `Envelope.Id`, `Envelope.Uuid`, `Receiver.Id`, `Receiver.Signature`) using LINQ. Data is fetched asynchronously and mapped to DTOs using `AutoMapper`.
2026-06-10 10:31:56 +02:00
a0ed3e2fe4 Add SaveSignatureBehavior and resolve merge conflicts
Introduced the `SaveSignatureBehavior` class as a pipeline behavior for handling `SigningCommand` requests. Added necessary `using` directives to include required namespaces. Resolved merge conflicts in `using` directives between `net8.0` and `net9.0` project versions. Implemented the `Handle` method to delegate request processing.
2026-06-09 23:28:59 +02:00
f5505190e9 Add SignatureDto and mapping for signature handling
Added a new `SignatureDto` record to represent captured signatures with metadata, including properties like `ElementId`, `DataUrl`, `FullName`, `Position`, and `Place`. Updated `SigningCommand` to include a `Signatures` property for handling multiple signatures, deprecating `PsPdfKitAnnotation`.

Introduced a `MappingProfile` class to map `SignatureDto` to `DocReceiverElement` using AutoMapper. Added necessary `using` directives to support the new mapping configuration.
2026-06-09 23:20:53 +02:00
1bfdbac8ff rename Application.Signature directory as DocReceiverElements 2026-06-09 23:06:30 +02:00
4a29511491 Refactor: Replace Signatures with DocReceiverElements
Updated the codebase to replace the `Signature` record with the new `DocReceiverElementCreateDto` record for better alignment with the domain model.

- Updated `EnvelopeReceiverController` to use `DocReceiverElements` instead of `Signatures` when iterating over `Receivers`.
- Replaced the `Signature` record with `DocReceiverElementCreateDto` in `CreateEnvelopeReceiverCommand`.
- Updated `ReceiverGetOrCreateCommand` to use a `DocReceiverElements` property instead of `Signatures`.

These changes ensure consistency and reflect a shift in how document-related data is represented.
2026-06-09 23:03:18 +02:00
1089304bf1 Refactor: Rename SignatureDto to DocReceiverElementDto
Renamed `SignatureDto` to `DocReceiverElementDto` across the codebase to better reflect its purpose as a DTO for document receiver elements.

Updated all references, including:
- `SignatureController.cs`: Changed `doc.Elements` type to `IEnumerable<DocReceiverElementDto>`.
- `DocumentDto.cs`: Updated `Elements` property type.
- `MappingProfile.cs`: Adjusted mappings for the renamed DTO.
- `IDocumentReceiverElementService.cs` and `DocumentReceiverElementService.cs`: Updated interfaces and services to use the new DTO.
- `TestDocumentReceiverElementController.cs`: Updated generic type parameters.

These changes improve clarity, align naming with the domain model, and ensure consistency throughout the application.
2026-06-09 23:00:11 +02:00
9b606a0d3b rename Domain.Interfaces.ISignature as IDocReceiverElement 2026-06-09 22:56:55 +02:00
cb6dea319b rename Entities.Signature as DocReceiverElement 2026-06-09 22:52:41 +02:00
d59aa6157d Rename SignCommand to SigningCommand across codebase
Updated all references to `SignCommand` to use the new `SigningCommand` name for consistency and clarity. This includes changes to class definitions, method signatures, and pipeline behaviors in the following files:

- `DependencyInjection.cs`: Updated pipeline behaviors to use `SigningCommand`.
- `AnnotationBehavior.cs`: Updated class definition and methods to use `SigningCommand`. Marked `SignCommand` as `[Obsolete]`.
- `DocStatusBehavior.cs`, `EnvelopeReceiverResolutionBehavior.cs`, `HistoryBehavior.cs`, `SendSignedMailBehavior.cs`: Updated class definitions and methods to use `SigningCommand`.
- `SendSignedMailBehavior.cs`: Updated `CreatePlaceHolders` method to accept `SigningCommand`.
- `SigningCommand.cs`: Renamed `SignCommand` record to `SigningCommand` and updated internal methods and properties. Renamed `SignCommandHandler` to `SigningCommandHandler`.

Marked `SignCommand` as `[Obsolete]` where applicable to indicate deprecation. These changes improve code readability and align the command name with its purpose in the signing process.
2026-06-09 22:47:08 +02:00
1569647b60 Update pipeline behaviors for SignCommand in MediatR
Added EnvelopeReceiverResolutionBehavior as the first pipeline
behavior for SignCommand. Updated execution order of existing
behaviors: AnnotationBehavior (2nd), DocStatusBehavior (3rd),
and HistoryBehavior (4th). SendSignedMailBehavior remains last.
Updated comments to reflect the new execution order.
2026-06-09 22:43:37 +02:00
3bb2a013ab Add EnvelopeReceiverResolutionBehavior pipeline behavior
Introduced a new pipeline behavior class `EnvelopeReceiverResolutionBehavior` to resolve and validate the `EnvelopeReceiver` during the signing process.

- Added necessary `using` directives for dependencies such as `AutoMapper`, `MediatR`, and `IRepository`.
- Implemented the `Handle` method to query the database for `EnvelopeReceiver` if not provided in the `SignCommand` request.
- Throws a `NotFoundException` if the `EnvelopeReceiver` is not found.
- Maps the retrieved entity to a DTO and sets it in the request.
- Ensures the behavior executes before other signing process behaviors.
2026-06-09 22:43:19 +02:00
215b755f92 Refactor SignCommand and improve handler comments
Refactored the `SignCommand` class to inherit from `EnvelopeReceiverQueryBase` and introduced a private backing field `_envelopeReceiver` for better encapsulation. Added an internal method `SetEnvelopeReceiver` to manage the envelope receiver data. Updated the `EnvelopeReceiver` property to use the backing field and removed the `required` modifier for more controlled initialization.

Clarified comments in `SignCommandHandler` to emphasize that all processing is handled by pipeline behaviors, leaving the handler intentionally empty. Made minor adjustments to comments for improved clarity and consistency.
2026-06-09 22:42:50 +02:00
3a94733047 Refactor SignCommand and deprecate PsPdfKitAnnotation
Removed the `EmailAddress` property from the `SignCommand` class, which previously retrieved the receiver's email address and threw an exception if the receiver was null. This change eliminates reliance on `EnvelopeReceiver`.

Removed the `ToJson` extension method usage and the associated `using EnvelopeGenerator.Application.Common.Extensions;` directive, as well as the unused `using EnvelopeGenerator.Domain.Constants;` directive.

Marked the `PsPdfKitAnnotation` property as `[Obsolete]`, directing users to use `Signature.Commands.SignCommand` instead, signaling a transition to a newer implementation.
2026-06-09 19:11:55 +02:00
7793d3cbb9 Update EmailOut to use EnvelopeReceiver properties
Updated the `EmailAddress` and `ReferenceString` properties
of the `EmailOut` object in `SendSignedMailBehavior` to use
`request.EnvelopeReceiver.Receiver!.EmailAddress` instead of
`request.EmailAddress`. This ensures the values are derived
from the `EnvelopeReceiver.Receiver` object for improved
accuracy and consistency.
2026-06-09 19:11:44 +02:00
9174065365 Pass cancellationToken to next() in pipeline behaviors
Updated the `Handle` method in multiple classes implementing
`IPipelineBehavior<SignCommand, Unit>` to pass the `cancellationToken`
parameter to the `next()` method. This change ensures consistent
propagation of the `cancellationToken` through the pipeline, enabling
proper handling of cancellation requests during asynchronous operations.

Modified files:
- AnnotationBehavior.cs
- DocStatusBehavior.cs
- HistoryBehavior.cs
- SendSignedMailBehavior.cs
2026-06-09 19:07:38 +02:00
19824afc1c Mark PsPdfKitAnnotation as obsolete; remove TemplateType
The `PsPdfKitAnnotation` property in the `SignCommand` class has been marked as `[Obsolete]` with a deprecation message suggesting the use of `Signature.Commands.SignCommand` instead.

The `TemplateType` property, which returned the `EmailTemplateType.DocumentSigned` value, has been removed from the `SignCommand` class.
2026-06-09 19:07:26 +02:00
c7fe3f0b9c Mark PsPdfKitAnnotation as obsolete
Added an [Obsolete] attribute to the PsPdfKitAnnotation property
in the DocSignedNotification class, indicating that the PSPDFKit
library is deprecated.

Reorganized using directives in DocumentReceiverElementService.cs
to improve consistency and maintain code readability.
2026-06-09 19:04:55 +02:00
a98024063a Refactor namespaces for SignCommand and behaviors
Updated namespaces from `Signature` to `Signatures` for consistency and clarity across the application. Simplified pipeline behavior registrations in `DependencyInjection.cs` by using shorter references. Added `Microsoft.Extensions.Configuration` to `DependencyInjection.cs` to support configuration functionality. Ensured all references to `SignCommand` and related behaviors align with the new namespace structure.
2026-06-09 18:55:31 +02:00