@shipfox/client-integrations 4.0.0 → 5.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.
Files changed (37) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +22 -0
  3. package/dist/feature.d.ts +11 -0
  4. package/dist/feature.d.ts.map +1 -1
  5. package/dist/feature.js +14 -0
  6. package/dist/feature.js.map +1 -1
  7. package/dist/hooks/api/integrations.d.ts +6 -1
  8. package/dist/hooks/api/integrations.d.ts.map +1 -1
  9. package/dist/hooks/api/integrations.js +15 -12
  10. package/dist/hooks/api/integrations.js.map +1 -1
  11. package/dist/pages/linear-callback-page.d.ts.map +1 -1
  12. package/dist/pages/linear-callback-page.js +1 -1
  13. package/dist/pages/linear-callback-page.js.map +1 -1
  14. package/dist/pages/sentry-callback-page.js +1 -1
  15. package/dist/pages/sentry-callback-page.js.map +1 -1
  16. package/dist/pages/slack-callback-page.d.ts.map +1 -1
  17. package/dist/pages/slack-callback-page.js +1 -1
  18. package/dist/pages/slack-callback-page.js.map +1 -1
  19. package/dist/routes/github-callback.js +1 -1
  20. package/dist/routes/github-callback.js.map +1 -1
  21. package/dist/routes/integrations-settings.d.ts +6 -0
  22. package/dist/routes/integrations-settings.d.ts.map +1 -0
  23. package/dist/routes/integrations-settings.js +7 -0
  24. package/dist/routes/integrations-settings.js.map +1 -0
  25. package/dist/tsconfig.test.tsbuildinfo +1 -1
  26. package/package.json +10 -10
  27. package/src/feature.ts +14 -0
  28. package/src/hooks/api/integrations.ts +32 -8
  29. package/src/pages/linear-callback-page.test.tsx +1 -1
  30. package/src/pages/linear-callback-page.tsx +2 -1
  31. package/src/pages/sentry-callback-page.test.tsx +1 -1
  32. package/src/pages/sentry-callback-page.tsx +1 -1
  33. package/src/pages/slack-callback-page.tsx +2 -1
  34. package/src/routes/github-callback.tsx +1 -1
  35. package/src/routes/integrations-settings.tsx +4 -0
  36. package/test/render.tsx +1 -5
  37. package/tsconfig.build.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipfox/client-integrations",
3
3
  "license": "MIT",
4
- "version": "4.0.0",
4
+ "version": "5.0.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ShipfoxHQ/shipfox.git",
@@ -31,16 +31,16 @@
31
31
  "dependencies": {
32
32
  "@swc/helpers": "^0.5.17",
33
33
  "@tanstack/react-form": "^1.32.0",
34
- "@shipfox/api-integration-core-dto": "6.0.0",
35
- "@shipfox/api-integration-gitea-dto": "6.0.0",
36
- "@shipfox/api-integration-github-dto": "6.0.0",
37
- "@shipfox/api-integration-linear-dto": "6.0.0",
38
- "@shipfox/api-integration-slack-dto": "6.0.0",
39
- "@shipfox/api-integration-sentry-dto": "6.0.0",
40
- "@shipfox/api-integration-webhook-dto": "6.0.0",
34
+ "@shipfox/api-integration-core-dto": "8.0.0",
35
+ "@shipfox/api-integration-gitea-dto": "8.0.0",
36
+ "@shipfox/api-integration-github-dto": "8.0.0",
37
+ "@shipfox/api-integration-linear-dto": "8.0.0",
38
+ "@shipfox/api-integration-slack-dto": "8.0.0",
39
+ "@shipfox/api-integration-sentry-dto": "8.0.0",
40
+ "@shipfox/api-integration-webhook-dto": "8.0.0",
41
41
  "@shipfox/client-api": "4.0.0",
42
- "@shipfox/client-auth": "4.0.0",
43
- "@shipfox/client-shell": "4.0.0",
42
+ "@shipfox/client-auth": "5.0.0",
43
+ "@shipfox/client-shell": "5.0.0",
44
44
  "@shipfox/client-ui": "4.0.0",
45
45
  "@shipfox/react-ui": "0.3.5"
46
46
  },
package/src/feature.ts CHANGED
@@ -53,5 +53,19 @@ export const integrationsFeature = defineClientFeature({
53
53
  parent: 'workspaceLayout',
54
54
  impl: '@shipfox/client-integrations/routes/slack',
55
55
  },
56
+ {
57
+ path: '/workspaces/$wid/settings/integrations',
58
+ parent: 'workspaceSettings',
59
+ impl: '@shipfox/client-integrations/routes/integrations-settings',
60
+ },
61
+ ],
62
+ settingsSections: [
63
+ {
64
+ id: 'settings.integrations',
65
+ pathSegment: 'integrations',
66
+ label: 'Integrations',
67
+ icon: 'plugLine',
68
+ order: 700,
69
+ },
56
70
  ],
57
71
  });
@@ -33,7 +33,14 @@ import type {
33
33
  SlackCallbackResponseDto,
34
34
  } from '@shipfox/api-integration-slack-dto';
35
35
  import {apiRequest} from '@shipfox/client-api';
36
- import {useInfiniteQuery, useMutation, useQuery, useQueryClient} from '@tanstack/react-query';
36
+ import {
37
+ type FetchQueryOptions,
38
+ queryOptions,
39
+ useInfiniteQuery,
40
+ useMutation,
41
+ useQuery,
42
+ useQueryClient,
43
+ } from '@tanstack/react-query';
37
44
  import {serializeLinearCallbackQuery} from '#linear-callback.js';
38
45
  import {serializeSlackCallbackQuery} from '#slack-callback.js';
39
46
 
