mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: plan+billing (#5518)
* feat: billing client * feat: subscribe workspace default impl * feat: added create subscription * feat: add get workspace subs * feat: added subscription cancellation * feat: add workspace limits api * fix: update client api * feat: user billing portal * feat: billing UI (#5455) * feat: plan ui * feat: billing ui * feat: settings plan comparison dialog * feat: complete plan+billing ui * feat: backend integration * chore: cleaning * chore: fixes after merge * fix: dependency issue * feat: added subscription plan cancellation information * feat: subscription callback + canceled date * feat: put behind feature flag * feat: downgrade/upgrade dialogs * feat: update limit error codes * fix: billing refresh + downgrade dialog * fix: some minor improvements to settings * chore: use patch for client-api in tauri * fix: add shared-entity to patch * fix: compile * ci: try to add back maximize build space step * test: increase timeout in failing test --------- Co-authored-by: Zack Fu Zi Xiang <speed2exe@live.com.sg>
This commit is contained in:
@ -13,8 +13,9 @@ use tokio_stream::wrappers::WatchStream;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::entities::{
|
||||
AuthResponse, Authenticator, Role, UpdateUserProfileParams, UserCredentials, UserProfile,
|
||||
UserTokenState, UserWorkspace, WorkspaceInvitation, WorkspaceInvitationStatus, WorkspaceMember,
|
||||
AuthResponse, Authenticator, RecurringInterval, Role, SubscriptionPlan, UpdateUserProfileParams,
|
||||
UserCredentials, UserProfile, UserTokenState, UserWorkspace, WorkspaceInvitation,
|
||||
WorkspaceInvitationStatus, WorkspaceMember, WorkspaceSubscription, WorkspaceUsage,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@ -266,6 +267,32 @@ pub trait UserCloudService: Send + Sync + 'static {
|
||||
fn leave_workspace(&self, workspace_id: &str) -> FutureResult<(), FlowyError> {
|
||||
FutureResult::new(async { Ok(()) })
|
||||
}
|
||||
|
||||
fn subscribe_workspace(
|
||||
&self,
|
||||
workspace_id: String,
|
||||
recurring_interval: RecurringInterval,
|
||||
workspace_subscription_plan: SubscriptionPlan,
|
||||
success_url: String,
|
||||
) -> FutureResult<String, FlowyError> {
|
||||
FutureResult::new(async { Err(FlowyError::not_support()) })
|
||||
}
|
||||
|
||||
fn get_workspace_subscriptions(&self) -> FutureResult<Vec<WorkspaceSubscription>, FlowyError> {
|
||||
FutureResult::new(async { Err(FlowyError::not_support()) })
|
||||
}
|
||||
|
||||
fn cancel_workspace_subscription(&self, workspace_id: String) -> FutureResult<(), FlowyError> {
|
||||
FutureResult::new(async { Err(FlowyError::not_support()) })
|
||||
}
|
||||
|
||||
fn get_workspace_usage(&self, workspace_id: String) -> FutureResult<WorkspaceUsage, FlowyError> {
|
||||
FutureResult::new(async { Err(FlowyError::not_support()) })
|
||||
}
|
||||
|
||||
fn get_billing_portal_url(&self) -> FutureResult<String, FlowyError> {
|
||||
FutureResult::new(async { Err(FlowyError::not_support()) })
|
||||
}
|
||||
}
|
||||
|
||||
pub type UserUpdateReceiver = tokio::sync::mpsc::Receiver<UserUpdate>;
|
||||
|
@ -422,3 +422,29 @@ pub struct WorkspaceInvitation {
|
||||
pub status: WorkspaceInvitationStatus,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
pub enum RecurringInterval {
|
||||
Month,
|
||||
Year,
|
||||
}
|
||||
|
||||
pub enum SubscriptionPlan {
|
||||
None,
|
||||
Pro,
|
||||
Team,
|
||||
}
|
||||
|
||||
pub struct WorkspaceSubscription {
|
||||
pub workspace_id: String,
|
||||
pub subscription_plan: SubscriptionPlan,
|
||||
pub recurring_interval: RecurringInterval,
|
||||
pub is_active: bool,
|
||||
pub canceled_at: Option<i64>,
|
||||
}
|
||||
|
||||
pub struct WorkspaceUsage {
|
||||
pub member_count: usize,
|
||||
pub member_count_limit: usize,
|
||||
pub total_blob_bytes: usize,
|
||||
pub total_blob_bytes_limit: usize,
|
||||
}
|
||||
|
Reference in New Issue
Block a user