🎥 Make videos programmatically with React
Update for licensing/getUsage()
Pramod09f44e2e46cc
diff --git a/packages/docs/docs/licensing/get-usage.mdx b/packages/docs/docs/licensing/get-usage.mdxindex ede95af265..e359b98e0d 100644--- a/packages/docs/docs/licensing/get-usage.mdx+++ b/packages/docs/docs/licensing/get-usage.mdx@@ -40,11 +40,11 @@ console.log(usage);An object with the following properties:-### `apiKey`+### `licenseKey`Type: `string`-Your Remotion secret API key. You can get it from your Remotion.pro dashboard.+Your Remotion license key. You can get it from your Remotion.pro dashboard.### `since`@@ -54,6 +54,14 @@ The timestamp since when you want to get the usage.The default is since the beginning of the current month in UTC.The lowest timestamp you can use is 90 days ago (`Date.now() - 90 * 24 * 60 * 60 * 1000`).+### ~~`apiKey`~~++_deprecated in v4.0.407_++Type: `string`++Your Remotion secret API key. You can get it from your Remotion.pro dashboard.+## Return valueAn object with the following properties:diff --git a/packages/licensing/src/get-usage.ts b/packages/licensing/src/get-usage.tsindex 7f6ed09471..d720d3dfc4 100644--- a/packages/licensing/src/get-usage.ts+++ b/packages/licensing/src/get-usage.ts@@ -1,3 +1,4 @@+import type {EitherApiKeyOrLicenseKey} from './register-usage-event';import {HOST} from './register-usage-event';export type EventCount = {@@ -23,16 +24,19 @@ export type GetUsageResponse = {};export const getUsage = async ({- apiKey,since,+ ...apiOrLicenseKey}: {- apiKey: string;since?: number | null;-}): Promise<GetUsageResponse> => {+} & EitherApiKeyOrLicenseKey): Promise<GetUsageResponse> => {+ const apiKey = 'apiKey' in apiOrLicenseKey ? apiOrLicenseKey.apiKey : null;+ const licenseKey =+ 'licenseKey' in apiOrLicenseKey ? apiOrLicenseKey.licenseKey : null;+const res = await fetch(`${HOST}/api/track/get-usage`, {method: 'POST',body: JSON.stringify({- apiKey,+ apiKey: licenseKey ?? apiKey,since: since ?? null,}),headers: {diff --git a/packages/licensing/src/register-usage-event.ts b/packages/licensing/src/register-usage-event.tsindex 2f3d83dbce..e6a4681aaa 100644--- a/packages/licensing/src/register-usage-event.ts+++ b/packages/licensing/src/register-usage-event.ts@@ -34,7 +34,7 @@ type UsageEventType = 'webcodec-conversion' | 'cloud-render';export type UsageEventClassification = 'billable' | 'development' | 'failed';-type EitherApiKeyOrLicenseKey =+export type EitherApiKeyOrLicenseKey =true extends typeof NoReactInternals.ENABLE_V5_BREAKING_CHANGES? {licenseKey: string | null;