@@ -54,6 +61,17 @@ export const integrationsQueryKeys = {
54
61
  [...integrationsQueryKeys.all, 'repositories', connectionId, search] as const,
55
62
  };
56
63
 
64
+ type SourceConnectionsQueryKey =
65
+ | ReturnType<typeof integrationsQueryKeys.sourceConnections>
66
+ | readonly ['integrations', 'source-connections'];
67
+
68
+ type SourceConnectionsQueryOptions = FetchQueryOptions<
69
+ ListIntegrationConnectionsResponseDto,
70
+ Error,
71
+ ListIntegrationConnectionsResponseDto,
72
+ SourceConnectionsQueryKey
73
+ >;
74
+
57
75
  export async function listIntegrationProviders({
58
76
  capability,
59
77
  signal,
@@ -108,6 +126,18 @@ export async function listSourceConnections({
108
126
  };
109
127
  }
110
128
 
129
+ export function sourceConnectionsQueryOptions(
130
+ workspaceId: string | undefined,
131
+ ): SourceConnectionsQueryOptions {
132
+ return queryOptions({
133
+ queryKey: workspaceId
134
+ ? integrationsQueryKeys.sourceConnections(workspaceId)
135
+ : ([...integrationsQueryKeys.all, 'source-connections'] as const),
136
+ enabled: Boolean(workspaceId),
137
+ queryFn: ({signal}) => listSourceConnections({workspaceId: workspaceId ?? '', signal}),
138
+ });
139
+ }
140
+
111
141
  export async function createGiteaConnection(body: CreateGiteaConnectionBodyDto) {
112
142
  return await apiRequest<CreateGiteaConnectionResponseDto>('/integrations/gitea/connections', {
113
143
  method: 'POST',
@@ -228,13 +258,7 @@ export function useIntegrationProvidersQuery(params?: {capability?: IntegrationC
228
258
  }
229
259
 
230
260
  export function useSourceConnectionsQuery(workspaceId: string | undefined) {
231
- return useQuery({
232
- queryKey: workspaceId
233
- ? integrationsQueryKeys.sourceConnections(workspaceId)
234
- : [...integrationsQueryKeys.all, 'source-connections'],
235
- enabled: Boolean(workspaceId),
236
- queryFn: ({signal}) => listSourceConnections({workspaceId: workspaceId ?? '', signal}),
237
- });
261
+ return useQuery(sourceConnectionsQueryOptions(workspaceId));
238
262
  }
239
263
 
240
264
  export function useIntegrationConnectionsQuery(workspaceId: string | undefined) {
@@ -13,7 +13,7 @@ vi.mock('@shipfox/client-auth', async (importOriginal) => {
13
13
  const actual = await importOriginal<typeof import('@shipfox/client-auth')>();
14
14
  return {
15
15
  ...actual,
16
- useRefreshAuth: () => () => Promise.resolve({token: 'test-token'}),
16
+ useRefreshAuth: () => () => Promise.resolve({accessToken: 'test-token'}),
17
17
  };
18
18
  });
19
19
 
@@ -50,7 +50,8 @@ export function LinearCallbackPage() {
50
50
  key,
51
51
  async () =>
52
52
  await refreshAuth().then(
53
- async (session) => await completeLinearCallback({query: params, token: session.token}),
53
+ async (session) =>
54
+ await completeLinearCallback({query: params, token: session.accessToken}),
54
55
  ),
55
56
  );
56
57
 
@@ -13,7 +13,7 @@ vi.mock('@shipfox/client-auth', async (importOriginal) => {
13
13
  const actual = await importOriginal<typeof import('@shipfox/client-auth')>();
14
14
  return {
15
15
  ...actual,
16
- useRefreshAuth: () => () => Promise.resolve({token: 'test-token'}),
16
+ useRefreshAuth: () => () => Promise.resolve({accessToken: 'test-token'}),
17
17
  };
18
18
  });
19
19
 
@@ -108,7 +108,7 @@ export function SentryCallbackPage() {
108
108
  code: params.code,
109
109
  installation_id: params.installationId,
110
110
  },
111
- token: session.token,
111
+ token: session.accessToken,
112
112
  }),
113
113
  ),
114
114
  );
@@ -44,7 +44,8 @@ export function SlackCallbackPage() {
44
44
  key,
45
45
  async () =>
46
46
  await refreshAuth().then(
47
- async (session) => await completeSlackCallback({query: params, token: session.token}),
47
+ async (session) =>
48
+ await completeSlackCallback({query: params, token: session.accessToken}),
48
49
  ),
49
50
  );
50
51
  request.then(
@@ -48,7 +48,7 @@ function GithubCallbackRoute() {
48
48
  async () =>
49
49
  await refreshAuth().then(async (session) => {
50
50
  await apiRequest(`/integrations/github/callback/api?${key}`, {
51
- headers: {authorization: `Bearer ${session.token}`},
51
+ headers: {authorization: `Bearer ${session.accessToken}`},
52
52
  });
53
53
  }),
54
54
  );
@@ -0,0 +1,4 @@
1
+ import {defineRoute} from '@shipfox/client-shell/runtime';
2
+ import {IntegrationGallery} from '#index.js';
3
+
4
+ export default defineRoute({component: IntegrationGallery});
package/test/render.tsx CHANGED
@@ -41,11 +41,7 @@ function authState(workspaces: TestWorkspace[]): AuthState {
41
41
  user: {
42
42
  id: '22222222-2222-4222-8222-222222222222',
43
43
  email: 'user@example.com',
44
- name: null,
45
- email_verified_at: new Date().toISOString(),
46
- status: 'active',
47
- created_at: new Date().toISOString(),
48
- updated_at: new Date().toISOString(),
44
+ emailVerifiedAt: new Date().toISOString(),
49
45
  },
50
46
  workspaces,
51
47
  };