Update remote soul-content with local content
This commit is contained in:
37
lib/modules/marketing/types.ts
Normal file
37
lib/modules/marketing/types.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
export type CampaignType = 'popup' | 'banner' | 'modal' | 'toast';
|
||||
|
||||
export interface Campaign {
|
||||
id: string;
|
||||
name: string;
|
||||
type: CampaignType;
|
||||
isActive: boolean;
|
||||
rules: CampaignRule[];
|
||||
content: CampaignContent;
|
||||
startDate?: Date;
|
||||
endDate?: Date;
|
||||
}
|
||||
|
||||
export interface CampaignRule {
|
||||
type: 'time_on_page' | 'scroll_depth' | 'exit_intent' | 'user_segment';
|
||||
value: number | string; // e.g., 30 (seconds), 50 (percent)
|
||||
}
|
||||
|
||||
export interface CampaignContent {
|
||||
title?: string;
|
||||
body?: string;
|
||||
imageUrl?: string;
|
||||
ctaText?: string;
|
||||
ctaUrl?: string;
|
||||
}
|
||||
|
||||
export interface MarketingService {
|
||||
getActiveCampaigns(context: UserContext): Promise<Campaign[]>;
|
||||
trackImpression(campaignId: string): void;
|
||||
trackClick(campaignId: string): void;
|
||||
}
|
||||
|
||||
export interface UserContext {
|
||||
userId?: string;
|
||||
pageUrl: string;
|
||||
device: 'mobile' | 'desktop';
|
||||
}
|
||||
26
lib/modules/payment/types.ts
Normal file
26
lib/modules/payment/types.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
export type PaymentStatus = 'pending' | 'success' | 'failed' | 'refunded';
|
||||
|
||||
export interface Order {
|
||||
id: string;
|
||||
userId: string;
|
||||
amount: number;
|
||||
currency: string;
|
||||
status: PaymentStatus;
|
||||
items: OrderItem[];
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export interface OrderItem {
|
||||
id: string;
|
||||
productId: string;
|
||||
productType: 'section' | 'full_book' | 'membership';
|
||||
quantity: number;
|
||||
price: number;
|
||||
}
|
||||
|
||||
export interface PaymentProvider {
|
||||
name: string;
|
||||
createOrder(order: Order): Promise<{ payUrl: string; orderId: string }>;
|
||||
checkStatus(orderId: string): Promise<PaymentStatus>;
|
||||
}
|
||||
32
lib/modules/referral/types.ts
Normal file
32
lib/modules/referral/types.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
export interface ReferralCode {
|
||||
code: string;
|
||||
ownerId: string;
|
||||
createdAt: Date;
|
||||
campaignId?: string;
|
||||
}
|
||||
|
||||
export interface ReferralStats {
|
||||
userId: string;
|
||||
totalClicks: number;
|
||||
totalConversions: number;
|
||||
totalEarnings: number;
|
||||
pendingEarnings: number;
|
||||
}
|
||||
|
||||
export interface ReferralRecord {
|
||||
id: string;
|
||||
referrerId: string;
|
||||
refereeId: string; // The new user
|
||||
action: 'register' | 'purchase';
|
||||
amount?: number; // Purchase amount if applicable
|
||||
commission: number;
|
||||
status: 'pending' | 'paid' | 'cancelled';
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export interface ReferralService {
|
||||
generateCode(userId: string): Promise<string>;
|
||||
trackVisit(code: string, visitorInfo: any): Promise<void>;
|
||||
recordConversion(code: string, action: 'register' | 'purchase', amount?: number): Promise<ReferralRecord>;
|
||||
getStats(userId: string): Promise<ReferralStats>;
|
||||
}
|
||||
Reference in New Issue
Block a user