@lunora/react 1.0.0-alpha.9 → 1.0.0-alpha.91
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/LICENSE.md +6 -0
- package/README.md +25 -18
- package/dist/index.d.mts +1157 -355
- package/dist/index.d.ts +1157 -355
- package/dist/index.mjs +1 -18
- package/dist/packem_shared/AuthLoading-dC08yqew.mjs +2 -0
- package/dist/packem_shared/LunoraProvider-DC06S-p1.mjs +2 -0
- package/dist/packem_shared/cache-C2UbTWee.mjs +1 -0
- package/dist/packem_shared/hydratePreloaded-DYvzkKqH.mjs +2 -0
- package/dist/packem_shared/lunoraQueryOptions-BVgQsR9d.mjs +1 -0
- package/dist/packem_shared/query-key-By_ZIdza.mjs +1 -0
- package/dist/packem_shared/query-options.d-CdgGQ9s4.d.mts +38 -0
- package/dist/packem_shared/query-options.d-CdgGQ9s4.d.ts +38 -0
- package/dist/packem_shared/stable-key-B_BlboiY.mjs +1 -0
- package/dist/packem_shared/stream-state-abygFxmy.mjs +1 -0
- package/dist/packem_shared/use-paginated-core-BZaJ5Xam.mjs +2 -0
- package/dist/packem_shared/useAction-CUSJu4yq.mjs +2 -0
- package/dist/packem_shared/useAgent-DtQfMu4S.mjs +2 -0
- package/dist/packem_shared/useAgentChat-g4ZNMq1B.mjs +2 -0
- package/dist/packem_shared/useAgentState-BuMYPWb2.mjs +2 -0
- package/dist/packem_shared/useAgentToolEvents-B1ItKmZi.mjs +2 -0
- package/dist/packem_shared/useAuth-x4boOoAR.mjs +2 -0
- package/dist/packem_shared/useAuthSessions-gBDeNFnd.mjs +2 -0
- package/dist/packem_shared/useAuthState-CoOG9XdT.mjs +2 -0
- package/dist/packem_shared/useClientQuery-DFs7trEf.mjs +2 -0
- package/dist/packem_shared/useConnectionStatus-XYsYGiT6.mjs +2 -0
- package/dist/packem_shared/useFlag-BDM923ke.mjs +2 -0
- package/dist/packem_shared/useHttpStream-DWtB9sAr.mjs +2 -0
- package/dist/packem_shared/useInfiniteQuery-D6zw7PwB.mjs +2 -0
- package/dist/packem_shared/useMutation-BnKec7bE.mjs +2 -0
- package/dist/packem_shared/useMutator-BtUd-xEA.mjs +2 -0
- package/dist/packem_shared/usePaginatedQuery-hCSqOGFy.mjs +2 -0
- package/dist/packem_shared/usePresence-BVjZyltT.mjs +2 -0
- package/dist/packem_shared/useQuery-DIu5vJyH.mjs +2 -0
- package/dist/packem_shared/useRateLimit-Cckxi8m9.mjs +2 -0
- package/dist/packem_shared/useStream-Cor62Cu-.mjs +2 -0
- package/dist/packem_shared/useSubscription-egFPCaGE.mjs +2 -0
- package/dist/packem_shared/useVoiceAgent-DHdUlo0G.mjs +2 -0
- package/dist/packem_shared/wire-key-p_JEwJ1j.mjs +1 -0
- package/dist/payment.d.mts +93 -0
- package/dist/payment.d.ts +93 -0
- package/dist/payment.mjs +2 -0
- package/dist/server.d.mts +47 -29
- package/dist/server.d.ts +47 -29
- package/dist/server.mjs +1 -31
- package/dist/upload.d.mts +23 -0
- package/dist/upload.d.ts +23 -0
- package/dist/upload.mjs +2 -0
- package/package.json +14 -4
- package/dist/packem_shared/AuthLoading-DtKgZT2Z.mjs +0 -33
- package/dist/packem_shared/CheckoutButton-CVSry8U1.mjs +0 -185
- package/dist/packem_shared/LunoraProvider-D38Xp16l.mjs +0 -80
- package/dist/packem_shared/cache-CAp1fVNL.mjs +0 -75
- package/dist/packem_shared/hydratePreloaded-B6OHn0eL.mjs +0 -46
- package/dist/packem_shared/lunoraQueryOptions-Cij4KWBK.mjs +0 -16
- package/dist/packem_shared/query-key-B5eRQCbR.mjs +0 -13
- package/dist/packem_shared/query-options.d-D4okOpO8.d.mts +0 -38
- package/dist/packem_shared/query-options.d-D4okOpO8.d.ts +0 -38
- package/dist/packem_shared/stable-key-CaKZv9lp.mjs +0 -30
- package/dist/packem_shared/use-paginated-core-DP72UNWn.mjs +0 -176
- package/dist/packem_shared/useAuth-CNUKtOOp.mjs +0 -129
- package/dist/packem_shared/useAuthState-BiGhtSCs.mjs +0 -36
- package/dist/packem_shared/useConnectionStatus-DRSY9ldm.mjs +0 -30
- package/dist/packem_shared/useFlag-Bg5DpkGv.mjs +0 -224
- package/dist/packem_shared/useInfiniteQuery-BBIDFXBN.mjs +0 -97
- package/dist/packem_shared/useMutation-CrvMXRsk.mjs +0 -67
- package/dist/packem_shared/useMutator-IIrLtDiM.mjs +0 -47
- package/dist/packem_shared/usePaginatedQuery-AQO3kdp1.mjs +0 -46
- package/dist/packem_shared/usePresence-D7jLuxj0.mjs +0 -108
- package/dist/packem_shared/useQuery-EB74gtBJ.mjs +0 -42
- package/dist/packem_shared/useRateLimit-DTEffQEi.mjs +0 -64
- package/dist/packem_shared/useStream-MdYnWDL_.mjs +0 -125
- package/dist/packem_shared/useSubscription-DSJuryrU.mjs +0 -139
package/LICENSE.md
CHANGED
|
@@ -103,3 +103,9 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|
|
103
103
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
104
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
105
|
specific language governing permissions and limitations under the License.
|
|
106
|
+
|
|
107
|
+
<!-- DEPENDENCIES -->
|
|
108
|
+
<!-- /DEPENDENCIES -->
|
|
109
|
+
|
|
110
|
+
<!-- TYPE_DEPENDENCIES -->
|
|
111
|
+
<!-- /TYPE_DEPENDENCIES -->
|
package/README.md
CHANGED
|
@@ -94,24 +94,31 @@ function MessageList({ room }: { room: string }) {
|
|
|
94
94
|
|
|
95
95
|
## Hooks
|
|
96
96
|
|
|
97
|
-
| Hook
|
|
98
|
-
|
|
|
99
|
-
| `useQuery(fn, args, options?)`
|
|
100
|
-
| `useMutation(fn)`
|
|
101
|
-
| `useSubscription(fn, args, options?)`
|
|
102
|
-
| `usePaginatedQuery(fn, args, { initialNumItems })`
|
|
103
|
-
| `useInfiniteQuery(fn, args, { initialNumItems })`
|
|
104
|
-
| `usePreloadedQuery(preloaded)`
|
|
105
|
-
| `usePresence({ heartbeat, listPresent,
|
|
106
|
-
| `useFlag(key, default
|
|
107
|
-
| `useFlags(defaults
|
|
108
|
-
| `useStream(fn, args, options?)`
|
|
109
|
-
| `useRateLimit(config, options?)`
|
|
110
|
-
| `useConnectionStatus()`
|
|
111
|
-
| `useAuth()`
|
|
112
|
-
| `useAuthState()`
|
|
113
|
-
|
|
114
|
-
|
|
97
|
+
| Hook | Returns | Notes |
|
|
98
|
+
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
99
|
+
| `useQuery(fn, args, options?)` | `T \| undefined` | Live query; shares one WS subscription across consumers of the same key. |
|
|
100
|
+
| `useMutation(fn)` | `{ mutate, pending, data, error, reset, withOptimisticUpdate }` | Per-call `optimistic` / `optimisticUpdate` options pass through to the client. |
|
|
101
|
+
| `useSubscription(fn, args, options?)` | `{ data, error }` | No initial fetch — only server-pushed values. |
|
|
102
|
+
| `usePaginatedQuery(fn, args, { initialNumItems, onError? })` | `{ results, status, isLoading, loadMore, error }` | Cursor-paginated feed that stays consistent under live edits. A failed tail page is dropped so `loadMore` can retry it. |
|
|
103
|
+
| `useInfiniteQuery(fn, args, { initialNumItems, onError? })` | `{ pages, status, hasNextPage, fetchNextPage, error, … }` | Page-array variant of the same paginator. |
|
|
104
|
+
| `usePreloadedQuery(preloaded, options?)` | `T` | Reads a server `Preloaded` token, then goes live. Pass `onError` to see a session expiry instead of rendering the stale SSR snapshot. |
|
|
105
|
+
| `usePresence(roomId, { heartbeat, listPresent, … })` | `{ present, sessionId, setData, error }` | Drives the `definePresence` heartbeat + list functions. `roomId` is a positional first argument, not an option. |
|
|
106
|
+
| `useFlag(key, default)` | flag value (live) | Live OpenFeature flag over the WS; reads `default` until the server answers. Evaluated under the socket's server-verified identity. |
|
|
107
|
+
| `useFlags(defaults)` | `{ [key]: value }` | Batch variant — one live value per key in the `defaults` map. |
|
|
108
|
+
| `useStream(fn, args, options?)` | `{ chunks, status, error, cancel }` | Consumes a streamed action response chunk by chunk. |
|
|
109
|
+
| `useRateLimit(config, options?)` | `{ ok, disabled, retryAfter, check, consume, reset }` | Client-side mirror of a `@lunora/ratelimit` budget for instant UX. |
|
|
110
|
+
| `useConnectionStatus()` | `ConnectionStatus` | `idle` / `connecting` / `connected` / `offline`. |
|
|
111
|
+
| `useAuth()` | `{ user, token, setToken }` | Call `setToken(jwt)` after sign-in; RPC then carries the token. |
|
|
112
|
+
| `useAuthState()` | `{ isAuthenticated, isLoading }` | Hydration-safe three-state gate. |
|
|
113
|
+
| `useAgentToolEvents({ api, threadKey, … })` | `{ events }` | One agent thread's tool lifecycle: call / result / awaiting-approval / progress. |
|
|
114
|
+
| `useVoiceAgent({ voice, threadKey, … })` | `{ status, transcript, startCall, endCall, … }` | Full-duplex voice call: mic capture, playback, live transcripts, barge-in. |
|
|
115
|
+
| `useAuthUsers` / `useAuthSessions` / `useOrganizations` / `useImpersonate` | `{ data, error, loading, hasMore, total, loadMore, refetch }` (`useImpersonate`: `{ data, error, pending, impersonate, reset }`) | Admin-plane auth reads for a console UI; each needs an admin-capable token. HTTP-only, so `refetch()` rather than a live subscription. |
|
|
116
|
+
|
|
117
|
+
`Authenticated`, `Unauthenticated`, and `AuthLoading` are gate components built on `useAuthState`.
|
|
118
|
+
|
|
119
|
+
The payment kit — `CheckoutButton`, `CustomerPortalButton`, and `useCheckout`, which wrap `@lunora/payment` flows — ships from the `@lunora/react/payment` subpath, not the package root: it renders a DOM `<button>` and navigates via `globalThis.location`, so it is the one part of this package that is browser-only (the root barrel stays renderer-agnostic, which is what lets `@lunora/react-native` re-export it wholesale).
|
|
120
|
+
|
|
121
|
+
`useVoiceAgent` opens nothing until you call `startCall()` — that is what requests the microphone, so it has to run from a user gesture; `endCall()` releases the socket, the mic tracks and the Web Audio graph, and also runs on unmount. See the [voice-agent docs](https://lunora.sh/docs/packages/react#voice-agents--usevoiceagentoptions) for the silence/barge-in thresholds.
|
|
115
122
|
|
|
116
123
|
## Server Components
|
|
117
124
|
|