Handling of AI pack through mmicrosoft store.
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using SQLite;
|
||||
|
||||
namespace Wino.Core.Domain.Entities.Shared;
|
||||
|
||||
public class WinoAccountAddOnCache
|
||||
{
|
||||
[PrimaryKey]
|
||||
public Guid AccountId { get; set; }
|
||||
|
||||
public bool HasAiPack { get; set; }
|
||||
|
||||
public int? AiUsageCount { get; set; }
|
||||
|
||||
public int? AiUsageLimit { get; set; }
|
||||
|
||||
public DateTime? AiBillingPeriodStartUtc { get; set; }
|
||||
|
||||
public DateTime? AiBillingPeriodEndUtc { get; set; }
|
||||
|
||||
public bool HasUnlimitedAccounts { get; set; }
|
||||
|
||||
public DateTime LastUpdatedUtc { get; set; }
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
#nullable enable
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Core.Domain.Enums;
|
||||
|
||||
namespace Wino.Core.Domain.Interfaces;
|
||||
|
||||
public interface IStoreManagementService
|
||||
@@ -13,4 +15,14 @@ public interface IStoreManagementService
|
||||
/// Attempts to purchase the given add-on.
|
||||
/// </summary>
|
||||
Task<StorePurchaseResult> PurchaseAsync(WinoAddOnProductType productType);
|
||||
|
||||
/// <summary>
|
||||
/// Requests a Microsoft Store collections ID key for the current customer.
|
||||
/// </summary>
|
||||
Task<string?> GetCustomerCollectionsIdAsync(string serviceTicket, string publisherUserId);
|
||||
|
||||
/// <summary>
|
||||
/// Requests a Microsoft Store purchase ID key for the current customer.
|
||||
/// </summary>
|
||||
Task<string?> GetCustomerPurchaseIdAsync(string serviceTicket, string publisherUserId);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Models.Accounts;
|
||||
using Wino.Mail.Api.Contracts.Ai;
|
||||
using Wino.Mail.Api.Contracts.Auth;
|
||||
using Wino.Mail.Api.Contracts.Billing;
|
||||
using Wino.Mail.Api.Contracts.Common;
|
||||
|
||||
namespace Wino.Core.Domain.Interfaces;
|
||||
@@ -24,8 +22,9 @@ public interface IWinoAccountApiClient
|
||||
Task<ApiEnvelope<AiTextResultDto>> SummarizeAsync(string html, CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<AiTextResultDto>> TranslateAsync(string html, string targetLanguage, CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<AiTextResultDto>> RewriteAsync(string html, string mode, CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<CheckoutSessionResultDto>> CreateCheckoutSessionAsync(WinoAddOnProductType productId, CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<CustomerPortalResultDto>> CreateCustomerPortalSessionAsync(CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<WinoStoreCollectionsIdTicketInfo>> CreateCollectionsIdTicketAsync(CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<WinoStoreCollectionsIdTicketInfo>> CreatePurchaseIdTicketAsync(CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<JsonElement>> SyncStoreEntitlementsAsync(string? storeIdKey, string? purchaseIdKey, CancellationToken cancellationToken = default);
|
||||
Task<string?> GetSettingsAsync(CancellationToken cancellationToken = default);
|
||||
Task<bool> SaveSettingsAsync(string settingsJson, CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
@@ -4,11 +4,9 @@ using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Core.Domain.Entities.Shared;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Models.Accounts;
|
||||
using Wino.Mail.Api.Contracts.Ai;
|
||||
using Wino.Mail.Api.Contracts.Auth;
|
||||
using Wino.Mail.Api.Contracts.Billing;
|
||||
using Wino.Mail.Api.Contracts.Common;
|
||||
|
||||
namespace Wino.Core.Domain.Interfaces;
|
||||
@@ -22,17 +20,14 @@ public interface IWinoAccountProfileService
|
||||
Task<ApiEnvelope<EmailConfirmationResendResultDto>> ResendEmailConfirmationAsync(string endpoint, string ticket, CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<JsonElement>> ForgotPasswordAsync(string email, CancellationToken cancellationToken = default);
|
||||
Task<WinoAccount?> GetActiveAccountAsync();
|
||||
Task<WinoAccountAddOnSnapshot?> GetCachedAddOnSnapshotAsync();
|
||||
Task<WinoAccount?> GetAuthenticatedAccountAsync(CancellationToken cancellationToken = default);
|
||||
Task<bool> HasActiveAccountAsync();
|
||||
Task<bool> HasAddOnAsync(WinoAddOnProductType productId, CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<AuthUserDto>> GetCurrentUserAsync(CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<AiStatusResultDto>> GetAiStatusAsync(CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<AiTextResultDto>> SummarizeAsync(string html, CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<AiTextResultDto>> TranslateAsync(string html, string targetLanguage, CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<AiTextResultDto>> RewriteAsync(string html, string mode, CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<CheckoutSessionResultDto>> CreateCheckoutSessionAsync(WinoAddOnProductType productId, CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<CustomerPortalResultDto>> CreateCustomerPortalSessionAsync(CancellationToken cancellationToken = default);
|
||||
Task<ApiEnvelope<JsonElement>> SyncStoreEntitlementsAsync(CancellationToken cancellationToken = default);
|
||||
Task<bool> ProcessBillingCallbackAsync(Uri callbackUri, CancellationToken cancellationToken = default);
|
||||
Task SignOutAsync(CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Core.Domain.Models.Accounts;
|
||||
|
||||
namespace Wino.Core.Domain.Interfaces;
|
||||
|
||||
public interface IWinoAddOnService
|
||||
{
|
||||
Task<IReadOnlyList<WinoAddOnInfo>> GetAvailableAddOnsAsync(bool useCachedDataOnly = false, CancellationToken cancellationToken = default);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Accounts;
|
||||
|
||||
public sealed record WinoAccountAddOnSnapshot(
|
||||
bool HasAiPack,
|
||||
int? UsageCount = null,
|
||||
int? UsageLimit = null,
|
||||
DateTimeOffset? BillingPeriodStartUtc = null,
|
||||
DateTimeOffset? BillingPeriodEndUtc = null,
|
||||
bool HasUnlimitedAccounts = false,
|
||||
DateTimeOffset? LastUpdatedUtc = null);
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using Wino.Core.Domain.Enums;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Accounts;
|
||||
|
||||
public sealed record WinoAddOnInfo(
|
||||
WinoAddOnProductType ProductType,
|
||||
bool IsPurchased,
|
||||
int? UsageCount = null,
|
||||
int? UsageLimit = null,
|
||||
double UsagePercentage = 0,
|
||||
DateTimeOffset? RenewalDateUtc = null);
|
||||
@@ -0,0 +1,9 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Accounts;
|
||||
|
||||
public sealed record WinoStoreCollectionsIdTicketInfo(
|
||||
string ServiceTicket,
|
||||
string PublisherUserId,
|
||||
DateTimeOffset ExpiresAtUtc);
|
||||
@@ -1240,14 +1240,17 @@
|
||||
"WinoAddOn_UNLIMITED_ACCOUNTS_Description": "Remove the account limit and add as many mail accounts as you need.",
|
||||
"WinoAddOn_UNLIMITED_ACCOUNTS_Keywords": "accounts, unlimited, premium, add-on",
|
||||
"WinoAccount_Management_PurchaseRequiresSignIn": "Sign in with your Wino Account to complete this purchase.",
|
||||
"WinoAccount_Management_PurchaseStartFailed": "Wino could not start the checkout session for this add-on.",
|
||||
"WinoAccount_Management_PurchaseStartFailed": "Wino could not complete this Microsoft Store purchase.",
|
||||
"WinoAccount_Management_StoreSyncFailed": "Your purchase finished, but Wino could not refresh your account benefits yet. Please try again in a moment.",
|
||||
"WinoAccount_Management_AiPackSubscriptionActive": "Your subscription is active",
|
||||
"WinoAccount_Management_AiPackRenews": "Renews {0:d}",
|
||||
"WinoAccount_Management_AiPackRequestsUsed": "Requests used this month",
|
||||
"WinoAccount_Management_AiPackResets": "Resets {0:d}",
|
||||
"WinoAccount_Management_AiPackUsageLoadFailed": "We had issues loading your AI usage balance.",
|
||||
"WinoAccount_Management_AiPackFeatureTranslate": "Translate",
|
||||
"WinoAccount_Management_AiPackFeatureRewrite": "Rewrite",
|
||||
"WinoAccount_Management_AiPackFeatureSummarize": "Summarize",
|
||||
"WinoAccount_Management_AddOnLoadFailed": "We had issues loading this add-on.",
|
||||
"WinoAccount_Management_SyncPreferencesTitle": "Synchronize Preferences",
|
||||
"WinoAccount_Management_SyncPreferencesDescription": "Import or export your preferences to cloud. Import them across devices.",
|
||||
"WinoAccount_Management_SignOutTitle": "Sign out",
|
||||
|
||||
Reference in New Issue
Block a user