@shipfox/client-onboarding 12.0.2 → 14.0.0
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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +31 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/dist/workspace-setup-route.d.ts +3 -8
- package/dist/workspace-setup-route.d.ts.map +1 -1
- package/dist/workspace-setup-route.js +27 -27
- package/dist/workspace-setup-route.js.map +1 -1
- package/package.json +5 -5
- package/src/workspace-setup-route.test.tsx +44 -44
- package/src/workspace-setup-route.ts +29 -31
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -10,6 +10,7 @@ import {projectExistenceQueryOptions} from '@shipfox/client-projects';
|
|
|
10
10
|
import {
|
|
11
11
|
userWorkspacesQueryOptions,
|
|
12
12
|
WorkspaceSetupLoadError,
|
|
13
|
+
type WorkspaceSetupRouteOptions,
|
|
13
14
|
type WorkspaceSetupState,
|
|
14
15
|
} from '@shipfox/client-shell/runtime';
|
|
15
16
|
import type {QueryClient} from '@tanstack/react-query';
|
|
@@ -17,15 +18,12 @@ import {redirect} from '@tanstack/react-router';
|
|
|
17
18
|
|
|
18
19
|
const TRAILING_SLASHES_RE = /\/+$/u;
|
|
19
20
|
|
|
20
|
-
export
|
|
21
|
-
queryClient: QueryClient;
|
|
22
|
-
workspaceId: string;
|
|
23
|
-
pathname: string;
|
|
24
|
-
}
|
|
21
|
+
export type {WorkspaceSetupRouteOptions} from '@shipfox/client-shell/runtime';
|
|
25
22
|
|
|
26
23
|
export async function loadWorkspaceSetupRoute({
|
|
27
24
|
queryClient,
|
|
28
25
|
workspaceId,
|
|
26
|
+
workspaceSlug,
|
|
29
27
|
pathname,
|
|
30
28
|
}: WorkspaceSetupRouteOptions): Promise<WorkspaceSetupState> {
|
|
31
29
|
const workspace = await fetchWorkspaceSummary(queryClient, workspaceId);
|
|
@@ -45,10 +43,10 @@ export async function loadWorkspaceSetupRoute({
|
|
|
45
43
|
const normalizedPathname = normalizePath(pathname);
|
|
46
44
|
|
|
47
45
|
if (projects.projects.length > 0) {
|
|
48
|
-
if (isIntegrationsIndexPath(normalizedPathname,
|
|
46
|
+
if (isIntegrationsIndexPath(normalizedPathname, workspaceSlug)) {
|
|
49
47
|
throw redirect({
|
|
50
|
-
to: '/
|
|
51
|
-
params: {
|
|
48
|
+
to: '/w/$workspaceSlug/settings/integrations',
|
|
49
|
+
params: {workspaceSlug},
|
|
52
50
|
replace: true,
|
|
53
51
|
});
|
|
54
52
|
}
|
|
@@ -60,41 +58,41 @@ export async function loadWorkspaceSetupRoute({
|
|
|
60
58
|
const hasSourceConnection = sourceConnections.length > 0;
|
|
61
59
|
|
|
62
60
|
if (!hasSourceConnection) {
|
|
63
|
-
if (isIntegrationSetupPath(normalizedPathname,
|
|
61
|
+
if (isIntegrationSetupPath(normalizedPathname, workspaceSlug)) {
|
|
64
62
|
return {hideProjectNavigation: true};
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
throw redirect({
|
|
68
|
-
to: '/
|
|
69
|
-
params: {
|
|
66
|
+
to: '/w/$workspaceSlug/integrations',
|
|
67
|
+
params: {workspaceSlug},
|
|
70
68
|
replace: true,
|
|
71
69
|
});
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
if (isAgentSettingsPath(normalizedPathname,
|
|
72
|
+
if (isAgentSettingsPath(normalizedPathname, workspaceSlug)) {
|
|
75
73
|
return {hideProjectNavigation: true};
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
const providerHandled = await hasHandledModelProviderOnboarding(queryClient, workspaceId);
|
|
79
77
|
if (!providerHandled) {
|
|
80
|
-
if (isModelProviderOnboardingPath(normalizedPathname,
|
|
78
|
+
if (isModelProviderOnboardingPath(normalizedPathname, workspaceSlug)) {
|
|
81
79
|
return {hideProjectNavigation: true};
|
|
82
80
|
}
|
|
83
81
|
|
|
84
82
|
throw redirect({
|
|
85
|
-
to: '/
|
|
86
|
-
params: {
|
|
83
|
+
to: '/w/$workspaceSlug/model-provider',
|
|
84
|
+
params: {workspaceSlug},
|
|
87
85
|
replace: true,
|
|
88
86
|
});
|
|
89
87
|
}
|
|
90
88
|
|
|
91
|
-
if (isProjectCreationPath(normalizedPathname,
|
|
89
|
+
if (isProjectCreationPath(normalizedPathname, workspaceSlug)) {
|
|
92
90
|
return {hideProjectNavigation: true};
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
throw redirect({
|
|
96
|
-
to: '/
|
|
97
|
-
params: {
|
|
94
|
+
to: '/w/$workspaceSlug/projects/new',
|
|
95
|
+
params: {workspaceSlug},
|
|
98
96
|
replace: true,
|
|
99
97
|
});
|
|
100
98
|
}
|
|
@@ -157,31 +155,31 @@ function normalizePath(pathname: string) {
|
|
|
157
155
|
return pathname.replace(TRAILING_SLASHES_RE, '');
|
|
158
156
|
}
|
|
159
157
|
|
|
160
|
-
function workspacePath(
|
|
161
|
-
return `/
|
|
158
|
+
function workspacePath(workspaceSlug: string, suffix: string) {
|
|
159
|
+
return `/w/${workspaceSlug}${suffix}`;
|
|
162
160
|
}
|
|
163
161
|
|
|
164
|
-
function isIntegrationsIndexPath(pathname: string,
|
|
165
|
-
return pathname === workspacePath(
|
|
162
|
+
function isIntegrationsIndexPath(pathname: string, workspaceSlug: string) {
|
|
163
|
+
return pathname === workspacePath(workspaceSlug, '/integrations');
|
|
166
164
|
}
|
|
167
165
|
|
|
168
|
-
function isIntegrationSetupPath(pathname: string,
|
|
169
|
-
const basePath = workspacePath(
|
|
166
|
+
function isIntegrationSetupPath(pathname: string, workspaceSlug: string) {
|
|
167
|
+
const basePath = workspacePath(workspaceSlug, '/integrations');
|
|
170
168
|
return (
|
|
171
169
|
pathname === basePath ||
|
|
172
170
|
pathname.startsWith(`${basePath}/`) ||
|
|
173
|
-
pathname === workspacePath(
|
|
171
|
+
pathname === workspacePath(workspaceSlug, '/settings/integrations')
|
|
174
172
|
);
|
|
175
173
|
}
|
|
176
174
|
|
|
177
|
-
function isProjectCreationPath(pathname: string,
|
|
178
|
-
return pathname === workspacePath(
|
|
175
|
+
function isProjectCreationPath(pathname: string, workspaceSlug: string) {
|
|
176
|
+
return pathname === workspacePath(workspaceSlug, '/projects/new');
|
|
179
177
|
}
|
|
180
178
|
|
|
181
|
-
function isModelProviderOnboardingPath(pathname: string,
|
|
182
|
-
return pathname === workspacePath(
|
|
179
|
+
function isModelProviderOnboardingPath(pathname: string, workspaceSlug: string) {
|
|
180
|
+
return pathname === workspacePath(workspaceSlug, '/model-provider');
|
|
183
181
|
}
|
|
184
182
|
|
|
185
|
-
function isAgentSettingsPath(pathname: string,
|
|
186
|
-
return pathname === workspacePath(
|
|
183
|
+
function isAgentSettingsPath(pathname: string, workspaceSlug: string) {
|
|
184
|
+
return pathname === workspacePath(workspaceSlug, '/settings/agents');
|
|
187
185
|
}
|