shoal-web-sdk 0.0.7 → 0.0.8

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.
@@ -0,0 +1,6 @@
1
+ export declare const useToken: () => string;
2
+ interface Props {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare const TokenProvider: React.FC<Props>;
6
+ export default TokenProvider;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useKindeBrowserClient } from '@kinde-oss/kinde-auth-nextjs';
3
+ import { createContext, useContext } from 'react';
4
+ const context = createContext(null);
5
+ export const useToken = () => {
6
+ const ctx = useContext(context);
7
+ if (ctx == null)
8
+ throw new Error("useToken must be called from within a TokenProvider");
9
+ return ctx;
10
+ };
11
+ export const TokenProvider = ({ children }) => {
12
+ const c = useKindeBrowserClient();
13
+ return (_jsx(context.Provider, { value: c.accessTokenRaw ?? "", children: children }));
14
+ };
15
+ export default TokenProvider;
@@ -1,11 +1,10 @@
1
1
  /* THIS FILE IS GENERATED - DO NOT EDIT */
2
- //@ts-expect-error
3
- import { useAccessToken } from "@/lib/hooks/auth";
4
2
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
5
3
  import { isPromise } from "../util";
4
+ import { useToken } from "../../provider/token-provider";
6
5
  import { getServiceHealth, registerAccount } from "../../sdk/sdk.gen";
7
6
  export const useGetServiceHealth = (options) => {
8
- const token = useAccessToken();
7
+ const token = useToken();
9
8
  let { enabled, ...rest } = options || { enabled: true };
10
9
  const opts = { throwOnError: true, url: "/heath" };
11
10
  const funcer = async () => {
@@ -25,7 +24,7 @@ export const useGetServiceHealth = (options) => {
25
24
  });
26
25
  };
27
26
  export const useRegisterAccount = (config) => {
28
- const token = useAccessToken();
27
+ const token = useToken();
29
28
  const queryClient = useQueryClient();
30
29
  const opts = { throwOnError: true, url: "/register" };
31
30
  const funcer = async (options) => {
package/package.json CHANGED
@@ -1,39 +1,42 @@
1
- {
2
- "name": "shoal-web-sdk",
3
- "version": "0.0.7",
4
- "main": "index.js",
5
- "scripts": {
6
- "build-hooks": "npx tsx tanstack-codegen/generator.ts",
7
- "build-sdk": "npx openapi-ts",
8
- "build-ts": "tsc",
9
- "build": "npm run build-sdk && npm run build-hooks && npm run build-ts"
10
- },
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/shoal-platform/shoal-web-sdk.git"
14
- },
15
- "keywords": [],
16
- "author": "",
17
- "license": "ISC",
18
- "bugs": {
19
- "url": "https://github.com/shoal-platform/shoal-web-sdk/issues"
20
- },
21
- "homepage": "https://github.com/shoal-platform/shoal-web-sdk#readme",
22
- "description": "",
23
- "devDependencies": {
24
- "@hey-api/openapi-ts": "0.86.11",
25
- "@types/node": "^24.10.10",
26
- "typescript": "^5.0.0"
27
- },
28
- "dependencies": {
29
- "@tanstack/react-query": "^5.90.7"
30
- },
31
- "files": [
32
- "dist/**/*"
33
- ],
34
- "exports": {
35
- "./sdk/*": "./dist/sdk/*",
36
- "./hooks": "./dist/tanstack-codegen/generated/generated.js"
37
- },
38
- "type": "module"
39
- }
1
+ {
2
+ "name": "shoal-web-sdk",
3
+ "version": "0.0.8",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "build-hooks": "npx tsx tanstack-codegen/generator.ts",
7
+ "build-sdk": "npx openapi-ts",
8
+ "build-ts": "tsc",
9
+ "build": "npm run build-sdk && npm run build-hooks && npm run build-ts"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/shoal-platform/shoal-web-sdk.git"
14
+ },
15
+ "keywords": [],
16
+ "author": "",
17
+ "license": "ISC",
18
+ "bugs": {
19
+ "url": "https://github.com/shoal-platform/shoal-web-sdk/issues"
20
+ },
21
+ "homepage": "https://github.com/shoal-platform/shoal-web-sdk#readme",
22
+ "description": "",
23
+ "devDependencies": {
24
+ "@hey-api/openapi-ts": "0.86.11",
25
+ "@types/node": "^24.10.10",
26
+ "typescript": "^5.0.0"
27
+ },
28
+ "dependencies": {
29
+ "@kinde-oss/kinde-auth-nextjs": "^2.11.0",
30
+ "@tanstack/react-query": "^5.90.7",
31
+ "@types/react": "^19.2.10",
32
+ "react": "^19.2.4"
33
+ },
34
+ "files": [
35
+ "dist/**/*"
36
+ ],
37
+ "exports": {
38
+ "./sdk/*": "./dist/sdk/*",
39
+ "./hooks": "./dist/tanstack-codegen/generated/generated.js"
40
+ },
41
+ "type": "module"
42
+ }