AugusteVN.Modules.Sponsorships._Shared.Spa
1.0.7
dotnet add package AugusteVN.Modules.Sponsorships._Shared.Spa --version 1.0.7
NuGet\Install-Package AugusteVN.Modules.Sponsorships._Shared.Spa -Version 1.0.7
<PackageReference Include="AugusteVN.Modules.Sponsorships._Shared.Spa" Version="1.0.7" />
<PackageVersion Include="AugusteVN.Modules.Sponsorships._Shared.Spa" Version="1.0.7" />
<PackageReference Include="AugusteVN.Modules.Sponsorships._Shared.Spa" />
paket add AugusteVN.Modules.Sponsorships._Shared.Spa --version 1.0.7
#r "nuget: AugusteVN.Modules.Sponsorships._Shared.Spa, 1.0.7"
#:package AugusteVN.Modules.Sponsorships._Shared.Spa@1.0.7
#addin nuget:?package=AugusteVN.Modules.Sponsorships._Shared.Spa&version=1.0.7
#tool nuget:?package=AugusteVN.Modules.Sponsorships._Shared.Spa&version=1.0.7
AugusteVN.Modules.Sponsorships._Shared.Spa
Blazor components, state management, and HTTP client for sponsor segment display and management in SPA/Blazor frontends.
Part of the AugusteVN Modules collection.
Extension Method
AddSponsorshipsSharedSpa(this IServiceCollection, IConfiguration, Action<string, Dictionary<string, int>>)
Registers the Sponsorships SPA layer:
- Permissions — Invokes the
addPermissionscallback withnameof(Sponsorships)and the permissions dictionary for frontend claims registration SponsorSegmentsState— Scoped reactive state provider (extendsStateChangeProvider)SponsorSegmentsHttpClient— Scoped HTTP client for all SponsorSegments API calls
// Program.cs
builder.Services.AddSponsorshipsSharedSpa(builder.Configuration, addPermissions: (module, dict) =>
{
// Register permissions for frontend authorization
});
Services
SponsorSegmentsState
Reactive state provider (StateChangeProvider) for sponsor segment UI:
| Property | Type | Description |
|---|---|---|
SponsorSegments |
List<SponsorSegmentResponse>? |
Cached list of loaded sponsor segments |
PaginationMetadata |
PaginationMetadata? |
Current pagination state for lazy loading |
SelectedSponsorSegment |
SponsorSegmentResponse? |
Currently selected segment (notifies on change) |
SponsorSegmentMarkdown |
string |
Default Markdown content for the sponsor segment editor |
SponsorSegmentsHttpClient
HTTP client wrapping all SponsorSegments API endpoints:
| Method | Description |
|---|---|
InitSponsorSegmentsAsync(pageSize, force?) |
Loads the first page of sponsor segments into state (skips if already loaded unless force=true) |
InitMoreSponsorSegmentsAsync(pageSize) |
Loads the next page and appends to the existing list |
GetPaginatedSponsorSegmentsAsync(request) |
Fetches a paginated list from the API |
InitSelectedSponsorSegmentAsync(request, force?) |
Loads a single segment by ID into state (uses cache unless force=true) |
GetSponsorSegmentByIdAsync(request) |
Fetches a single segment by ID from the API |
GetSponsorSegmentForContentAsync(request) |
Fetches the sponsor segment for a blog post slug |
CreateSponsorSegmentAsync(request) |
POSTs a new sponsor segment |
UpdateSponsorSegmentAsync(request) |
PUTs an update to an existing sponsor segment |
Components
GetSponsorSegments
Iterates over all loaded sponsor segments and renders each via a RenderFragment<SponsorSegmentResponse> child content template. Automatically initializes segments on first render.
| Parameter | Type | Default | Description |
|---|---|---|---|
PageSize |
int? |
5 |
Number of segments to fetch per page |
Limit |
int? |
null |
Optional maximum number of segments to display |
IncludeDrafts |
bool |
false |
Whether to include unpublished drafts |
ChildContent |
RenderFragment<SponsorSegmentResponse> |
— | Template for each segment |
LoadMoreSponsorSegmentsBtn
Button component that loads the next page of sponsor segments via InitMoreSponsorSegmentsAsync. Disables automatically when all pages are loaded.
GetSponsorSegmentById
Loads and renders a single sponsor segment by ID.
GetSponsorSegmentForContent
Loads and renders the sponsor segment associated with a specific blog post slug.
CreateSponsorSegmentForm
Full sponsor segment creation form with:
- Markdown textarea with character counter (400 char limit)
- Brand name and email fields
- FluentValidation integration via
FluentValidationValidator - Terms-of-service gating via
IsTosCompletedparameter - Live Markdown preview via
SponsorSegmentMarkdownstate binding TrackingRequestsupport for user/session tracking
| Parameter | Type | Default | Description |
|---|---|---|---|
BtnLabel |
string? |
"Order" |
Submit button label |
IsTosCompleted |
bool |
false |
Whether TOS checkbox is checked |
TrackingData |
TrackingRequest? |
null |
Tracking context for analytics |
OnCreated |
EventCallback<CreateSponsorSegmentRequest> |
— | Fires after successful creation |
UpdateSponsorSegmentForm
Form for editing an existing sponsor segment.
SponsorSegmentPreview
Reactive Markdown-to-HTML preview component. Listens to SponsorSegmentMarkdown state changes and renders the HTML via SponsorSegmentTemplate. Falls back to the default state Markdown when no explicit value is provided.
| Parameter | Type | Description |
|---|---|---|
Title |
string? |
Optional heading for the preview |
SponsorSegmentMarkdown |
string? |
Markdown content to preview (falls back to state default) |
ChildContent |
RenderFragment? |
Additional content below the preview |
OnPreviewChanged |
EventCallback |
Fires when the preview updates |
SponsorSegmentFooter
Footer component displaying segment metadata (brand name, email, creation date, review status) with a styled separator. Review status is color-coded: green for approved, red for declined, grey for cancelled, yellow for pending.
| Parameter | Type | Description |
|---|---|---|
SponsorSegment |
SponsorSegmentResponse |
The segment to display metadata for |
ChildContent |
RenderFragment? |
Additional footer content |
Installation
dotnet add package AugusteVN.Modules.Sponsorships._Shared.Spa
Full Documentation
See the Sponsorships Module README for complete documentation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- AugusteVN._Shared.Contracts (>= 1.1.0)
- AugusteVN.Auth.Permissions.Contracts (>= 1.1.0)
- AugusteVN.Modules.Sponsorships._Shared (>= 1.0.7)
- AugusteVN.Modules.Sponsorships.Templates (>= 1.0.7)
- AugusteVN.Razor.State (>= 1.2.0)
- Blazored.FluentValidation (>= 2.2.0)
- Markdig (>= 0.40.0)
- Microsoft.AspNetCore.Components.Web (>= 10.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.