@solibo/solibo-react 1.9.0 → 1.9.1

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 (2) hide show
  1. package/README.md +4 -86
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,93 +1,11 @@
1
- # @solibo/solibo-query
1
+ # @solibo/solibo-react
2
2
 
3
- React Query hooks and helpers for consuming the `@solibo/solibo-sdk` in React apps.
3
+ React hooks and `SoliboProvider` for the Solibo SDK, built on TanStack Query and `@solibo/solibo-query`.
4
4
 
5
- ## Highlights
6
- - Pure TypeScript, tree-shakeable
7
- - Tiny Provider that wires tokens/baseUrl into the SDK `HomeApi`
8
- - First-class TanStack React Query (v5) support
9
- - Opinionated query keys and sample hooks for quick start
5
+ For installation, configuration, API usage, and examples, visit the [Solibo SDK documentation](https://sdk.solibo.no).
10
6
 
11
7
  ## Installation
12
8
 
13
- When working inside this repository:
14
-
15
9
  ```sh
16
- # Build the SDK JS package first (produces build/packages/js)
17
- ./gradlew :sdk:assembleJsPackage
18
-
19
- # Then build this package
20
- cd solibo-query
21
- pnpm install
22
- pnpm build
10
+ npm install @solibo/solibo-sdk @solibo/solibo-react @tanstack/react-query
23
11
  ```
24
-
25
- In a consumer project:
26
-
27
- ```sh
28
- pnpm add @tanstack/react-query @solibo/solibo-sdk @solibo/solibo-query
29
- ```
30
-
31
- ## Usage
32
-
33
- ```tsx
34
- import React from 'react'
35
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
36
- import { SoliboProvider, useSoliboApi } from '@solibo/solibo-query'
37
- import { HomeApi } from '@solibo/solibo-sdk'
38
-
39
- const qc = new QueryClient()
40
- const api = new HomeApi(/* construct via SoliboSDK or reuse from your app */) // Prefer passing an existing instance
41
-
42
- function AppContent() {
43
- const api = useSoliboApi()
44
- // use your queries here
45
- return <div>Ready</div>
46
- }
47
-
48
- export default function App() {
49
- return (
50
- <QueryClientProvider client={qc}>
51
- <SoliboProvider
52
- api={api}
53
- baseUrl={process.env.NEXT_PUBLIC_SOLIBO_BASE_URL}
54
- tokens={{ accessToken: '...', refreshToken: '...', userId: '...', clientId: '...' }}
55
- >
56
- <AppContent />
57
- </SoliboProvider>
58
- </QueryClientProvider>
59
- )
60
- }
61
- ```
62
-
63
- ## API
64
-
65
- - `SoliboProvider`: Context provider that accepts an existing `HomeApi` instance and optional `baseUrl`, `language`, and `tokens` to configure it.
66
- - `useSoliboApi()`: Access the shared `HomeApi` instance.
67
- - Domain query key objects: each domain exports a `xxxKeys` object (e.g., `issueKeys`, `companyKeys`, `invoicingKeys`) for use in custom hooks and cache invalidation.
68
-
69
- ### Query Key Pattern
70
-
71
- Query keys use a hierarchical object per domain:
72
-
73
- ```ts
74
- import { issueKeys } from '@solibo/solibo-query'
75
-
76
- // In a custom query hook
77
- queryKey: [issueKeys.list(companyId)]
78
-
79
- // In a mutation's onSuccess
80
- queryClient.invalidateQueries({ queryKey: [issueKeys.detail(issueId)] })
81
-
82
- // Invalidate the entire domain
83
- queryClient.invalidateQueries({ queryKey: [issueKeys.all] })
84
- ```
85
-
86
- ## Extending
87
- Create your hooks in `src/queries` and `src/mutations` using `@tanstack/react-query` and the `useSoliboApi()` hook.
88
-
89
-
90
- ## CI publishing
91
-
92
- On CI, this package installs the latest `@solibo/solibo-sdk` from npm and builds/publishes `@solibo/solibo-query`.
93
- The workflow is `.github/workflows/publish-solibo-query.yml` and requires the `NPM_AUTH_TOKEN` secret.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solibo/solibo-react",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "React hooks for Solibo SDK (wraps @solibo/solibo-query)",
5
5
  "homepage": "https://sdk.solibo.no",
6
6
  "repository": {
@@ -33,8 +33,8 @@
33
33
  "react": "^19.0.0"
34
34
  },
35
35
  "dependencies": {
36
- "@solibo/solibo-sdk": "1.9.0",
37
- "@solibo/solibo-query": "1.9.0"
36
+ "@solibo/solibo-sdk": "1.9.1",
37
+ "@solibo/solibo-query": "1.9.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@eslint/js": "^10.0.1",