({
loomUrl,
orgId,
}: {
loomUrl: string;
orgId: Organisation.OrganisationId;
})
| 452 | } |
| 453 | |
| 454 | export async function importFromLoom({ |
| 455 | loomUrl, |
| 456 | orgId, |
| 457 | }: { |
| 458 | loomUrl: string; |
| 459 | orgId: Organisation.OrganisationId; |
| 460 | }): Promise<LoomImportResult> { |
| 461 | const user = await getCurrentUser(); |
| 462 | if (!user) return { success: false, error: "Unauthorized" }; |
| 463 | |
| 464 | if (!userIsPro(user)) { |
| 465 | return { |
| 466 | success: false, |
| 467 | error: "Importing from Loom requires a Cap Pro subscription.", |
| 468 | }; |
| 469 | } |
| 470 | |
| 471 | await requireOrganizationAccess(user.id, orgId); |
| 472 | |
| 473 | const isRateLimited = await createLoomImportRateLimitCheck(user.id); |
| 474 | if (await isRateLimited()) { |
| 475 | return { |
| 476 | success: false, |
| 477 | error: LOOM_IMPORT_RATE_LIMIT_ERROR, |
| 478 | }; |
| 479 | } |
| 480 | |
| 481 | return importLoomVideoForOwner({ |
| 482 | loomUrl, |
| 483 | orgId, |
| 484 | ownerId: user.id, |
| 485 | }); |
| 486 | } |
| 487 | |
| 488 | function normalizeImportEmail(email: string) { |
| 489 | return email.trim().toLowerCase(); |
no test coverage detected