Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/Blazorise/Base/BaseComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected override async Task OnAfterRenderAsync( bool firstRender )
{
if ( LicenseChecker.ShouldPrint() )
{
await JSUtilitiesModule.Log( $"%c{LicenseChecker.GetPrintMessage()}", "color: #3B82F6; padding: 0;" );
await JSUtilitiesModule.Log( LicenseChecker.ShowBanner(), $"%c{LicenseChecker.GetPrintMessage()}", "color: #3B82F6; padding: 0;" );
}
}

Expand Down
3 changes: 2 additions & 1 deletion Source/Blazorise/Interfaces/Modules/IJSUtilitiesModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ public interface IJSUtilitiesModule : IBaseJSModule
/// <summary>
/// Writes a log message to the browser console.
/// </summary>
/// <param name="showBanner">If true, shows the Blazorise banner.</param>
/// <param name="message">Message to write.</param>
/// <param name="args">Optional parameters.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
ValueTask Log( string message, params string[] args );
ValueTask Log( bool showBanner, string message, params string[] args );

/// <summary>
/// Checks if the current system theme is in dark mode.
Expand Down
12 changes: 12 additions & 0 deletions Source/Blazorise/Licensing/BlazoriseLicenseChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ internal bool ShouldPrint()
return false;
}

internal bool ShowBanner()
{
return !( BlazoriseLicenseProvider.PrintResult == BlazoriseLicensePrintResult.Licensed
|| BlazoriseLicenseProvider.PrintResult == BlazoriseLicensePrintResult.Community
|| BlazoriseLicenseProvider.PrintResult == BlazoriseLicensePrintResult.Trial );
}

internal string GetPrintMessage()
{
if ( BlazoriseLicenseProvider.PrintResult == BlazoriseLicensePrintResult.Community )
Expand All @@ -59,6 +66,11 @@ internal string GetPrintMessage()
return "Your Community License for the Blazorise component library has expired. To continue using our library and receive updates, please renew your license at https://blazorise.com/acount. Thank you for your continued interest in Blazorise!";
}

if ( BlazoriseLicenseProvider.PrintResult == BlazoriseLicensePrintResult.TrialExpired )
{
return "Your trial period for the Blazorise component library has expired. To continue using our library and access premium features, please consider purchasing a commercial license at https://blazorise.com/commercial. We appreciate your interest in Blazorise and look forward to serving you!";
}

if ( BlazoriseLicenseProvider.PrintResult == BlazoriseLicensePrintResult.LicensedExpired )
{
return "Your Commercial License for the Blazorise component library has expired. Please renew your license at https://blazorise.com/account to maintain access to premium features and support. We appreciate your business and look forward to continuing our partnership!";
Expand Down
5 changes: 5 additions & 0 deletions Source/Blazorise/Licensing/BlazoriseLicensePrintResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public enum BlazoriseLicensePrintResult
/// </summary>
Trial,

/// <summary>
/// Indicates whether the trial period for the application has expired.
/// </summary>
TrialExpired,

/// <summary>
/// License was unable to be validated.
/// </summary>
Expand Down
21 changes: 20 additions & 1 deletion Source/Blazorise/Licensing/BlazoriseLicenseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,29 @@ public sealed class BlazoriseLicenseProvider
{
#region Members

/// <summary>
/// The default maximum number of rows allowed in a data grid for unlicensed users.
/// </summary>
public const int DEFAULT_UNLICENSED_LIMIT_DATAGRID_MAX_ROWS = 1000;

/// <summary>
/// The default maximum number of rows returned by the autocomplete feature for unlicensed users.
/// </summary>
public const int DEFAULT_UNLICENSED_LIMIT_AUTOCOMPLETE_MAX_ROWS = 1000;

/// <summary>
/// The default maximum number of rows allowed in charts for unlicensed users.
/// </summary>
public const int DEFAULT_UNLICENSED_LIMIT_CHARTS_MAX_ROWS = 10;

/// <summary>
/// The default maximum number of rows that can be displayed in a list view for unlicensed users.
/// </summary>
public const int DEFAULT_UNLICENSED_LIMIT_LISTVIEW_MAX_ROWS = 1000;

/// <summary>
/// The default maximum number of rows displayed in a tree view for unlicensed users.
/// </summary>
public const int DEFAULT_UNLICENSED_LIMIT_TREEVIEW_MAX_ROWS = 100;

private static readonly Assembly CurrentAssembly = typeof( BlazoriseLicenseProvider ).Assembly;
Expand Down Expand Up @@ -161,7 +180,7 @@ private static BlazoriseLicensePrintResult ResolveBlazoriseLicensePrintResult( L
}

if ( licenseResult == BlazoriseLicenseResult.Trial )
return BlazoriseLicensePrintResult.Trial;
return Result == BlazoriseLicenseResult.Trial ? BlazoriseLicensePrintResult.Trial : BlazoriseLicensePrintResult.TrialExpired;

return BlazoriseLicensePrintResult.None;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Blazorise/Modules/JSUtilitiesModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public ValueTask CopyToClipboard( ElementReference elementRef, string elementId
=> InvokeSafeVoidAsync( "copyToClipboard", elementRef, elementId );

/// <inheritdoc/>
public ValueTask Log( string message, params string[] args )
=> InvokeSafeVoidAsync( "log", message, args );
public ValueTask Log( bool showBanner, string message, params string[] args )
=> InvokeSafeVoidAsync( "log", showBanner, message, args );

private ElementReference? ResolveElementReference( ElementReference elementReference )
=> elementReference.Context is null ? null : elementReference;
Expand Down
6 changes: 5 additions & 1 deletion Source/Blazorise/wwwroot/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,13 @@ export function verifyRsa(publicKey, content, signature) {
return false;
}

export function log(message, args) {
export function log(showBanner, message, args) {
console.log(message, args);

if (!showBanner) {
return;
}

const HOST_ID = "blazorise-license-banner-host";
const GLOBAL = "__blazoriseBannerState__";

Expand Down
Loading