Skip to content

Commit 685c195

Browse files
committed
feat: Add endpointClientWithoutWorkspace to seam context
1 parent 28193ca commit 685c195

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
"@rxfork/r2wc-react-to-web-component": "^2.4.0",
146146
"@seamapi/fake-devicedb": "^1.6.1",
147147
"@seamapi/fake-seam-connect": "^1.76.0",
148-
"@seamapi/http": "^1.38.3",
148+
"@seamapi/http": "^1.40.0",
149149
"@seamapi/types": "^1.395.3",
150150
"@storybook/addon-designs": "^7.0.1",
151151
"@storybook/addon-essentials": "^7.0.2",

src/lib/seam/use-seam-client.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {
22
SeamHttp,
33
SeamHttpEndpoints,
4-
SeamHttpMultiWorkspace,
4+
SeamHttpEndpointsWithoutWorkspace,
5+
SeamHttpWithoutWorkspace,
56
} from '@seamapi/http/connect'
67
import { useQuery } from '@tanstack/react-query'
78
import { useEffect } from 'react'
@@ -12,7 +13,8 @@ import { useSeamQueryContext } from './SeamQueryProvider.js'
1213
export function useSeamClient(): {
1314
client: SeamHttp | null
1415
endpointClient: SeamHttpEndpoints | null
15-
clientWithoutWorkspace: SeamHttpMultiWorkspace | null
16+
clientWithoutWorkspace: SeamHttpWithoutWorkspace | null
17+
endpointClientWithoutWorkspace: SeamHttpEndpointsWithoutWorkspace | null
1618
queryKeyPrefixes: string[]
1719
isPending: boolean
1820
isError: boolean
@@ -35,7 +37,8 @@ export function useSeamClient(): {
3537
const { isPending, isError, error, data } = useQuery<{
3638
client: SeamHttp | null
3739
endpointClient: SeamHttpEndpoints | null
38-
clientWithoutWorkspace: SeamHttpMultiWorkspace | null
40+
clientWithoutWorkspace: SeamHttpWithoutWorkspace | null
41+
endpointClientWithoutWorkspace: SeamHttpEndpointsWithoutWorkspace | null
3942
}>({
4043
queryKey: [
4144
...getQueryKeyPrefixes({ queryKeyPrefix }),
@@ -54,6 +57,7 @@ export function useSeamClient(): {
5457
client,
5558
endpointClient: SeamHttpEndpoints.fromClient(client.client),
5659
clientWithoutWorkspace: null,
60+
endpointClientWithoutWorkspace: null,
5761
}
5862

5963
if (clientSessionToken != null) {
@@ -66,6 +70,7 @@ export function useSeamClient(): {
6670
client: seam,
6771
endpointClient: SeamHttpEndpoints.fromClient(seam.client),
6872
clientWithoutWorkspace: null,
73+
endpointClientWithoutWorkspace: null,
6974
}
7075
}
7176

@@ -80,18 +85,25 @@ export function useSeamClient(): {
8085
client: seam,
8186
endpointClient: SeamHttpEndpoints.fromClient(seam.client),
8287
clientWithoutWorkspace: null,
88+
endpointClientWithoutWorkspace: null,
8389
}
8490
}
8591

8692
if (consoleSessionToken != null) {
8793
const clientWithoutWorkspace =
88-
SeamHttpMultiWorkspace.fromConsoleSessionToken(consoleSessionToken)
94+
SeamHttpWithoutWorkspace.fromConsoleSessionToken(consoleSessionToken)
95+
96+
const endpointClientWithoutWorkspace =
97+
SeamHttpEndpointsWithoutWorkspace.fromClient(
98+
clientWithoutWorkspace.client
99+
)
89100

90101
if (workspaceId == null) {
91102
return {
92103
client: null,
93104
endpointClient: null,
94105
clientWithoutWorkspace,
106+
endpointClientWithoutWorkspace,
95107
}
96108
}
97109

@@ -105,6 +117,7 @@ export function useSeamClient(): {
105117
client: seam,
106118
endpointClient: SeamHttpEndpoints.fromClient(seam.client),
107119
clientWithoutWorkspace,
120+
endpointClientWithoutWorkspace,
108121
}
109122
}
110123

@@ -118,6 +131,8 @@ export function useSeamClient(): {
118131
client: data?.client ?? null,
119132
endpointClient: data?.endpointClient ?? null,
120133
clientWithoutWorkspace: data?.clientWithoutWorkspace ?? null,
134+
endpointClientWithoutWorkspace:
135+
data?.endpointClientWithoutWorkspace ?? null,
121136
queryKeyPrefixes: getQueryKeyPrefixes({
122137
queryKeyPrefix,
123138
userIdentifierKey,

0 commit comments

Comments
 (0)