Empezar.BlazorWebClient 1.9.3-alpha

This is a prerelease version of Empezar.BlazorWebClient.
dotnet add package Empezar.BlazorWebClient --version 1.9.3-alpha                
NuGet\Install-Package Empezar.BlazorWebClient -Version 1.9.3-alpha                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Empezar.BlazorWebClient" Version="1.9.3-alpha" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Empezar.BlazorWebClient --version 1.9.3-alpha                
#r "nuget: Empezar.BlazorWebClient, 1.9.3-alpha"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Empezar.BlazorWebClient as a Cake Addin
#addin nuget:?package=Empezar.BlazorWebClient&version=1.9.3-alpha&prerelease

// Install Empezar.BlazorWebClient as a Cake Tool
#tool nuget:?package=Empezar.BlazorWebClient&version=1.9.3-alpha&prerelease                

Empezar.BlazorWebClient

Ease development and maintenance of a blazor web app server project, serving WASM as well as prerendering razor components.

Aim is to consolidate all the common services that all API projects serving WASM or MAUI applications need in secure and robust manner.

Please note, this is a Client only package for Empezar.BlazorWebAPI

Installation

Install the nuget package for Empezar.BlazorWebClient in your API Project.

You can also use Manager Nuget Packages to install the same.

dotnet add package Empezar.BlazorWebClient

Usage

Register the service in Program.cs of API project.

Please note that this service already encapsulates Empezar.Cloud service. Hence, if using this package, you do not need to register Empezar.Cloud service.

services.AddEZRBlazorWebClient(APIBaseAddress, appPlatform);

Tools for Development

IQurl

Manage httpClient calls easily

var response = await qurl.OnPath(Url.Path(BaseAPI.AppSettings).Query("platform", BaseConstants.CurrentPlatform.ToString()), HttpMethod.Get, logger)
.ReadAsStringAsync(CancellationToken.None);

ICrypt

Inject ICrypt for Encryption and Decryption accross all platforms. Encrypt / Decrypt model or string cross platform.

async Task<IResult> (AppPlatform platform, IConfiguration config, ICrypt crypt) =>
				{
					string? microsoftCallbackURLSection = null, googleClientId = null, googleClientSecret = null, googleCallbackURL = null;

					switch (platform)
					{
						case AppPlatform.Windows:
							microsoftCallbackURLSection = "EZRBlazorWebAPI:Authentications:Microsoft:CallbackPath_Win";
							googleClientId = endpoints.Configuration[BaseConfigConstants.GGWinClientId];
							googleClientSecret = endpoints.Configuration[BaseConfigConstants.GGWinClientSecret];
							googleCallbackURL = endpoints.Configuration[BaseConfigConstants.GGWinCallbackPath];
							break;
						case AppPlatform.Android:
							microsoftCallbackURLSection = "EZRBlazorWebAPI:Authentications:Microsoft:CallbackPath_Android";
							googleClientId = endpoints.Configuration[BaseConfigConstants.GGAndClientId];
							googleClientSecret = endpoints.Configuration[BaseConfigConstants.GGAndClientSecret];
							googleCallbackURL = endpoints.Configuration[BaseConfigConstants.GGAndCallbackPath];
							break;
						case AppPlatform.IOS or AppPlatform.MacCatalyst:
							microsoftCallbackURLSection = "EZRBlazorWebAPI:Authentications:Microsoft:CallbackPath_Mac";
							googleClientId = endpoints.Configuration[BaseConfigConstants.GGMacClientId];
							googleClientSecret = endpoints.Configuration[BaseConfigConstants.GGMacClientSecret];
							googleCallbackURL = endpoints.Configuration[BaseConfigConstants.GGMacCallbackPath];
							break;
						case AppPlatform.WASM:
							microsoftCallbackURLSection = "EZRBlazorWebAPI:Authentications:Microsoft:CallbackPath";
							googleClientId = string.Empty;
							googleClientSecret = string.Empty;
							googleCallbackURL = string.Empty;
							break;
						default:
							throw new Exception($"Invalid Platform {platform}");
					}

					string? environment = null;
					return Results.Text(await crypt.EncryptAsync(new AppConfig(
									Environment: string.IsNullOrEmpty(environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")) ? "Production" : environment,
									Microsoft:
										new(Authority: $"{endpoints.Configuration["EZRBlazorWebAPI:Authentications:Microsoft:Instance"]!}{endpoints.Configuration["EZRBlazorWebAPI:Authentications:Microsoft:TenantId"]!}/v2.0",
											ClientId: endpoints.Configuration["EZRBlazorWebAPI:Authentications:Microsoft:ClientId"]!,
											CallbackURL: endpoints.Configuration[microsoftCallbackURLSection]!),
									Google:
										new(ClientId: googleClientId!,
											ClientSecret: googleClientSecret!,
											CallbackURL: googleCallbackURL!),
									AgGridLicenseKey: endpoints.Configuration["EZRBlazorWebAPI:AgGridLicenseKey"]
								), BaseConstants.AppConfigEncryptionKey));
				}

IMini

Compress / Decompress bytes, strings, files

//Compress
await iMini.CompressAsync(byteArray);

//Decompress
await iMini.DecompressAsync(byteArray);

Import / Export

Import and Export excel files or razor components as PDF's or extract HTML to send as email

AsyncChron

Chron job in MAUI and WASM

BaseAppCache

Lazy Caching services on client side

Fily

File service for WASM and MAUI

Port of Handson Table and AG-Grid

Use components <HandsonTable /> or <AGGrid />

Base class for Razor components

Takes case of general activities like creation and disposal along with managing PersistingComponentStateSubscription for sharing prerender data

IEZRAuthenticationService

Provides methods for Authentication which works cross platforms

URL class

manages creating URL with encoding of url query parameters with easy. Implicit conversion to Uri supported. For string, use .ToString();

Please explore for many more such features that can't be documented

License

MIT

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Empezar.BlazorWebClient:

Package Downloads
Empezar.BlazorWebAPI

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.9.3-alpha 36 2/21/2025
1.9.2-alpha 50 2/14/2025
1.9.1-alpha 44 2/14/2025
1.9.0-alpha 45 2/14/2025