@tscircuit/fake-snippets 0.0.109 → 0.0.110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/.github/workflows/bun-formatcheck.yml +2 -2
  2. package/.github/workflows/bun-pver-release.yml +3 -3
  3. package/.github/workflows/bun-test.yml +1 -1
  4. package/.github/workflows/bun-typecheck.yml +2 -2
  5. package/.github/workflows/update-snapshots.yml +1 -1
  6. package/README.md +4 -0
  7. package/api/generated-index.js +37 -3
  8. package/biome.json +2 -1
  9. package/bun-tests/fake-snippets-api/fixtures/get-test-server.ts +31 -3
  10. package/bun-tests/fake-snippets-api/fixtures/preload.ts +18 -0
  11. package/bun-tests/fake-snippets-api/routes/orgs/add_member.test.ts +26 -0
  12. package/bun-tests/fake-snippets-api/routes/orgs/create.test.ts +37 -0
  13. package/bun-tests/fake-snippets-api/routes/orgs/get.test.ts +52 -0
  14. package/bun-tests/fake-snippets-api/routes/orgs/list.test.ts +17 -0
  15. package/bun-tests/fake-snippets-api/routes/orgs/list_members.test.ts +23 -0
  16. package/bun-tests/fake-snippets-api/routes/orgs/remove_member.test.ts +81 -0
  17. package/bun-tests/fake-snippets-api/routes/orgs/update.test.ts +99 -0
  18. package/bun-tests/fake-snippets-api/routes/package_builds/get.test.ts +1 -1
  19. package/bun-tests/fake-snippets-api/routes/package_files/create.test.ts +15 -13
  20. package/bun-tests/fake-snippets-api/routes/package_files/create_or_update.test.ts +26 -24
  21. package/bun-tests/fake-snippets-api/routes/package_files/delete.test.ts +9 -9
  22. package/bun-tests/fake-snippets-api/routes/package_files/download.test.ts +4 -4
  23. package/bun-tests/fake-snippets-api/routes/package_files/get.test.ts +38 -28
  24. package/bun-tests/fake-snippets-api/routes/package_files/list.test.ts +23 -15
  25. package/bun-tests/fake-snippets-api/routes/package_releases/create.test.ts +33 -0
  26. package/bun-tests/fake-snippets-api/routes/package_releases/get.test.ts +4 -4
  27. package/bun-tests/fake-snippets-api/routes/package_releases/get_image_generation_fields.test.ts +38 -0
  28. package/bun-tests/fake-snippets-api/routes/packages/create.test.ts +19 -0
  29. package/bun-tests/fake-snippets-api/routes/packages/fork.test.ts +3 -4
  30. package/bun-tests/fake-snippets-api/routes/packages/get.test.ts +30 -0
  31. package/bun-tests/fake-snippets-api/routes/packages/images.test.ts +4 -2
  32. package/bun-tests/fake-snippets-api/routes/packages/list-1.test.ts +34 -0
  33. package/bun.lock +349 -453
  34. package/bunfig.toml +2 -1
  35. package/dist/bundle.js +1253 -624
  36. package/dist/index.d.ts +291 -4
  37. package/dist/index.js +323 -23
  38. package/dist/schema.d.ts +274 -1
  39. package/dist/schema.js +52 -1
  40. package/fake-snippets-api/lib/db/autoload-dev-packages.ts +31 -20
  41. package/fake-snippets-api/lib/db/db-client.ts +214 -3
  42. package/fake-snippets-api/lib/db/schema.ts +61 -0
  43. package/fake-snippets-api/lib/db/seed.ts +100 -0
  44. package/fake-snippets-api/lib/middleware/with-session-auth.ts +1 -1
  45. package/fake-snippets-api/lib/package_file/get-package-file-id-from-file-descriptor.ts +2 -2
  46. package/fake-snippets-api/lib/public-mapping/public-map-org.ts +32 -0
  47. package/fake-snippets-api/lib/public-mapping/public-map-package-build.ts +10 -0
  48. package/fake-snippets-api/lib/public-mapping/public-map-package-release.ts +17 -0
  49. package/fake-snippets-api/routes/api/orgs/add_member.ts +52 -0
  50. package/fake-snippets-api/routes/api/orgs/create.ts +46 -0
  51. package/fake-snippets-api/routes/api/orgs/get.ts +39 -0
  52. package/fake-snippets-api/routes/api/orgs/list.ts +31 -0
  53. package/fake-snippets-api/routes/api/orgs/list_members.ts +67 -0
  54. package/fake-snippets-api/routes/api/orgs/remove_member.ts +46 -0
  55. package/fake-snippets-api/routes/api/orgs/update.ts +93 -0
  56. package/fake-snippets-api/routes/api/package_files/get.ts +3 -6
  57. package/fake-snippets-api/routes/api/package_files/list.ts +7 -4
  58. package/fake-snippets-api/routes/api/packages/create.ts +54 -10
  59. package/fake-snippets-api/routes/api/packages/get.ts +23 -0
  60. package/fake-snippets-api/routes/api/packages/images/[owner_github_username]/[unscoped_name]/[view_format].ts +13 -11
  61. package/fake-snippets-api/routes/api/packages/list.ts +29 -2
  62. package/fake-snippets-api/routes/api/packages/update_ai_description.ts +37 -0
  63. package/package.json +24 -20
  64. package/renovate.json +1 -1
  65. package/scripts/generate-sitemap.ts +1 -1
  66. package/src/App.tsx +29 -8
  67. package/src/ContextProviders.tsx +25 -2
  68. package/src/components/CircuitJsonImportDialog.tsx +1 -1
  69. package/src/components/CmdKMenu.tsx +281 -247
  70. package/src/components/DownloadButtonAndMenu.tsx +3 -4
  71. package/src/components/FileSidebar.tsx +11 -17
  72. package/src/components/Footer.tsx +8 -9
  73. package/src/components/Header.tsx +19 -32
  74. package/src/components/Header2.tsx +16 -32
  75. package/src/components/HeaderDropdown.tsx +13 -8
  76. package/src/components/HeaderLogin.tsx +43 -15
  77. package/src/components/NotFound.tsx +5 -5
  78. package/src/components/PackageBreadcrumb.tsx +6 -12
  79. package/src/components/PackageSearchResults.tsx +1 -1
  80. package/src/components/PrefetchPageLink.tsx +7 -1
  81. package/src/components/ProfileRouter.tsx +32 -0
  82. package/src/components/SearchComponent.tsx +12 -8
  83. package/src/components/UserCard.tsx +80 -0
  84. package/src/components/ViewPackagePage/components/build-status.tsx +1 -1
  85. package/src/components/ViewPackagePage/components/important-files-view.tsx +105 -34
  86. package/src/components/ViewPackagePage/components/main-content-header.tsx +10 -6
  87. package/src/components/ViewPackagePage/components/main-content-view-selector.tsx +1 -1
  88. package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +54 -19
  89. package/src/components/ViewPackagePage/components/package-header.tsx +25 -33
  90. package/src/components/ViewPackagePage/components/preview-image-squares.tsx +11 -18
  91. package/src/components/ViewPackagePage/components/repo-page-content.tsx +12 -5
  92. package/src/components/ViewPackagePage/components/sidebar-about-section.tsx +16 -10
  93. package/src/components/ViewPackagePage/components/sidebar-releases-section.tsx +11 -11
  94. package/src/components/ViewPackagePage/components/tab-views/pcb-view.tsx +1 -2
  95. package/src/components/ViewPackagePage/components/tab-views/schematic-view.tsx +2 -1
  96. package/src/components/dialogs/GitHubRepositorySelector.tsx +56 -49
  97. package/src/components/dialogs/edit-package-details-dialog.tsx +5 -6
  98. package/src/components/dialogs/import-component-dialog.tsx +16 -9
  99. package/src/components/dialogs/import-package-dialog.tsx +3 -2
  100. package/src/components/dialogs/new-package-save-prompt-dialog.tsx +190 -0
  101. package/src/components/organization/OrganizationCard.tsx +204 -0
  102. package/src/components/organization/OrganizationCardSkeleton.tsx +55 -0
  103. package/src/components/organization/OrganizationHeader.tsx +154 -0
  104. package/src/components/organization/OrganizationMembers.tsx +146 -0
  105. package/src/components/package-port/CodeAndPreview.tsx +15 -12
  106. package/src/components/package-port/CodeEditor.tsx +4 -30
  107. package/src/components/package-port/CodeEditorHeader.tsx +123 -61
  108. package/src/components/package-port/EditorNav.tsx +32 -49
  109. package/src/components/preview/ConnectedPackagesList.tsx +8 -8
  110. package/src/components/preview/ConnectedRepoOverview.tsx +102 -2
  111. package/src/components/preview/PackageReleasesDashboard.tsx +23 -11
  112. package/src/components/ui/tree-view.tsx +6 -3
  113. package/src/hooks/use-add-org-member-mutation.ts +51 -0
  114. package/src/hooks/use-create-org-mutation.ts +38 -0
  115. package/src/hooks/use-create-package-mutation.ts +3 -0
  116. package/src/hooks/use-current-package-release.ts +4 -3
  117. package/src/hooks/use-download-zip.ts +2 -2
  118. package/src/hooks/use-global-store.ts +6 -4
  119. package/src/hooks/use-jlcpcb-component-import.tsx +164 -0
  120. package/src/hooks/use-list-org-members.ts +27 -0
  121. package/src/hooks/use-list-user-orgs.ts +25 -0
  122. package/src/hooks/use-org-by-github-handle.ts +26 -0
  123. package/src/hooks/use-org.ts +24 -0
  124. package/src/hooks/use-organization.ts +42 -0
  125. package/src/hooks/use-package-as-snippet.ts +4 -2
  126. package/src/hooks/use-package-builds.ts +6 -2
  127. package/src/hooks/use-package-files.ts +5 -3
  128. package/src/hooks/use-package-release-by-id-or-version.ts +29 -20
  129. package/src/hooks/use-package-release-images.ts +105 -0
  130. package/src/hooks/use-package-release.ts +2 -2
  131. package/src/hooks/use-package-stars.ts +80 -4
  132. package/src/hooks/use-preview-images.ts +6 -3
  133. package/src/hooks/use-remove-org-member-mutation.ts +32 -0
  134. package/src/hooks/use-update-ai-description-mutation.ts +42 -0
  135. package/src/hooks/use-update-org-mutation.ts +41 -0
  136. package/src/hooks/use-warn-user-on-page-change.ts +71 -4
  137. package/src/hooks/useFileManagement.ts +51 -22
  138. package/src/hooks/useOptimizedPackageFilesLoader.ts +11 -24
  139. package/src/hooks/usePackageFilesLoader.ts +2 -2
  140. package/src/hooks/useUpdatePackageFilesMutation.ts +13 -1
  141. package/src/lib/download-fns/download-gltf-from-circuit-json.ts +1 -1
  142. package/src/lib/download-fns/download-kicad-files.ts +12 -11
  143. package/src/lib/normalize-svg-for-tile.ts +50 -0
  144. package/src/lib/posthog.ts +11 -9
  145. package/src/lib/react-query-api-failure-tracking.ts +148 -0
  146. package/src/lib/sentry.ts +14 -0
  147. package/src/lib/templates/blank-circuit-board-template.ts +0 -4
  148. package/src/lib/ts-lib-cache.ts +122 -7
  149. package/src/lib/utils/checkIfManualEditsImported.ts +4 -4
  150. package/src/lib/utils/findTargetFile.ts +45 -10
  151. package/src/lib/utils/isComponentExported.ts +2 -1
  152. package/src/main.tsx +2 -1
  153. package/src/pages/create-organization.tsx +168 -0
  154. package/src/pages/dashboard.tsx +38 -6
  155. package/src/pages/datasheet.tsx +1 -1
  156. package/src/pages/datasheets.tsx +3 -3
  157. package/src/pages/editor.tsx +4 -6
  158. package/src/pages/landing.tsx +6 -6
  159. package/src/pages/latest.tsx +3 -0
  160. package/src/pages/organization-profile.tsx +199 -0
  161. package/src/pages/organization-settings.tsx +566 -0
  162. package/src/pages/package-editor.tsx +21 -21
  163. package/src/pages/preview-release.tsx +75 -145
  164. package/src/pages/quickstart.tsx +159 -123
  165. package/src/pages/release-detail.tsx +119 -31
  166. package/src/pages/search.tsx +192 -57
  167. package/src/pages/settings-redirect.tsx +44 -0
  168. package/src/pages/trending.tsx +29 -20
  169. package/src/pages/user-profile.tsx +58 -7
  170. package/src/pages/view-package.tsx +7 -13
  171. package/vite.config.ts +9 -0
  172. package/fake-snippets-api/routes/api/autocomplete/create_autocomplete.ts +0 -133
  173. package/src/components/JLCPCBImportDialog.tsx +0 -280
  174. package/src/components/PackageBuildsPage/LogContent.tsx +0 -72
  175. package/src/components/PackageBuildsPage/PackageBuildDetailsPage.tsx +0 -113
  176. package/src/components/PackageBuildsPage/build-preview-content.tsx +0 -56
  177. package/src/components/PackageBuildsPage/collapsible-section.tsx +0 -63
  178. package/src/components/PackageBuildsPage/package-build-details-panel.tsx +0 -166
  179. package/src/components/PackageBuildsPage/package-build-header.tsx +0 -79
  180. package/src/components/PageSearchComponent.tsx +0 -148
  181. package/src/pages/package-builds.tsx +0 -33
