zed.dev main
const zedApiToken
const zedApiUrl
type User
type AuthenticatedUser
type Panic
async function fetchUser()
type BillingSubscriptionStatus
interface BillingSubscription
async function listBillingSubscriptions (
async function initiateBillingCheckout()
type ManageSubscriptionIntent
function isManageSubscriptionIntent()
async function manageSubscription()
async function signCla( )
async function getClaSignatureDate()
async function getClaSignature DateByGitHul
type CreateAccessTokenResponse
async function createAccessToken()
interface GetExtensionsParams
async function getExtensions()
async function getExtension DownloadUrl()
async function request()
async function rawRequest()
Filter...
releases.ts analytics.ts collab.ts
src/lib/collab.ts
80 export async function initiateBillingCheckout(
81 githubUserId: number,
82 ): Promise<{ checkoutSessionUrl: string }> {
83 const response = await request("/billing/subscriptions", {
84 method: "POST",
85 body: {
86 github_user_id: githubUserId,
87 },
88 })
89 const checkoutSessionUrl = response ?. checkout_session_url
90 if (typeof checkoutSessionUrl = "string" || ! checkoutSessionUrl) {
91 throw new Error("Failed to initiate billing")
92 }
93 return { checkoutSessionUrl}
94 }
95 export type Manage SubscriptionIntent = "cancel" | "stop_cancellation"
96 export function isManageSubscriptionIntent(
97 value: unknown,
98 ): value is Manage SubscriptionIntent {
99 return value="cancel" || value "stop_cancellation"
100 }
1:1 TypeScript
Explanation
The image shows a code editor, most likely VS Code or similar IDE, with a TypeScript file open. The file 'collab.ts' is part of the 'src/lib' directory and contains functions related to billing and subscription management, including initiating a billing checkout process and handling subscription intents. On the left side, you can see some type definitions, such as 'User', 'AuthenticatedUser', and 'BillingSubscriptionStatus'.