@skillrecordings/sdk 0.3.0 → 0.5.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/dist/types.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { z } from 'zod';
2
+
1
3
  /**
2
4
  * User entity returned by app integration.
3
5
  * Replaces Customer for consistency with SupportIntegration interface.
@@ -138,5 +140,355 @@ interface ContentSearchResponse {
138
140
  searchTimeMs?: number;
139
141
  };
140
142
  }
143
+ /**
144
+ * Product type for availability checking.
145
+ * Self-paced is always available, live/cohort have limited seats.
146
+ */
147
+ type ProductType = 'self-paced' | 'live' | 'cohort' | 'membership' | 'source-code-access' | (string & {});
148
+ /**
149
+ * Product state lifecycle.
150
+ */
151
+ type ProductState = 'draft' | 'active' | 'unavailable' | 'archived';
152
+ /**
153
+ * Active promotion or sale for a product.
154
+ * Used by agent to answer presales questions about current discounts.
155
+ */
156
+ interface Promotion {
157
+ id: string;
158
+ name: string;
159
+ /** Coupon code if applicable */
160
+ code?: string;
161
+ discountType: 'percent' | 'fixed';
162
+ /** Percentage (0-100) or fixed amount in cents */
163
+ discountAmount: number;
164
+ /** ISO date — when the promotion starts */
165
+ validFrom?: string;
166
+ /** ISO date — when the promotion ends */
167
+ validUntil?: string;
168
+ active: boolean;
169
+ /** Human-readable conditions (e.g., "PPP — purchasing power parity") */
170
+ conditions?: string;
171
+ }
172
+ /**
173
+ * Coupon/discount code details.
174
+ * Used by agent to validate coupon codes customers ask about.
175
+ */
176
+ interface CouponInfo {
177
+ code: string;
178
+ valid: boolean;
179
+ discountType: 'percent' | 'fixed';
180
+ /** Percentage (0-100) or fixed amount in cents */
181
+ discountAmount: number;
182
+ /** Restriction category for the coupon */
183
+ restrictionType?: 'ppp' | 'student' | 'bulk' | 'general';
184
+ usageCount: number;
185
+ maxUses?: number;
186
+ /** ISO date — when the coupon expires */
187
+ expiresAt?: string;
188
+ }
189
+ /**
190
+ * App-specific refund policy configuration.
191
+ * Used by agent to give accurate refund window information
192
+ * instead of hardcoded defaults.
193
+ */
194
+ interface RefundPolicy {
195
+ /** Days within which refunds are auto-approved */
196
+ autoApproveWindowDays: number;
197
+ /** Days within which refunds can be manually approved */
198
+ manualApproveWindowDays: number;
199
+ /** Days after which no refund is possible */
200
+ noRefundAfterDays?: number;
201
+ /** Special conditions (e.g., "Lifetime access: 60 day window") */
202
+ specialConditions?: string[];
203
+ /** URL to the full refund policy page */
204
+ policyUrl?: string;
205
+ }
206
+ /**
207
+ * Granular content access information for a user.
208
+ * Used by agent to debug access issues — goes beyond just "has a purchase".
209
+ */
210
+ interface ContentAccess {
211
+ userId: string;
212
+ products: Array<{
213
+ productId: string;
214
+ productName: string;
215
+ accessLevel: 'full' | 'partial' | 'preview' | 'expired';
216
+ modules?: Array<{
217
+ id: string;
218
+ title: string;
219
+ accessible: boolean;
220
+ }>;
221
+ /** ISO date — when access expires (null = lifetime) */
222
+ expiresAt?: string;
223
+ }>;
224
+ /** Team membership info if user is part of a team */
225
+ teamMembership?: {
226
+ teamId: string;
227
+ teamName: string;
228
+ role: 'member' | 'admin' | 'owner';
229
+ /** ISO date — when the seat was claimed */
230
+ seatClaimedAt: string;
231
+ };
232
+ }
233
+ /**
234
+ * Recent user activity and progress data.
235
+ * Used by agent to debug access issues and assess product usage.
236
+ */
237
+ interface UserActivity {
238
+ userId: string;
239
+ /** ISO date — last login timestamp */
240
+ lastLoginAt?: string;
241
+ /** ISO date — last meaningful activity */
242
+ lastActiveAt?: string;
243
+ lessonsCompleted: number;
244
+ totalLessons: number;
245
+ /** 0-100 completion percentage */
246
+ completionPercent: number;
247
+ recentItems: Array<{
248
+ type: 'lesson_completed' | 'exercise_submitted' | 'login' | 'download';
249
+ title: string;
250
+ /** ISO date */
251
+ timestamp: string;
252
+ }>;
253
+ }
254
+ /**
255
+ * Team license and seat management information.
256
+ * Used by agent to answer team/enterprise questions about seat allocation.
257
+ */
258
+ interface LicenseInfo {
259
+ purchaseId: string;
260
+ licenseType: 'individual' | 'team' | 'enterprise' | 'site';
261
+ totalSeats: number;
262
+ claimedSeats: number;
263
+ availableSeats: number;
264
+ /** ISO date — when the license expires */
265
+ expiresAt?: string;
266
+ claimedBy: Array<{
267
+ email: string;
268
+ /** ISO date */
269
+ claimedAt: string;
270
+ /** ISO date */
271
+ lastActiveAt?: string;
272
+ }>;
273
+ /** Email of the license administrator */
274
+ adminEmail?: string;
275
+ }
276
+ /**
277
+ * App metadata for multi-app support.
278
+ * Eliminates hardcoded URLs and product names in agent prompts.
279
+ */
280
+ interface AppInfo {
281
+ name: string;
282
+ instructorName: string;
283
+ supportEmail: string;
284
+ websiteUrl: string;
285
+ invoicesUrl?: string;
286
+ discordUrl?: string;
287
+ refundPolicyUrl?: string;
288
+ privacyPolicyUrl?: string;
289
+ termsUrl?: string;
290
+ }
291
+ /**
292
+ * Zod schema for ProductType validation
293
+ */
294
+ declare const ProductTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"self-paced">, z.ZodLiteral<"live">, z.ZodLiteral<"cohort">, z.ZodLiteral<"membership">, z.ZodLiteral<"source-code-access">, z.ZodString]>;
295
+ /**
296
+ * Zod schema for ProductState validation
297
+ */
298
+ declare const ProductStateSchema: z.ZodEnum<{
299
+ active: "active";
300
+ draft: "draft";
301
+ unavailable: "unavailable";
302
+ archived: "archived";
303
+ }>;
304
+ /**
305
+ * Zod schema for ProductStatus validation
306
+ */
307
+ declare const ProductStatusSchema: z.ZodObject<{
308
+ productId: z.ZodString;
309
+ productType: z.ZodUnion<readonly [z.ZodLiteral<"self-paced">, z.ZodLiteral<"live">, z.ZodLiteral<"cohort">, z.ZodLiteral<"membership">, z.ZodLiteral<"source-code-access">, z.ZodString]>;
310
+ available: z.ZodBoolean;
311
+ soldOut: z.ZodBoolean;
312
+ quantityAvailable: z.ZodNumber;
313
+ quantityRemaining: z.ZodNumber;
314
+ state: z.ZodEnum<{
315
+ active: "active";
316
+ draft: "draft";
317
+ unavailable: "unavailable";
318
+ archived: "archived";
319
+ }>;
320
+ startsAt: z.ZodOptional<z.ZodString>;
321
+ endsAt: z.ZodOptional<z.ZodString>;
322
+ enrollmentOpen: z.ZodOptional<z.ZodString>;
323
+ enrollmentClose: z.ZodOptional<z.ZodString>;
324
+ }, z.core.$strip>;
325
+ /**
326
+ * Zod schema for Promotion validation
327
+ */
328
+ declare const PromotionSchema: z.ZodObject<{
329
+ id: z.ZodString;
330
+ name: z.ZodString;
331
+ code: z.ZodOptional<z.ZodString>;
332
+ discountType: z.ZodEnum<{
333
+ percent: "percent";
334
+ fixed: "fixed";
335
+ }>;
336
+ discountAmount: z.ZodNumber;
337
+ validFrom: z.ZodOptional<z.ZodString>;
338
+ validUntil: z.ZodOptional<z.ZodString>;
339
+ active: z.ZodBoolean;
340
+ conditions: z.ZodOptional<z.ZodString>;
341
+ }, z.core.$strip>;
342
+ /**
343
+ * Zod schema for CouponInfo validation
344
+ */
345
+ declare const CouponInfoSchema: z.ZodObject<{
346
+ code: z.ZodString;
347
+ valid: z.ZodBoolean;
348
+ discountType: z.ZodEnum<{
349
+ percent: "percent";
350
+ fixed: "fixed";
351
+ }>;
352
+ discountAmount: z.ZodNumber;
353
+ restrictionType: z.ZodOptional<z.ZodEnum<{
354
+ ppp: "ppp";
355
+ student: "student";
356
+ bulk: "bulk";
357
+ general: "general";
358
+ }>>;
359
+ usageCount: z.ZodNumber;
360
+ maxUses: z.ZodOptional<z.ZodNumber>;
361
+ expiresAt: z.ZodOptional<z.ZodString>;
362
+ }, z.core.$strip>;
363
+ /**
364
+ * Zod schema for RefundPolicy validation
365
+ */
366
+ declare const RefundPolicySchema: z.ZodObject<{
367
+ autoApproveWindowDays: z.ZodNumber;
368
+ manualApproveWindowDays: z.ZodNumber;
369
+ noRefundAfterDays: z.ZodOptional<z.ZodNumber>;
370
+ specialConditions: z.ZodOptional<z.ZodArray<z.ZodString>>;
371
+ policyUrl: z.ZodOptional<z.ZodString>;
372
+ }, z.core.$strip>;
373
+ /**
374
+ * Zod schema for ContentAccess validation
375
+ */
376
+ declare const ContentAccessSchema: z.ZodObject<{
377
+ userId: z.ZodString;
378
+ products: z.ZodArray<z.ZodObject<{
379
+ productId: z.ZodString;
380
+ productName: z.ZodString;
381
+ accessLevel: z.ZodEnum<{
382
+ expired: "expired";
383
+ preview: "preview";
384
+ full: "full";
385
+ partial: "partial";
386
+ }>;
387
+ modules: z.ZodOptional<z.ZodArray<z.ZodObject<{
388
+ id: z.ZodString;
389
+ title: z.ZodString;
390
+ accessible: z.ZodBoolean;
391
+ }, z.core.$strip>>>;
392
+ expiresAt: z.ZodOptional<z.ZodString>;
393
+ }, z.core.$strip>>;
394
+ teamMembership: z.ZodOptional<z.ZodObject<{
395
+ teamId: z.ZodString;
396
+ teamName: z.ZodString;
397
+ role: z.ZodEnum<{
398
+ member: "member";
399
+ admin: "admin";
400
+ owner: "owner";
401
+ }>;
402
+ seatClaimedAt: z.ZodString;
403
+ }, z.core.$strip>>;
404
+ }, z.core.$strip>;
405
+ /**
406
+ * Zod schema for UserActivity validation
407
+ */
408
+ declare const UserActivitySchema: z.ZodObject<{
409
+ userId: z.ZodString;
410
+ lastLoginAt: z.ZodOptional<z.ZodString>;
411
+ lastActiveAt: z.ZodOptional<z.ZodString>;
412
+ lessonsCompleted: z.ZodNumber;
413
+ totalLessons: z.ZodNumber;
414
+ completionPercent: z.ZodNumber;
415
+ recentItems: z.ZodArray<z.ZodObject<{
416
+ type: z.ZodEnum<{
417
+ lesson_completed: "lesson_completed";
418
+ exercise_submitted: "exercise_submitted";
419
+ login: "login";
420
+ download: "download";
421
+ }>;
422
+ title: z.ZodString;
423
+ timestamp: z.ZodString;
424
+ }, z.core.$strip>>;
425
+ }, z.core.$strip>;
426
+ /**
427
+ * Zod schema for LicenseInfo validation
428
+ */
429
+ declare const LicenseInfoSchema: z.ZodObject<{
430
+ purchaseId: z.ZodString;
431
+ licenseType: z.ZodEnum<{
432
+ individual: "individual";
433
+ team: "team";
434
+ enterprise: "enterprise";
435
+ site: "site";
436
+ }>;
437
+ totalSeats: z.ZodNumber;
438
+ claimedSeats: z.ZodNumber;
439
+ availableSeats: z.ZodNumber;
440
+ expiresAt: z.ZodOptional<z.ZodString>;
441
+ claimedBy: z.ZodArray<z.ZodObject<{
442
+ email: z.ZodString;
443
+ claimedAt: z.ZodString;
444
+ lastActiveAt: z.ZodOptional<z.ZodString>;
445
+ }, z.core.$strip>>;
446
+ adminEmail: z.ZodOptional<z.ZodString>;
447
+ }, z.core.$strip>;
448
+ /**
449
+ * Zod schema for AppInfo validation
450
+ */
451
+ declare const AppInfoSchema: z.ZodObject<{
452
+ name: z.ZodString;
453
+ instructorName: z.ZodString;
454
+ supportEmail: z.ZodString;
455
+ websiteUrl: z.ZodString;
456
+ invoicesUrl: z.ZodOptional<z.ZodString>;
457
+ discordUrl: z.ZodOptional<z.ZodString>;
458
+ refundPolicyUrl: z.ZodOptional<z.ZodString>;
459
+ privacyPolicyUrl: z.ZodOptional<z.ZodString>;
460
+ termsUrl: z.ZodOptional<z.ZodString>;
461
+ }, z.core.$strip>;
462
+ /**
463
+ * Product availability/inventory status.
464
+ * Used by agent to accurately report whether products can be purchased.
465
+ *
466
+ * For live events/cohorts: check soldOut and quantityRemaining
467
+ * For self-paced: typically available=true, quantityAvailable=-1 (unlimited)
468
+ */
469
+ interface ProductStatus {
470
+ /** Product identifier */
471
+ productId: string;
472
+ /** Type of product determines availability semantics */
473
+ productType: ProductType;
474
+ /** Whether the product can currently be purchased */
475
+ available: boolean;
476
+ /** Whether all seats/inventory are sold */
477
+ soldOut: boolean;
478
+ /** Total quantity available for sale (-1 = unlimited) */
479
+ quantityAvailable: number;
480
+ /** Remaining quantity not yet sold */
481
+ quantityRemaining: number;
482
+ /** Product lifecycle state */
483
+ state: ProductState;
484
+ /** For live events: when the event starts */
485
+ startsAt?: string;
486
+ /** For live events: when the event ends */
487
+ endsAt?: string;
488
+ /** For cohorts: when enrollment opens */
489
+ enrollmentOpen?: string;
490
+ /** For cohorts: when enrollment closes */
491
+ enrollmentClose?: string;
492
+ }
141
493
 
142
- export type { ActionResult, ClaimedSeat, ContentSearchRequest, ContentSearchResponse, ContentSearchResult, Customer, Purchase, RefundRequest, RefundResult, Subscription, User };
494
+ export { type ActionResult, type AppInfo, AppInfoSchema, type ClaimedSeat, type ContentAccess, ContentAccessSchema, type ContentSearchRequest, type ContentSearchResponse, type ContentSearchResult, type CouponInfo, CouponInfoSchema, type Customer, type LicenseInfo, LicenseInfoSchema, type ProductState, ProductStateSchema, type ProductStatus, ProductStatusSchema, type ProductType, ProductTypeSchema, type Promotion, PromotionSchema, type Purchase, type RefundPolicy, RefundPolicySchema, type RefundRequest, type RefundResult, type Subscription, type User, type UserActivity, UserActivitySchema };