Add Stripe notifications, messaging improvements, and code cleanup
Stripe Notifications: - Add periodic task to check Stripe Connect accounts for requirements - Create in-app notifications for business owners when action needed - Add management command to setup Stripe periodic tasks - Display Stripe notifications with credit card icon in notification bell - Navigate to payments page when Stripe notification clicked Messaging Improvements: - Add "Everyone" option to broadcast message recipients - Allow sending messages to yourself (remove self-exclusion) - Fix broadcast message ID not returned after creation - Add real-time websocket support for broadcast notifications - Show toast when broadcast message received via websocket UI Fixes: - Remove "View all" button from notifications (no page exists) - Add StripeNotificationBanner component for Connect alerts - Connect useUserNotifications hook in TopBar for app-wide websocket Code Cleanup: - Remove legacy automations app and plugin system - Remove safe_scripting module (moved to Activepieces) - Add migration to remove plugin-related models - Various test improvements and coverage additions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -543,3 +543,109 @@ export const reactivateSubscription = (subscriptionId: string) =>
|
||||
apiClient.post<ReactivateSubscriptionResponse>('/payments/subscriptions/reactivate/', {
|
||||
subscription_id: subscriptionId,
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// Stripe Settings (Connect Accounts)
|
||||
// ============================================================================
|
||||
|
||||
export type PayoutInterval = 'daily' | 'weekly' | 'monthly' | 'manual';
|
||||
export type WeeklyAnchor = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
|
||||
|
||||
export interface PayoutSchedule {
|
||||
interval: PayoutInterval;
|
||||
delay_days: number;
|
||||
weekly_anchor: WeeklyAnchor | null;
|
||||
monthly_anchor: number | null;
|
||||
}
|
||||
|
||||
export interface PayoutSettings {
|
||||
schedule: PayoutSchedule;
|
||||
statement_descriptor: string;
|
||||
}
|
||||
|
||||
export interface BusinessProfile {
|
||||
name: string;
|
||||
support_email: string;
|
||||
support_phone: string;
|
||||
support_url: string;
|
||||
}
|
||||
|
||||
export interface BrandingSettings {
|
||||
primary_color: string;
|
||||
secondary_color: string;
|
||||
icon: string;
|
||||
logo: string;
|
||||
}
|
||||
|
||||
export interface BankAccount {
|
||||
id: string;
|
||||
bank_name: string;
|
||||
last4: string;
|
||||
currency: string;
|
||||
default_for_currency: boolean;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface StripeSettings {
|
||||
payouts: PayoutSettings;
|
||||
business_profile: BusinessProfile;
|
||||
branding: BrandingSettings;
|
||||
bank_accounts: BankAccount[];
|
||||
}
|
||||
|
||||
export interface StripeSettingsUpdatePayouts {
|
||||
schedule?: Partial<PayoutSchedule>;
|
||||
statement_descriptor?: string;
|
||||
}
|
||||
|
||||
export interface StripeSettingsUpdate {
|
||||
payouts?: StripeSettingsUpdatePayouts;
|
||||
business_profile?: Partial<BusinessProfile>;
|
||||
branding?: Pick<BrandingSettings, 'primary_color' | 'secondary_color'>;
|
||||
}
|
||||
|
||||
export interface StripeSettingsUpdateResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface StripeSettingsErrorResponse {
|
||||
errors: Record<string, string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Stripe account settings for Connect accounts.
|
||||
* Includes payout schedule, business profile, branding, and bank accounts.
|
||||
*/
|
||||
export const getStripeSettings = () =>
|
||||
apiClient.get<StripeSettings>('/payments/settings/');
|
||||
|
||||
/**
|
||||
* Update Stripe account settings.
|
||||
* Can update payout settings, business profile, or branding.
|
||||
*/
|
||||
export const updateStripeSettings = (updates: StripeSettingsUpdate) =>
|
||||
apiClient.patch<StripeSettingsUpdateResponse>('/payments/settings/', updates);
|
||||
|
||||
// ============================================================================
|
||||
// Connect Login Link
|
||||
// ============================================================================
|
||||
|
||||
export interface LoginLinkRequest {
|
||||
return_url?: string;
|
||||
refresh_url?: string;
|
||||
}
|
||||
|
||||
export interface LoginLinkResponse {
|
||||
url: string;
|
||||
type: 'login_link' | 'account_link';
|
||||
expires_at?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a dashboard link for the Connect account.
|
||||
* For Express accounts: Returns a one-time login link.
|
||||
* For Custom accounts: Returns an account link (requires return/refresh URLs).
|
||||
*/
|
||||
export const createConnectLoginLink = (request?: LoginLinkRequest) =>
|
||||
apiClient.post<LoginLinkResponse>('/payments/connect/login-link/', request || {});
|
||||
|
||||
Reference in New Issue
Block a user