diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppComponentBase.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppComponentBase.cs
index cdf63beadb..c55f0867af 100644
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppComponentBase.cs
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppComponentBase.cs
@@ -22,7 +22,7 @@ public partial class AppComponentBase : ComponentBase, IAsyncDisposable
///
///
///
- [AutoInject] protected IPubSubService PubSubService = default!;
+ [AutoInject] protected PubSubService PubSubService = default!;
[AutoInject] protected IConfiguration Configuration = default!;
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppInitializer.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppInitializer.cs
index 6dff25ac30..5e5fe8e0e9 100644
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppInitializer.cs
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppInitializer.cs
@@ -14,14 +14,15 @@ public partial class AppInitializer : AppComponentBase
//#if (notification == true)
[AutoInject] private IPushNotificationService pushNotificationService = default!;
//#endif
- [AutoInject] private SnackBarService snackBarService = default!;
- [AutoInject] private AuthenticationManager authManager = default!;
[AutoInject] private IJSRuntime jsRuntime = default!;
- [AutoInject] private IBitDeviceCoordinator bitDeviceCoordinator = default!;
+ [AutoInject] private Bit.Butil.Console console = default!;
[AutoInject] private IStorageService storageService = default!;
- [AutoInject] private CultureInfoManager cultureInfoManager = default!;
+ [AutoInject] private SnackBarService snackBarService = default!;
+ [AutoInject] private AuthenticationManager authManager = default!;
+ [AutoInject] private ITelemetryContext telemetryContext = default!;
[AutoInject] private NavigationManager navigationManager = default!;
- [AutoInject] private Bit.Butil.Console console = default!;
+ [AutoInject] private CultureInfoManager cultureInfoManager = default!;
+ [AutoInject] private IBitDeviceCoordinator bitDeviceCoordinator = default!;
protected async override Task OnInitAsync()
{
@@ -52,7 +53,7 @@ protected override async Task OnAfterFirstRenderAsync()
if (AppPlatform.IsBlazorHybrid is false)
{
- AppPlatform.OSDescription = await jsRuntime.GetBrowserPlatform();
+ telemetryContext.OS = await jsRuntime.GetBrowserPlatform();
}
}
@@ -60,6 +61,10 @@ private async void AuthenticationStateChanged(Task task)
{
try
{
+ var user = (await task).User;
+ telemetryContext.UserId = user.IsAuthenticated() ? user.GetUserId() : null;
+ telemetryContext.UserSessionId = user.IsAuthenticated() ? user.GetSessionId() : null;
+
//#if (signalr == true)
if (InPrerenderSession is false)
{
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/IdentityHeader.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/IdentityHeader.razor.cs
index 3b9b370dc1..94e763cb98 100644
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/IdentityHeader.razor.cs
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/IdentityHeader.razor.cs
@@ -7,8 +7,8 @@ public partial class IdentityHeader : AppComponentBase, IDisposable
private Action unsubscribeUpdateBackLink = default!;
- [AutoInject] private IThemeService themeService = default!;
- [AutoInject] private ICultureService cultureService = default!;
+ [AutoInject] private ThemeService themeService = default!;
+ [AutoInject] private CultureService cultureService = default!;
[CascadingParameter] private BitDir? currentDir { get; set; }
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/RootLayout.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/RootLayout.razor.cs
index ae9b6759db..8af2b5a449 100644
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/RootLayout.razor.cs
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/RootLayout.razor.cs
@@ -15,8 +15,8 @@ public partial class RootLayout : IDisposable
private Action unsubscribeRouteDataUpdated = default!;
- [AutoInject] private IThemeService themeService = default!;
- [AutoInject] private IPubSubService pubSubService = default!;
+ [AutoInject] private ThemeService themeService = default!;
+ [AutoInject] private PubSubService pubSubService = default!;
[AutoInject] private AuthenticationManager authManager = default!;
[AutoInject] private IExceptionHandler exceptionHandler = default!;
[AutoInject] private NavigationManager navigationManager = default!;
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/UserMenu.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/UserMenu.razor.cs
index a2fdeeefcd..43dde27760 100644
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/UserMenu.razor.cs
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/UserMenu.razor.cs
@@ -14,8 +14,8 @@ public partial class UserMenu
[AutoInject] private Cookie cookie = default!;
[AutoInject] private CultureInfoManager cultureInfoManager = default!;
- [AutoInject] private IThemeService themeService { get; set; } = default!;
- [AutoInject] private ICultureService cultureService { get; set; } = default!;
+ [AutoInject] private ThemeService themeService { get; set; } = default!;
+ [AutoInject] private CultureService cultureService { get; set; } = default!;
[CascadingParameter] private BitDir? currentDir { get; set; }
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignIn/SignInPage.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignIn/SignInPage.razor.cs
index 06f8b50d56..eba2644f2c 100644
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignIn/SignInPage.razor.cs
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignIn/SignInPage.razor.cs
@@ -26,6 +26,7 @@ public partial class SignInPage : IDisposable
[AutoInject] private ILocalHttpServer localHttpServer = default!;
+ [AutoInject] private ITelemetryContext telemetryContext = default!;
[AutoInject] private IIdentityController identityController = default!;
[AutoInject] private IExternalNavigationService externalNavigationService = default!;
@@ -48,7 +49,7 @@ protected override async Task OnInitAsync()
model.UserName = UserNameQueryString;
model.Email = EmailQueryString;
model.PhoneNumber = PhoneNumberQueryString;
- model.DeviceInfo = AppPlatform.OSDescription;
+ model.DeviceInfo = telemetryContext.OS;
if (string.IsNullOrEmpty(OtpQueryString) is false)
{
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Extensions/IClientCoreServiceCollectionExtensions.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Extensions/IClientCoreServiceCollectionExtensions.cs
index 81df0f17e2..7aaeb978ab 100644
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Extensions/IClientCoreServiceCollectionExtensions.cs
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Extensions/IClientCoreServiceCollectionExtensions.cs
@@ -29,15 +29,17 @@ public static IServiceCollection AddClientCoreProjectServices(this IServiceColle
services.AddSingleton(sp => configuration.Get()!);
- services.AddSessioned();
- services.AddSessioned();
+ services.AddSessioned();
services.AddSessioned();
+ services.AddSessioned();
+ services.AddSessioned();
- services.AddTransient();
- services.AddTransient();
- services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
services.AddTransient();
+ services.AddTransient();
services.AddTransient();
+
services.AddTransient();
services.AddTransient();
services.AddTransient();
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppPlatform.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppPlatform.cs
index 4368df6e3a..4c451e99bc 100644
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppPlatform.cs
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppPlatform.cs
@@ -1,5 +1,4 @@
using System.Runtime.Versioning;
-using System.Runtime.InteropServices;
namespace Boilerplate.Client.Core.Services;
@@ -29,6 +28,4 @@ public static partial class AppPlatform
[SupportedOSPlatformGuard("ios")]
public static bool IsIosOnMacOS { get; set; }
-
- public static string OSDescription { get; set; } = RuntimeInformation.OSDescription;
}
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppTelemetryContext.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppTelemetryContext.cs
new file mode 100644
index 0000000000..4b7085ebdf
--- /dev/null
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppTelemetryContext.cs
@@ -0,0 +1,18 @@
+using System.Runtime.InteropServices;
+
+namespace Boilerplate.Client.Core.Services;
+
+public class AppTelemetryContext : ITelemetryContext
+{
+ public virtual Guid? UserId { get; set; }
+
+ public virtual Guid? UserSessionId { get; set; }
+
+ public Guid AppSessionId { get; set; } = Guid.NewGuid();
+
+ public virtual string? OS { get; set; } = RuntimeInformation.OSDescription;
+
+ public virtual string? AppVersion { get; set; } = typeof(AppTelemetryContext).Assembly.GetName().Version?.ToString();
+
+ public virtual string? WebView { get; set; }
+}
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/ICultureService.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/ICultureService.cs
deleted file mode 100644
index 2208e1b0af..0000000000
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/ICultureService.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Boilerplate.Client.Core.Services.Contracts;
-
-public interface ICultureService
-{
- Task ChangeCulture(string? cultureName);
-}
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/IPubSubService.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/IPubSubService.cs
deleted file mode 100644
index ca04272c37..0000000000
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/IPubSubService.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace Boilerplate.Client.Core.Services.Contracts;
-
-///
-/// Contract for Publish/Subscribe pattern.
-///
-public interface IPubSubService
-{
- void Publish(string message, object? payload = null);
- Action Subscribe(string message, Func