@@ -0,0 +1,37 @@
1
+ import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
2
+ import { z } from "zod"
3
+
4
+ export default withRouteSpec({
5
+ methods: ["POST"],
6
+ auth: "session",
7
+ jsonBody: z.object({
8
+ package_id: z.string(),
9
+ }),
10
+ jsonResponse: z.object({
11
+ success: z.boolean(),
12
+ }),
13
+ })(async (req, ctx) => {
14
+ const { package_id } = req.jsonBody
15
+
16
+ const package_info = ctx.db.getPackageById(package_id)
17
+ if (!package_info) {
18
+ return ctx.error(404, {
19
+ error_code: "package_not_found",
20
+ message: "Package not found",
21
+ })
22
+ }
23
+
24
+ if (package_info.owner_github_username !== ctx.auth.github_username) {
25
+ return ctx.error(403, {
26
+ error_code: "unauthorized",
27
+ message: "Only the package owner can update AI description",
28
+ })
29
+ }
30
+
31
+ ctx.db.updatePackage(package_id, {
32
+ ai_description: "New ai description",
33
+ ai_usage_instructions: "New ai usage instructions",
34
+ })
35
+
36
+ return ctx.json({ success: true })
37
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/fake-snippets",
3
- "version": "0.0.109",
3
+ "version": "0.0.110",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  "playwright": "bunx playwright test",
19
19
  "playwright:update": "bunx playwright test --update-snapshots",
20
20
  "start:playwright-server": "bun run build:fake-api && vite --port 5177",
21
- "dev": "bun run build:fake-api && AUTOLOAD_PACKAGES=true vite",
21
+ "dev": "bun run build:fake-api && AUTOLOAD_PACKAGES=true vite --host",
22
22
  "dev:registry": "SNIPPETS_API_URL=http://localhost:3100 vite",
23
23
  "build": "bun run generate-images && bun run generate-sitemap && bun run build:fake-api && tsc -b && vite build",
24
24
  "preview": "vite preview",
@@ -76,17 +76,18 @@
76
76
  "@radix-ui/react-toggle-group": "^1.1.0",
77
77
  "@radix-ui/react-tooltip": "^1.1.2",
78
78
  "@resvg/resvg-wasm": "^2.6.2",
79
+ "@sentry/react": "^10.10.0",
79
80
  "@tailwindcss/typography": "^0.5.16",
80
- "@tscircuit/3d-viewer": "^0.0.303",
81
- "@tscircuit/assembly-viewer": "^0.0.1",
81
+ "@tscircuit/3d-viewer": "^0.0.402",
82
+ "@tscircuit/assembly-viewer": "^0.0.5",
82
83
  "@tscircuit/create-snippet-url": "^0.0.8",
83
- "@tscircuit/eval": "^0.0.244",
84
+ "@tscircuit/eval": "^0.0.325",
84
85
  "@tscircuit/layout": "^0.0.29",
85
86
  "@tscircuit/mm": "^0.0.8",
86
- "@tscircuit/pcb-viewer": "^1.11.194",
87
+ "@tscircuit/pcb-viewer": "^1.11.218",
87
88
  "@tscircuit/prompt-benchmarks": "^0.0.28",
88
- "@tscircuit/runframe": "^0.0.781",
89
- "@tscircuit/schematic-viewer": "^2.0.21",
89
+ "@tscircuit/runframe": "^0.0.1031",
90
+ "@tscircuit/schematic-viewer": "^2.0.39",
90
91
  "@tscircuit/simple-3d-svg": "^0.0.41",
91
92
  "@types/babel__standalone": "^7.1.7",
92
93
  "@types/bun": "^1.1.10",
@@ -99,6 +100,7 @@
99
100
  "@types/react-dom": "^18.3.0",
100
101
  "@types/react-helmet": "^6.1.11",
101
102
  "@types/sharp": "^0.32.0",
103
+ "@types/three": "^0.180.0",
102
104
  "@typescript/ata": "^0.9.7",
103
105
  "@typescript/vfs": "^1.6.0",
104
106
  "@valtown/codemirror-ts": "^2.2.0",
@@ -107,13 +109,13 @@
107
109
  "autoprefixer": "^10.4.20",
108
110
  "circuit-json-to-bom-csv": "^0.0.7",
109
111
  "circuit-json-to-gerber": "^0.0.29",
110
- "circuit-json-to-gltf": "^0.0.4",
112
+ "circuit-json-to-gltf": "^0.0.14",
111
113
  "circuit-json-to-pnp-csv": "^0.0.7",
112
114
  "circuit-json-to-readable-netlist": "^0.0.13",
113
- "circuit-json-to-simple-3d": "^0.0.6",
115
+ "circuit-json-to-simple-3d": "^0.0.7",
114
116
  "circuit-json-to-spice": "^0.0.6",
115
- "circuit-json-to-tscircuit": "^0.0.4",
116
- "circuit-to-svg": "^0.0.167",
117
+ "circuit-json-to-tscircuit": "^0.0.9",
118
+ "circuit-to-svg": "^0.0.202",
117
119
  "class-variance-authority": "^0.7.1",
118
120
  "clsx": "^2.1.1",
119
121
  "cmdk": "^1.0.4",
@@ -121,11 +123,12 @@
121
123
  "codemirror-copilot": "^0.0.7",
122
124
  "dotenv": "^16.5.0",
123
125
  "dsn-converter": "^0.0.60",
124
- "easyeda": "^0.0.203",
126
+ "easyeda": "^0.0.228",
125
127
  "embla-carousel-react": "^8.3.0",
126
128
  "extract-codefence": "^0.0.4",
127
129
  "fflate": "^0.8.2",
128
130
  "file-saver": "^2.0.5",
131
+ "fuse.js": "^7.1.0",
129
132
  "get-port": "^7.1.0",
130
133
  "globals": "^15.9.0",
131
134
  "he": "^1.2.0",
@@ -143,14 +146,13 @@
143
146
  "md5": "^2.3.0",
144
147
  "ms": "^2.1.3",
145
148
  "next-themes": "^0.3.0",
146
- "openai": "^5.6.0",
147
149
  "postcss": "^8.4.47",
148
150
  "posthog-js": "^1.203.2",
149
151
  "prompts": "^2.4.2",
150
- "react": "^18.3.1",
152
+ "react": "^19.1.1",
151
153
  "react-cookie-consent": "^9.0.0",
152
154
  "react-day-picker": "8.10.1",
153
- "react-dom": "^18.3.1",
155
+ "react-dom": "^19.1.1",
154
156
  "react-error-boundary": "^6.0.0",
155
157
  "react-helmet": "^6.1.0",
156
158
  "react-helmet-async": "^2.0.5",
@@ -164,7 +166,7 @@
164
166
  "redaxios": "^0.5.1",
165
167
  "remark-gfm": "^4.0.1",
166
168
  "rollup-plugin-visualizer": "^5.12.0",
167
- "schematic-symbols": "^0.0.171",
169
+ "schematic-symbols": "^0.0.202",
168
170
  "sharp": "^0.33.5",
169
171
  "shiki": "^3.2.1",
170
172
  "sitemap": "^8.0.0",
@@ -175,9 +177,9 @@
175
177
  "tailwindcss": "^3.4.13",
176
178
  "tailwindcss-animate": "^1.0.7",
177
179
  "terser": "^5.27.0",
178
- "three": "^0.177.0",
180
+ "three": "0.165.0",
179
181
  "three-stdlib": "^2.36.0",
180
- "tscircuit": "^0.0.538",
182
+ "tscircuit": "^0.0.653",
181
183
  "tsup": "^8.5.0",
182
184
  "typescript": "^5.6.3",
183
185
  "use-async-memo": "^1.2.5",
@@ -190,6 +192,8 @@
190
192
  "wouter": "^3.3.5",
191
193
  "zod": "^3.23.8",
192
194
  "zustand": "^4.5.5",
193
- "zustand-hoist": "^2.0.1"
195
+ "zustand-hoist": "^2.0.1",
196
+ "circuit-json-to-kicad": "^0.0.3",
197
+ "kicadts": "^0.0.9"
194
198
  }
195
199
  }
