@fayz-ai/courses 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{mock-provider.d.ts → data/mock-provider.d.ts} +1 -1
- package/dist/data/mock-provider.d.ts.map +1 -0
- package/dist/{provider.d.ts → data/provider.d.ts} +1 -1
- package/dist/data/provider.d.ts.map +1 -0
- package/dist/data/safe-provider.d.ts.map +1 -0
- package/dist/{seed.d.ts → data/seed.d.ts} +1 -1
- package/dist/data/seed.d.ts.map +1 -0
- package/dist/data/supabase-provider.d.ts.map +1 -0
- package/dist/data/tables.d.ts.map +1 -0
- package/dist/data/tenant.d.ts.map +1 -0
- package/dist/{hooks.d.ts → hooks/index.d.ts} +2 -2
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
- package/dist/hooks.d.ts.map +0 -1
- package/dist/mock-provider.d.ts.map +0 -1
- package/dist/provider.d.ts.map +0 -1
- package/dist/safe-provider.d.ts.map +0 -1
- package/dist/seed.d.ts.map +0 -1
- package/dist/supabase-provider.d.ts.map +0 -1
- package/dist/tables.d.ts.map +0 -1
- package/dist/tenant.d.ts.map +0 -1
- package/src/hooks.ts +0 -125
- package/src/index.ts +0 -33
- package/src/mock-provider.ts +0 -369
- package/src/provider.ts +0 -85
- package/src/safe-provider.ts +0 -17
- package/src/seed.ts +0 -297
- package/src/supabase-provider.ts +0 -425
- package/src/tables.ts +0 -18
- package/src/tenant.ts +0 -21
- package/src/types.ts +0 -268
- /package/dist/{safe-provider.d.ts → data/safe-provider.d.ts} +0 -0
- /package/dist/{supabase-provider.d.ts → data/supabase-provider.d.ts} +0 -0
- /package/dist/{tables.d.ts → data/tables.d.ts} +0 -0
- /package/dist/{tenant.d.ts → data/tenant.d.ts} +0 -0
package/src/types.ts
DELETED
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
// ---------------------------------------------------------------------------
|
|
2
|
-
// Courses domain — the education counterpart of @fayz-ai/shop. A Course is the
|
|
3
|
-
// sellable unit; Modules group Lessons; a Lesson carries a video (embed URL in
|
|
4
|
-
// this mock layer). Enrollment = a customer owns a course; Progress tracks
|
|
5
|
-
// per-lesson completion.
|
|
6
|
-
// ---------------------------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
export type CourseStatus = 'draft' | 'published' | 'archived'
|
|
9
|
-
|
|
10
|
-
/** How the course is delivered — drives scheduling/logistics and the storefront copy. */
|
|
11
|
-
export type CourseDeliveryType = 'online' | 'in_person' | 'hybrid'
|
|
12
|
-
|
|
13
|
-
export interface Course {
|
|
14
|
-
id: string
|
|
15
|
-
slug: string
|
|
16
|
-
title: string
|
|
17
|
-
subtitle: string | null
|
|
18
|
-
description: string | null
|
|
19
|
-
thumbnailUrl: string | null
|
|
20
|
-
price: number
|
|
21
|
-
currency: string
|
|
22
|
-
status: CourseStatus
|
|
23
|
-
/** online (default), presencial, or híbrido. */
|
|
24
|
-
deliveryType: CourseDeliveryType
|
|
25
|
-
sortOrder: number
|
|
26
|
-
createdAt: string
|
|
27
|
-
updatedAt: string
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface Module {
|
|
31
|
-
id: string
|
|
32
|
-
courseId: string
|
|
33
|
-
title: string
|
|
34
|
-
sortOrder: number
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface Lesson {
|
|
38
|
-
id: string
|
|
39
|
-
courseId: string
|
|
40
|
-
moduleId: string
|
|
41
|
-
title: string
|
|
42
|
-
description: string | null
|
|
43
|
-
/** Embed URL (YouTube/Vimeo) in the mock layer; a storage URL with a real backend. */
|
|
44
|
-
videoUrl: string
|
|
45
|
-
durationSec: number
|
|
46
|
-
sortOrder: number
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface Enrollment {
|
|
50
|
-
id: string
|
|
51
|
-
courseId: string
|
|
52
|
-
customerId: string
|
|
53
|
-
status: 'active' | 'refunded'
|
|
54
|
-
enrolledAt: string
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface Progress {
|
|
58
|
-
id: string
|
|
59
|
-
enrollmentId: string
|
|
60
|
-
lessonId: string
|
|
61
|
-
completed: boolean
|
|
62
|
-
lastPositionSec: number
|
|
63
|
-
completedAt: string | null
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Inputs -------------------------------------------------------------------
|
|
67
|
-
|
|
68
|
-
export interface CreateCourseInput {
|
|
69
|
-
title: string
|
|
70
|
-
slug?: string
|
|
71
|
-
subtitle?: string
|
|
72
|
-
description?: string
|
|
73
|
-
thumbnailUrl?: string
|
|
74
|
-
price?: number
|
|
75
|
-
currency?: string
|
|
76
|
-
status?: CourseStatus
|
|
77
|
-
deliveryType?: CourseDeliveryType
|
|
78
|
-
sortOrder?: number
|
|
79
|
-
}
|
|
80
|
-
export type UpdateCourseInput = Partial<CreateCourseInput>
|
|
81
|
-
|
|
82
|
-
export interface CreateModuleInput {
|
|
83
|
-
courseId: string
|
|
84
|
-
title: string
|
|
85
|
-
sortOrder?: number
|
|
86
|
-
}
|
|
87
|
-
export type UpdateModuleInput = Partial<Omit<CreateModuleInput, 'courseId'>>
|
|
88
|
-
|
|
89
|
-
export interface CreateLessonInput {
|
|
90
|
-
courseId: string
|
|
91
|
-
moduleId: string
|
|
92
|
-
title: string
|
|
93
|
-
description?: string
|
|
94
|
-
videoUrl: string
|
|
95
|
-
durationSec?: number
|
|
96
|
-
sortOrder?: number
|
|
97
|
-
}
|
|
98
|
-
export type UpdateLessonInput = Partial<Omit<CreateLessonInput, 'courseId' | 'moduleId'>>
|
|
99
|
-
|
|
100
|
-
export interface ListCoursesOptions {
|
|
101
|
-
status?: CourseStatus
|
|
102
|
-
slug?: string
|
|
103
|
-
search?: string
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** A course plus the customer's enrollment + progress %, for "my courses". */
|
|
107
|
-
export interface EnrolledCourse {
|
|
108
|
-
course: Course
|
|
109
|
-
enrollment: Enrollment
|
|
110
|
-
totalLessons: number
|
|
111
|
-
completedLessons: number
|
|
112
|
-
/** 0..100 */
|
|
113
|
-
progressPercent: number
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// ---------------------------------------------------------------------------
|
|
117
|
-
// Commerce layer — the "mini-Kiwify" money model. A Course is the product; an
|
|
118
|
-
// Offer is a sellable price point (one-time or recurring). An Order is a
|
|
119
|
-
// concluded sale; a Subscription is a recurring plan. CreatorAccount holds the
|
|
120
|
-
// Stripe Connect link + the platform markup. All of these are tenant-scoped in
|
|
121
|
-
// the real backend (the creator that owns the course).
|
|
122
|
-
// ---------------------------------------------------------------------------
|
|
123
|
-
|
|
124
|
-
export type OfferKind = 'one_time' | 'subscription'
|
|
125
|
-
export type RecurringInterval = 'month' | 'year'
|
|
126
|
-
|
|
127
|
-
export interface Offer {
|
|
128
|
-
id: string
|
|
129
|
-
courseId: string
|
|
130
|
-
name: string
|
|
131
|
-
price: number
|
|
132
|
-
currency: string
|
|
133
|
-
kind: OfferKind
|
|
134
|
-
/** Set when kind === 'subscription'; null for one-time offers. */
|
|
135
|
-
recurringInterval: RecurringInterval | null
|
|
136
|
-
/** The offer pre-selected on the checkout (Kiwify's "default offer"). */
|
|
137
|
-
isDefault: boolean
|
|
138
|
-
/** Shown as an order-bump on another offer's checkout. */
|
|
139
|
-
isOrderBump: boolean
|
|
140
|
-
sortOrder: number
|
|
141
|
-
}
|
|
142
|
-
export interface CreateOfferInput {
|
|
143
|
-
courseId: string
|
|
144
|
-
name: string
|
|
145
|
-
price: number
|
|
146
|
-
currency?: string
|
|
147
|
-
kind?: OfferKind
|
|
148
|
-
recurringInterval?: RecurringInterval | null
|
|
149
|
-
isDefault?: boolean
|
|
150
|
-
isOrderBump?: boolean
|
|
151
|
-
sortOrder?: number
|
|
152
|
-
}
|
|
153
|
-
export type UpdateOfferInput = Partial<Omit<CreateOfferInput, 'courseId'>>
|
|
154
|
-
|
|
155
|
-
export type PaymentMethod = 'card' | 'pix' | 'boleto'
|
|
156
|
-
export type FinancialStatus = 'pending' | 'paid' | 'refunded' | 'chargeback'
|
|
157
|
-
|
|
158
|
-
/** A concluded (or pending) sale — the Sales ledger row. */
|
|
159
|
-
export interface Order {
|
|
160
|
-
id: string
|
|
161
|
-
courseId: string
|
|
162
|
-
offerId: string | null
|
|
163
|
-
customerId: string | null
|
|
164
|
-
customerName: string | null
|
|
165
|
-
customerEmail: string | null
|
|
166
|
-
currency: string
|
|
167
|
-
/** Gross amount charged to the student. */
|
|
168
|
-
total: number
|
|
169
|
-
/** The platform's markup on this sale (Stripe application_fee). */
|
|
170
|
-
platformFee: number
|
|
171
|
-
/** total - platformFee — what the creator receives. */
|
|
172
|
-
netValue: number
|
|
173
|
-
paymentMethod: PaymentMethod | null
|
|
174
|
-
financialStatus: FinancialStatus
|
|
175
|
-
stripePaymentIntentId: string | null
|
|
176
|
-
createdAt: string
|
|
177
|
-
/** Number of installments (parcelas), from the receivable. Defaults to 1. */
|
|
178
|
-
installmentCount?: number
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/** One installment (bill) of an order's receivable, with its settlement. */
|
|
182
|
-
export interface OrderInstallment {
|
|
183
|
-
installmentNumber: number
|
|
184
|
-
amount: number
|
|
185
|
-
paidAmount: number
|
|
186
|
-
status: string
|
|
187
|
-
dueDate: string | null
|
|
188
|
-
paymentDate: string | null
|
|
189
|
-
cardBrand: string | null
|
|
190
|
-
cardInstallments: number | null
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/** Full order for the detail page — order + course/offer + receivable schedule. */
|
|
194
|
-
export interface OrderDetail extends Order {
|
|
195
|
-
courseTitle: string | null
|
|
196
|
-
offerName: string | null
|
|
197
|
-
paidAmount: number
|
|
198
|
-
balance: number
|
|
199
|
-
installments: OrderInstallment[]
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export type SubscriptionStatus = 'active' | 'canceled' | 'past_due'
|
|
203
|
-
|
|
204
|
-
export interface Subscription {
|
|
205
|
-
id: string
|
|
206
|
-
courseId: string
|
|
207
|
-
offerId: string | null
|
|
208
|
-
customerId: string | null
|
|
209
|
-
customerName: string | null
|
|
210
|
-
customerEmail: string | null
|
|
211
|
-
currency: string
|
|
212
|
-
/** Per-period net value to the creator. */
|
|
213
|
-
netValue: number
|
|
214
|
-
interval: RecurringInterval
|
|
215
|
-
status: SubscriptionStatus
|
|
216
|
-
stripeSubscriptionId: string | null
|
|
217
|
-
startedAt: string
|
|
218
|
-
canceledAt: string | null
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export type PayoutStatus = 'pending' | 'paid' | 'failed'
|
|
222
|
-
|
|
223
|
-
export interface Payout {
|
|
224
|
-
id: string
|
|
225
|
-
amount: number
|
|
226
|
-
currency: string
|
|
227
|
-
status: PayoutStatus
|
|
228
|
-
createdAt: string
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/** The creator's Stripe Connect account + platform markup config (1:1 tenant). */
|
|
232
|
-
export interface CreatorAccount {
|
|
233
|
-
tenantId: string
|
|
234
|
-
stripeAccountId: string | null
|
|
235
|
-
chargesEnabled: boolean
|
|
236
|
-
payoutsEnabled: boolean
|
|
237
|
-
defaultCurrency: string
|
|
238
|
-
/** Platform markup in basis points (e.g. 500 = 5%). Drives Order.platformFee. */
|
|
239
|
-
platformFeeBps: number
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/** Aggregates for the Financial page + dashboard KPIs. */
|
|
243
|
-
export interface FinancialSummary {
|
|
244
|
-
currency: string
|
|
245
|
-
availableBalance: number
|
|
246
|
-
pendingBalance: number
|
|
247
|
-
/** Sum of paid orders' total. */
|
|
248
|
-
totalRevenue: number
|
|
249
|
-
platformFeeTotal: number
|
|
250
|
-
salesCount: number
|
|
251
|
-
activeSubscriptions: number
|
|
252
|
-
/** Monthly recurring revenue (net). */
|
|
253
|
-
mrr: number
|
|
254
|
-
/** 0..1 */
|
|
255
|
-
refundRate: number
|
|
256
|
-
/** 0..1 (placeholder in the mock layer). */
|
|
257
|
-
conversionRate: number
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export interface ListOrdersOptions {
|
|
261
|
-
courseId?: string
|
|
262
|
-
financialStatus?: FinancialStatus
|
|
263
|
-
search?: string
|
|
264
|
-
}
|
|
265
|
-
export interface ListSubscriptionsOptions {
|
|
266
|
-
courseId?: string
|
|
267
|
-
status?: SubscriptionStatus
|
|
268
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|