MCPcopy Index your code
hub / github.com/CapSoftware/Cap / createLicenseQuery

Function createLicenseQuery

apps/desktop/src/utils/queries.ts:242–271  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

240}
241
242export function createLicenseQuery() {
243 const query = createQuery(() => ({
244 queryKey: ["licenseQuery"],
245 queryFn: async () => {
246 const settings = await generalSettingsStore.get();
247 const auth = await authStore.get();
248
249 if (auth?.plan?.upgraded) return { type: "pro" as const, ...auth.plan };
250 if (settings?.commercialLicense)
251 return {
252 type: "commercial" as const,
253 ...settings.commercialLicense,
254 instanceId: settings.instanceId,
255 };
256 return { type: "personal" as const };
257 },
258 }));
259
260 const generalSettingsCleanup = generalSettingsStore.listen(() =>
261 query.refetch(),
262 );
263 const authCleanup = authStore.listen(() => query.refetch());
264
265 onCleanup(() => {
266 generalSettingsCleanup.then((cleanup) => cleanup());
267 authCleanup.then((cleanup) => cleanup());
268 });
269
270 return query;
271}
272
273export function createCameraMutation() {
274 const { setOptions, rawOptions } = useRecordingOptions();

Callers 3

PageFunction · 0.90
PageFunction · 0.90
PageFunction · 0.90

Calls 1

cleanupFunction · 0.70

Tested by

no test coverage detected