Billing UI (Nightly & Dev only) and Jest component unit testing (#6640)

A bajillion commits hi

* all the shit i'll git reset origin/main && git add -p . later

* fmt

* wip

* fmt

* rebase; fmt; tsc; lint;

* fmt

* Add jest tests

* fmt

* ok

* add nightly checks

* More is_nightly checks

* be happy codespell

* Make vitest ignore my shit

* nightly OR debug; try vitest fixing again

* Add this back

* fix

* Update src/components/LowerRightControls.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/LowerRightControls.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/LowerRightControls.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/BillingDialog.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update tailwind.config.js

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update tailwind.config.js

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/BillingRemaining.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/BillingRemaining.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/CustomIcon.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/CustomIcon.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/CustomIcon.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/CustomIcon.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/BillingRemaining.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* Update src/components/BillingRemaining.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* fixes

* tid bits

* Fix tests

* color

* Update src/components/BillingRemaining.tsx

Co-authored-by: Frank Noirot <frank@zoo.dev>

* fix someone else's problem

---------

Co-authored-by: Frank Noirot <frank@zoo.dev>
This commit is contained in:
Zookeeper Lee
2025-05-06 15:07:22 -04:00
committed by GitHub
parent 7b0ea5078c
commit 8fb1563f2d
24 changed files with 4247 additions and 77 deletions

View File

@ -1,3 +1,5 @@
import { VITE_KC_API_BASE_URL } from '@src/env'
import EditorManager from '@src/editor/manager'
import { KclManager } from '@src/lang/KclSingleton'
import CodeManager from '@src/lang/codeManager'
@ -16,6 +18,10 @@ import { createActor, setup, assign } from 'xstate'
import { isDesktop } from '@src/lib/isDesktop'
import { createSettings } from '@src/lib/settings/initialSettings'
import { authMachine } from '@src/machines/authMachine'
import {
BILLING_CONTEXT_DEFAULTS,
billingMachine,
} from '@src/machines/billingMachine'
import {
engineStreamContextCreate,
engineStreamMachine,
@ -110,13 +116,15 @@ if (typeof window !== 'undefined') {
},
})
}
const { AUTH, SETTINGS, SYSTEM_IO, ENGINE_STREAM, COMMAND_BAR } = ACTOR_IDS
const { AUTH, SETTINGS, SYSTEM_IO, ENGINE_STREAM, COMMAND_BAR, BILLING } =
ACTOR_IDS
const appMachineActors = {
[AUTH]: authMachine,
[SETTINGS]: settingsMachine,
[SYSTEM_IO]: isDesktop() ? systemIOMachineDesktop : systemIOMachineWeb,
[ENGINE_STREAM]: engineStreamMachine,
[COMMAND_BAR]: commandBarMachine,
[BILLING]: billingMachine,
} as const
const appMachine = setup({
@ -169,6 +177,15 @@ const appMachine = setup({
commands: [],
},
}),
billingActor: ({ spawn }) =>
spawn(BILLING, {
id: BILLING,
systemId: BILLING,
input: {
...BILLING_CONTEXT_DEFAULTS,
urlUserService: VITE_KC_API_BASE_URL,
},
}),
}),
],
})
@ -213,6 +230,8 @@ export const engineStreamActor =
export const commandBarActor = appActor.getSnapshot().context.commandBarActor!
export const billingActor = appActor.system.get(BILLING)
const cmdBarStateSelector = (state: SnapshotFrom<typeof commandBarActor>) =>
state
export const useCommandBarState = () => {