package/renovate.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": ["config:base"],
3
+ "extends": ["config:base", ":noReviewer", ":noAssignees"],
4
4
  "packageRules": [
5
5
  {
6
6
  "packagePatterns": ["*"],
@@ -20,7 +20,7 @@ const staticRoutes = [
20
20
  async function fetchTrendingSnippets() {
21
21
  try {
22
22
  const response = await fetch(
23
- "https://registry-api.tscircuit.com/snippets/list_trending",
23
+ "https://api.tscircuit.com/snippets/list_trending",
24
24
  {
25
25
  headers: {
26
26
  Accept: "application/json",
package/src/App.tsx CHANGED
@@ -6,7 +6,7 @@ import React from "react"
6
6
  import { ReloadIcon } from "@radix-ui/react-icons"
7
7
  import { Loader2 } from "lucide-react"
8
8
 
9
- const FullPageLoader = () => (
9
+ export const FullPageLoader = () => (
10
10
  <div className="fixed inset-0 flex items-center justify-center bg-white z-50">
11
11
  <div className="w-48">
12
12
  <div className="loading">
@@ -64,10 +64,12 @@ const MyOrdersPage = lazyImport(() => import("@/pages/my-orders"))
64
64
  const LatestPage = lazyImport(() => import("@/pages/latest"))
65
65
  const QuickstartPage = lazyImport(() => import("@/pages/quickstart"))
66
66
  const SearchPage = lazyImport(() => import("@/pages/search"))
67
- const UserProfilePage = lazyImport(() => import("@/pages/user-profile"))
67
+ const CreateOrganizationPage = lazyImport(
68
+ () => import("@/pages/create-organization"),
69
+ )
70
+ const ProfileRouter = lazyImport(() => import("@/components/ProfileRouter"))
68
71
  const DevLoginPage = lazyImport(() => import("@/pages/dev-login"))
69
72
  const ViewPackagePage = lazyImport(() => import("@/pages/view-package"))
70
- const PackageBuildsPage = lazyImport(() => import("@/pages/package-builds"))
71
73
  const TrendingPage = lazyImport(() => import("@/pages/trending"))
72
74
  const DatasheetPage = lazyImport(() => import("@/pages/datasheet"))
73
75
  const DatasheetsPage = lazyImport(() => import("@/pages/datasheets"))
@@ -82,6 +84,12 @@ const ReleasesPage = lazyImport(() => import("@/pages/releases"))
82
84
  const ReleaseDetailPage = lazyImport(() => import("@/pages/release-detail"))
83
85
  const ReleaseBuildsPage = lazyImport(() => import("@/pages/release-builds"))
84
86
  const ReleasePreviewPage = lazyImport(() => import("@/pages/preview-release"))
87
+ const OrganizationSettingsPage = lazyImport(
88
+ () => import("@/pages/organization-settings"),
89
+ )
90
+ const SettingsRedirectPage = lazyImport(
91
+ () => import("@/pages/settings-redirect"),
92
+ )
85
93
 
86
94
  class ErrorBoundary extends React.Component<
87
95
  { children: React.ReactNode },
@@ -258,7 +266,23 @@ function App() {
258
266
  <Route path="/authorize" component={AuthenticatePage} />
259
267
  <Route path="/my-orders" component={MyOrdersPage} />
260
268
  <Route path="/dev-login" component={DevLoginPage} />
261
- <Route path="/:username" component={UserProfilePage} />
269
+
270
+ {/* Organization creation route */}
271
+ <Route path="/orgs/new" component={CreateOrganizationPage} />
272
+
273
+ {/* User settings redirect */}
274
+ <Route path="/settings" component={SettingsRedirectPage} />
275
+
276
+ {/* Organization settings route */}
277
+ <Route
278
+ path="/:orgname/settings"
279
+ component={OrganizationSettingsPage}
280
+ />
281
+
282
+ {/* Profile fallback route - handles both organizations and users */}
283
+ <Route path="/:username" component={ProfileRouter} />
284
+
285
+ {/* Package-related routes - must come after profile fallback */}
262
286
  <Route
263
287
  path="/:author/:packageName/releases/:releaseId/builds"
264
288
  component={ReleaseBuildsPage}
@@ -280,10 +304,7 @@ function App() {
280
304
  component={ReleasesPage}
281
305
  />
282
306
  <Route path="/:author/:packageName" component={ViewPackagePage} />
283
- <Route
284
- path="/:author/:packageName/builds"
285
- component={PackageBuildsPage}
286
- />
307
+ {/* 404 fallback */}
287
308
  <Route component={lazyImport(() => import("@/pages/404"))} />
288
309
  </Switch>
289
310
  </Suspense>
@@ -1,10 +1,16 @@
1
- import { QueryClient, QueryClientProvider } from "react-query"
1
+ import {
2
+ MutationCache,
3
+ QueryCache,
4
+ QueryClient,
5
+ QueryClientProvider,
6
+ } from "react-query"
2
7
  import { HelmetProvider } from "react-helmet-async"
3
8
  import { useEffect } from "react"
4
9
  import { useGlobalStore } from "./hooks/use-global-store"
5
10
  import { posthog } from "./lib/posthog"
6
11
  import { Toaster } from "react-hot-toast"
7
12
  import { populateQueryCacheWithSSRData } from "./lib/populate-query-cache-with-ssr-data"
13
+ import { trackReactQueryApiFailure } from "./lib/react-query-api-failure-tracking"
8
14
 
9
15
  const staffGithubUsernames = [
10
16
  "imrishabh18",
@@ -13,7 +19,24 @@ const staffGithubUsernames = [
13
19
  ...(import.meta.env.VITE_STAFF_GITHUB_USERNAMES?.split(",") || []),
14
20
  ]
15
21
 
16
- const queryClient = new QueryClient()
22
+ const queryClient = new QueryClient({
23
+ queryCache: new QueryCache({
24
+ onError: (error, query) => {
25
+ trackReactQueryApiFailure(error, {
26
+ operationType: "query",
27
+ queryKey: query.queryKey,
28
+ })
29
+ },
30
+ }),
31
+ mutationCache: new MutationCache({
32
+ onError: (error, _variables, _context, mutation) => {
33
+ trackReactQueryApiFailure(error, {
34
+ operationType: "mutation",
35
+ mutationKey: mutation.options?.mutationKey,
36
+ })
37
+ },
38
+ }),
39
+ })
17
40
  populateQueryCacheWithSSRData(queryClient)
18
41
 
19
42
  const isInternalGithubUser = (githubUsername?: string | null) => {
@@ -123,7 +123,7 @@ export function CircuitJsonImportDialog({
123
123
  const tscircuitComponentContent = convertCircuitJsonToTscircuit(
124
124
  importedCircuitJson as any,
125
125
  {
126
- componentName: "circuit",
126
+ componentName: "Component",
127
127
  },
128
128
  )
129
129
  console.info(tscircuitComponentContent)