@lunora/react 1.0.0-alpha.26 → 1.0.0-alpha.261

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 (80) hide show
  1. package/README.md +28 -18
  2. package/dist/index.d.mts +1036 -583
  3. package/dist/index.d.ts +1036 -583
  4. package/dist/index.mjs +1 -25
  5. package/dist/packem_shared/AuthLoading-BNDsvgQ4.mjs +2 -0
  6. package/dist/packem_shared/LunoraProvider-B5zAiX86.mjs +1 -0
  7. package/dist/packem_shared/hydratePreloaded-B6d3r_u1.mjs +2 -0
  8. package/dist/packem_shared/lunora-provider-CW9Gd-pp.mjs +2 -0
  9. package/dist/packem_shared/lunoraQueryOptions-IJB_aFzi.mjs +1 -0
  10. package/dist/packem_shared/query-core-CqnQ_-E5.mjs +2 -0
  11. package/dist/packem_shared/query-key-BysXrewF.mjs +1 -0
  12. package/dist/packem_shared/query-options.d-CdgGQ9s4.d.mts +38 -0
  13. package/dist/packem_shared/query-options.d-CdgGQ9s4.d.ts +38 -0
  14. package/dist/packem_shared/stream-state-abygFxmy.mjs +1 -0
  15. package/dist/packem_shared/use-paginated-core-D9QnfDFs.mjs +2 -0
  16. package/dist/packem_shared/useAction-DnbG-lGf.mjs +2 -0
  17. package/dist/packem_shared/useAgent-C4XTDKr3.mjs +2 -0
  18. package/dist/packem_shared/useAgentApprovals-DIrIfUkR.mjs +2 -0
  19. package/dist/packem_shared/useAgentChat-DgdA3BU5.mjs +2 -0
  20. package/dist/packem_shared/useAgentState-CZkoGPL4.mjs +2 -0
  21. package/dist/packem_shared/useAgentToolEvents-BrIFgqyT.mjs +2 -0
  22. package/dist/packem_shared/useAuth-Do03WzEi.mjs +2 -0
  23. package/dist/packem_shared/useAuthSessions-BYqSu44Q.mjs +2 -0
  24. package/dist/packem_shared/useAuthState-CR-hIsvP.mjs +2 -0
  25. package/dist/packem_shared/useClientQuery-47csppXE.mjs +2 -0
  26. package/dist/packem_shared/useConnectionStatus-B4A2Vw8x.mjs +2 -0
  27. package/dist/packem_shared/useFlag-DhCr93VG.mjs +2 -0
  28. package/dist/packem_shared/useHttpStream-D0biamGu.mjs +2 -0
  29. package/dist/packem_shared/useInfiniteQuery-C6B9M0s9.mjs +2 -0
  30. package/dist/packem_shared/useLiveTopic-COTTJo8q.mjs +2 -0
  31. package/dist/packem_shared/useMutation-DmI3aZBl.mjs +2 -0
  32. package/dist/packem_shared/useMutator-BtUd-xEA.mjs +2 -0
  33. package/dist/packem_shared/usePaginatedQuery-CK5xnM3r.mjs +2 -0
  34. package/dist/packem_shared/usePresence-Bgw_pYzz.mjs +2 -0
  35. package/dist/packem_shared/useQuery-CHjpBW-E.mjs +2 -0
  36. package/dist/packem_shared/useRateLimit-Cckxi8m9.mjs +2 -0
  37. package/dist/packem_shared/useStream-De5SDR6Y.mjs +2 -0
  38. package/dist/packem_shared/useSubscription-CC39EoMT.mjs +2 -0
  39. package/dist/packem_shared/useSuspenseQuery-ZsmWeJKm.mjs +2 -0
  40. package/dist/packem_shared/useVoiceAgent-TyztaWYJ.mjs +2 -0
  41. package/dist/payment.d.mts +107 -0
  42. package/dist/payment.d.ts +107 -0
  43. package/dist/payment.mjs +2 -0
  44. package/dist/server.d.mts +47 -29
  45. package/dist/server.d.ts +47 -29
  46. package/dist/server.mjs +1 -31
  47. package/dist/upload.d.mts +24 -0
  48. package/dist/upload.d.ts +24 -0
  49. package/dist/upload.mjs +2 -0
  50. package/package.json +14 -4
  51. package/dist/packem_shared/AuthLoading-DezUWNB2.mjs +0 -33
  52. package/dist/packem_shared/CheckoutButton-DUite8jJ.mjs +0 -189
  53. package/dist/packem_shared/LunoraProvider-BsuiW4Lk.mjs +0 -81
  54. package/dist/packem_shared/cache-D1O_xfAe.mjs +0 -80
  55. package/dist/packem_shared/hydratePreloaded-uMDH_xA9.mjs +0 -54
  56. package/dist/packem_shared/lunoraQueryOptions-C3uwOTMW.mjs +0 -16
  57. package/dist/packem_shared/query-key-BmCbgidV.mjs +0 -13
  58. package/dist/packem_shared/query-options.d-D4okOpO8.d.mts +0 -38
  59. package/dist/packem_shared/query-options.d-D4okOpO8.d.ts +0 -38
  60. package/dist/packem_shared/stable-key-CGp4e2Ux.mjs +0 -38
  61. package/dist/packem_shared/use-paginated-core-DafedU4l.mjs +0 -179
  62. package/dist/packem_shared/useAgent-DwLxTc3P.mjs +0 -101
  63. package/dist/packem_shared/useAgentChat-WPm5iHgR.mjs +0 -283
  64. package/dist/packem_shared/useAgentState-Cikdlomg.mjs +0 -37
  65. package/dist/packem_shared/useAgentToolEvents-BM7ERo00.mjs +0 -129
  66. package/dist/packem_shared/useAuth-BSutjJaa.mjs +0 -129
  67. package/dist/packem_shared/useAuthState-CyF35qZR.mjs +0 -36
  68. package/dist/packem_shared/useClientQuery-CN1sC3cP.mjs +0 -56
  69. package/dist/packem_shared/useConnectionStatus-PJ7vyCHy.mjs +0 -30
  70. package/dist/packem_shared/useFlag-C2Pkghli.mjs +0 -128
  71. package/dist/packem_shared/useInfiniteQuery-BeaehE9f.mjs +0 -97
  72. package/dist/packem_shared/useMutation-BeqeIjTr.mjs +0 -67
  73. package/dist/packem_shared/useMutator-IIrLtDiM.mjs +0 -47
  74. package/dist/packem_shared/usePaginatedQuery-_6ETVUmf.mjs +0 -46
  75. package/dist/packem_shared/usePresence-Rnx1Fznc.mjs +0 -115
  76. package/dist/packem_shared/useQuery-C-hDzP-t.mjs +0 -77
  77. package/dist/packem_shared/useRateLimit-DTEffQEi.mjs +0 -64
  78. package/dist/packem_shared/useStream-CGC26afa.mjs +0 -128
  79. package/dist/packem_shared/useSubscription-D38Jdyr8.mjs +0 -139
  80. package/dist/packem_shared/useVoiceAgent-sC5_ADB8.mjs +0 -416
@@ -1,283 +0,0 @@
1
- 'use client';
2
- import { c } from 'react/compiler-runtime';
3
- import { useState, useRef } from 'react';
4
- import { useMutation } from './useMutation-BeqeIjTr.mjs';
5
- import { useStream } from './useStream-CGC26afa.mjs';
6
- import useSubscription from './useSubscription-D38Jdyr8.mjs';
7
-
8
- const NO_MUTATION_REF = {
9
- __lunoraRef: ""
10
- };
11
- const NO_STREAM_REF = {
12
- __lunoraRef: ""
13
- };
14
- const EMPTY_MESSAGES = [];
15
- const reconcileOptimistic = (optimistic, durable) => {
16
- const pool = durable.filter((message) => message.role === "user").map((message) => message.content);
17
- return optimistic.filter((pending) => {
18
- const index = pool.indexOf(pending.content);
19
- if (index !== -1) {
20
- pool.splice(index, 1);
21
- return false;
22
- }
23
- return true;
24
- });
25
- };
26
- const useAgentChat = (options) => {
27
- const $ = c(47);
28
- const {
29
- api,
30
- cancel: cancelReference,
31
- limit,
32
- send: sendReference,
33
- sendArgs,
34
- stream: streamReference,
35
- threadKey
36
- } = options;
37
- let t0;
38
- if ($[0] !== limit || $[1] !== threadKey) {
39
- t0 = limit === void 0 ? {
40
- key: threadKey
41
- } : {
42
- key: threadKey,
43
- limit
44
- };
45
- $[0] = limit;
46
- $[1] = threadKey;
47
- $[2] = t0;
48
- } else {
49
- t0 = $[2];
50
- }
51
- const messagesArguments = t0;
52
- const {
53
- data: history
54
- } = useSubscription(api.agents.agentMessages, messagesArguments);
55
- let t1;
56
- if ($[3] !== threadKey) {
57
- t1 = {
58
- key: threadKey
59
- };
60
- $[3] = threadKey;
61
- $[4] = t1;
62
- } else {
63
- t1 = $[4];
64
- }
65
- const {
66
- data: threadData
67
- } = useSubscription(api.agents.agentThread, t1);
68
- let t2;
69
- if ($[5] !== streamReference || $[6] !== threadKey) {
70
- t2 = streamReference === void 0 ? "skip" : {
71
- key: threadKey
72
- };
73
- $[5] = streamReference;
74
- $[6] = threadKey;
75
- $[7] = t2;
76
- } else {
77
- t2 = $[7];
78
- }
79
- const streamArguments = t2;
80
- const {
81
- chunks
82
- } = useStream(streamReference ?? NO_STREAM_REF, streamArguments);
83
- const sendMutation = useMutation(sendReference);
84
- const cancelMutation = useMutation(cancelReference ?? NO_MUTATION_REF);
85
- const approvalMutation = useMutation(api.agents.agentResolveApproval);
86
- let t3;
87
- if ($[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
88
- t3 = [];
89
- $[8] = t3;
90
- } else {
91
- t3 = $[8];
92
- }
93
- const [optimistic, setOptimistic] = useState(t3);
94
- const nextIdRef = useRef(0);
95
- const thread = threadData;
96
- const status = thread?.status;
97
- const instanceId = thread?.instanceId;
98
- const durable = history ?? EMPTY_MESSAGES;
99
- let t4;
100
- if ($[9] !== durable || $[10] !== optimistic) {
101
- const visibleOptimistic = reconcileOptimistic(optimistic, durable);
102
- t4 = visibleOptimistic.length === 0 ? durable : [...durable, ...visibleOptimistic.map((pending, index) => ({
103
- content: pending.content,
104
- optimistic: true,
105
- role: "user",
106
- seq: durable.length + index
107
- }))];
108
- $[9] = durable;
109
- $[10] = optimistic;
110
- $[11] = t4;
111
- } else {
112
- t4 = $[11];
113
- }
114
- const messages = t4;
115
- let t5;
116
- if ($[12] !== durable) {
117
- t5 = durable.filter(_temp);
118
- $[12] = durable;
119
- $[13] = t5;
120
- } else {
121
- t5 = $[13];
122
- }
123
- const assistantCount = t5.length;
124
- let t6;
125
- if ($[14] !== assistantCount || $[15] !== chunks || $[16] !== threadKey) {
126
- let t72;
127
- if ($[18] !== assistantCount || $[19] !== threadKey) {
128
- t72 = (event) => event.kind !== "progress" && event.threadKey === threadKey && event.turn >= assistantCount;
129
- $[18] = assistantCount;
130
- $[19] = threadKey;
131
- $[20] = t72;
132
- } else {
133
- t72 = $[20];
134
- }
135
- t6 = chunks.filter(t72).map(_temp2).join("");
136
- $[14] = assistantCount;
137
- $[15] = chunks;
138
- $[16] = threadKey;
139
- $[17] = t6;
140
- } else {
141
- t6 = $[17];
142
- }
143
- const streamingText = t6;
144
- const {
145
- mutate: sendMutate
146
- } = sendMutation;
147
- const {
148
- mutate: cancelMutate
149
- } = cancelMutation;
150
- const {
151
- mutate: resolveMutate
152
- } = approvalMutation;
153
- let t7;
154
- if ($[21] !== durable || $[22] !== sendArgs || $[23] !== sendMutate || $[24] !== threadKey) {
155
- t7 = async (input, args) => {
156
- const id = nextIdRef.current;
157
- nextIdRef.current = nextIdRef.current + 1;
158
- setOptimistic((previous) => [...reconcileOptimistic(previous, durable), {
159
- content: input,
160
- id
161
- }]);
162
- try {
163
- await sendMutate({
164
- input,
165
- threadKey,
166
- ...sendArgs,
167
- ...args
168
- });
169
- } catch (t82) {
170
- const error = t82;
171
- setOptimistic((previous_0) => previous_0.filter((pending_0) => pending_0.id !== id));
172
- throw error;
173
- }
174
- };
175
- $[21] = durable;
176
- $[22] = sendArgs;
177
- $[23] = sendMutate;
178
- $[24] = threadKey;
179
- $[25] = t7;
180
- } else {
181
- t7 = $[25];
182
- }
183
- const send = t7;
184
- let t8;
185
- if ($[26] !== instanceId || $[27] !== resolveMutate || $[28] !== threadKey) {
186
- t8 = async (toolCallId, note) => {
187
- if (instanceId === void 0) {
188
- throw new Error("useAgentChat: cannot approve — no in-flight run (thread has no instanceId)");
189
- }
190
- await resolveMutate({
191
- decision: "approve",
192
- instanceId,
193
- threadKey,
194
- toolCallId,
195
- ...note === void 0 ? {} : {
196
- note
197
- }
198
- });
199
- };
200
- $[26] = instanceId;
201
- $[27] = resolveMutate;
202
- $[28] = threadKey;
203
- $[29] = t8;
204
- } else {
205
- t8 = $[29];
206
- }
207
- const approve = t8;
208
- let t9;
209
- if ($[30] !== instanceId || $[31] !== resolveMutate || $[32] !== threadKey) {
210
- t9 = async (toolCallId_0, note_0) => {
211
- if (instanceId === void 0) {
212
- throw new Error("useAgentChat: cannot reject — no in-flight run (thread has no instanceId)");
213
- }
214
- await resolveMutate({
215
- decision: "reject",
216
- instanceId,
217
- threadKey,
218
- toolCallId: toolCallId_0,
219
- ...note_0 === void 0 ? {} : {
220
- note: note_0
221
- }
222
- });
223
- };
224
- $[30] = instanceId;
225
- $[31] = resolveMutate;
226
- $[32] = threadKey;
227
- $[33] = t9;
228
- } else {
229
- t9 = $[33];
230
- }
231
- const reject = t9;
232
- let t10;
233
- if ($[34] !== cancelMutate || $[35] !== cancelReference || $[36] !== instanceId || $[37] !== threadKey) {
234
- t10 = async () => {
235
- if (cancelReference === void 0 || instanceId === void 0) {
236
- return;
237
- }
238
- await cancelMutate({
239
- instanceId,
240
- threadKey
241
- });
242
- };
243
- $[34] = cancelMutate;
244
- $[35] = cancelReference;
245
- $[36] = instanceId;
246
- $[37] = threadKey;
247
- $[38] = t10;
248
- } else {
249
- t10 = $[38];
250
- }
251
- const cancel = t10;
252
- let t11;
253
- if ($[39] !== approve || $[40] !== cancel || $[41] !== messages || $[42] !== reject || $[43] !== send || $[44] !== status || $[45] !== streamingText) {
254
- t11 = {
255
- approve,
256
- cancel,
257
- messages,
258
- reject,
259
- send,
260
- status,
261
- streamingText
262
- };
263
- $[39] = approve;
264
- $[40] = cancel;
265
- $[41] = messages;
266
- $[42] = reject;
267
- $[43] = send;
268
- $[44] = status;
269
- $[45] = streamingText;
270
- $[46] = t11;
271
- } else {
272
- t11 = $[46];
273
- }
274
- return t11;
275
- };
276
- function _temp(message) {
277
- return message.role === "assistant";
278
- }
279
- function _temp2(delta) {
280
- return delta.text;
281
- }
282
-
283
- export { useAgentChat };
@@ -1,37 +0,0 @@
1
- 'use client';
2
- import { c } from 'react/compiler-runtime';
3
- import useSubscription from './useSubscription-D38Jdyr8.mjs';
4
-
5
- const useAgentState = (options) => {
6
- const $ = c(5);
7
- let t0;
8
- if ($[0] !== options.threadKey) {
9
- t0 = {
10
- key: options.threadKey
11
- };
12
- $[0] = options.threadKey;
13
- $[1] = t0;
14
- } else {
15
- t0 = $[1];
16
- }
17
- const {
18
- data,
19
- error
20
- } = useSubscription(options.api.agents.agentState, t0);
21
- const t1 = data;
22
- let t2;
23
- if ($[2] !== error || $[3] !== t1) {
24
- t2 = {
25
- error,
26
- state: t1
27
- };
28
- $[2] = error;
29
- $[3] = t1;
30
- $[4] = t2;
31
- } else {
32
- t2 = $[4];
33
- }
34
- return t2;
35
- };
36
-
37
- export { useAgentState };
@@ -1,129 +0,0 @@
1
- 'use client';
2
- import { c } from 'react/compiler-runtime';
3
- import { useStream } from './useStream-CGC26afa.mjs';
4
- import useSubscription from './useSubscription-D38Jdyr8.mjs';
5
-
6
- const NO_STREAM_REF = {
7
- __lunoraRef: ""
8
- };
9
- const EMPTY_MESSAGES = [];
10
- const toDurableEvent = (message) => {
11
- if (message.role === "assistant" && message.toolCalls) {
12
- return message.toolCalls.map((call) => {
13
- return {
14
- input: call.input,
15
- seq: message.seq,
16
- toolCallId: call.id,
17
- toolName: call.name,
18
- type: "call"
19
- };
20
- });
21
- }
22
- if (message.role !== "tool") {
23
- return void 0;
24
- }
25
- if (message.status === "awaiting_approval") {
26
- return [{
27
- seq: message.seq,
28
- type: "awaiting-approval",
29
- ...message.toolCallId === void 0 ? {} : {
30
- toolCallId: message.toolCallId
31
- },
32
- ...message.toolName === void 0 ? {} : {
33
- toolName: message.toolName
34
- }
35
- }];
36
- }
37
- return [{
38
- output: message.content,
39
- seq: message.seq,
40
- type: "result",
41
- ...message.status === "approved" || message.status === "rejected" ? {
42
- status: message.status
43
- } : {},
44
- ...message.toolCallId === void 0 ? {} : {
45
- toolCallId: message.toolCallId
46
- },
47
- ...message.toolName === void 0 ? {} : {
48
- toolName: message.toolName
49
- }
50
- }];
51
- };
52
- const useAgentToolEvents = (options) => {
53
- const $ = c(12);
54
- const {
55
- api,
56
- limit,
57
- stream: streamReference,
58
- threadKey
59
- } = options;
60
- let t0;
61
- if ($[0] !== limit || $[1] !== threadKey) {
62
- t0 = limit === void 0 ? {
63
- key: threadKey
64
- } : {
65
- key: threadKey,
66
- limit
67
- };
68
- $[0] = limit;
69
- $[1] = threadKey;
70
- $[2] = t0;
71
- } else {
72
- t0 = $[2];
73
- }
74
- const messagesArguments = t0;
75
- const {
76
- data: history
77
- } = useSubscription(api.agents.agentMessages, messagesArguments);
78
- let t1;
79
- if ($[3] !== streamReference || $[4] !== threadKey) {
80
- t1 = streamReference === void 0 ? "skip" : {
81
- key: threadKey
82
- };
83
- $[3] = streamReference;
84
- $[4] = threadKey;
85
- $[5] = t1;
86
- } else {
87
- t1 = $[5];
88
- }
89
- const streamArguments = t1;
90
- const {
91
- chunks
92
- } = useStream(streamReference ?? NO_STREAM_REF, streamArguments);
93
- const durable = history ?? EMPTY_MESSAGES;
94
- let events;
95
- if ($[6] !== chunks || $[7] !== durable || $[8] !== threadKey) {
96
- events = durable.flatMap(_temp);
97
- for (const event of chunks) {
98
- if (event.kind === "progress" && event.threadKey === threadKey) {
99
- events.push({
100
- data: event.data,
101
- toolCallId: event.toolCallId,
102
- type: "progress"
103
- });
104
- }
105
- }
106
- $[6] = chunks;
107
- $[7] = durable;
108
- $[8] = threadKey;
109
- $[9] = events;
110
- } else {
111
- events = $[9];
112
- }
113
- let t2;
114
- if ($[10] !== events) {
115
- t2 = {
116
- events
117
- };
118
- $[10] = events;
119
- $[11] = t2;
120
- } else {
121
- t2 = $[11];
122
- }
123
- return t2;
124
- };
125
- function _temp(message) {
126
- return toDurableEvent(message) ?? [];
127
- }
128
-
129
- export { useAgentToolEvents };
@@ -1,129 +0,0 @@
1
- 'use client';
2
- import { c } from 'react/compiler-runtime';
3
- import { useSyncExternalStore } from 'react';
4
- import { useLunora } from './LunoraProvider-BsuiW4Lk.mjs';
5
-
6
- const stores = /* @__PURE__ */ new WeakMap();
7
- const createStore = (client) => {
8
- const listeners = /* @__PURE__ */ new Set();
9
- let user = null;
10
- const notify = () => {
11
- for (const listener of listeners) {
12
- listener();
13
- }
14
- };
15
- let generation = 0;
16
- const setUser = (next) => {
17
- if (user !== next) {
18
- user = next;
19
- notify();
20
- }
21
- };
22
- const refresh = () => {
23
- generation += 1;
24
- const current = generation;
25
- if (client.getAuthToken() === null) {
26
- setUser(null);
27
- return;
28
- }
29
- client.getCurrentUser().then((next) => {
30
- if (current === generation) {
31
- setUser(next);
32
- }
33
- return void 0;
34
- }).catch(() => {
35
- if (current === generation) {
36
- setUser(null);
37
- }
38
- });
39
- };
40
- let unsubscribeToken;
41
- return {
42
- getSnapshot: () => user,
43
- subscribe: (onChange) => {
44
- const firstSubscriber = listeners.size === 0;
45
- listeners.add(onChange);
46
- if (firstSubscriber) {
47
- unsubscribeToken = client.onAuthTokenChange(refresh);
48
- refresh();
49
- }
50
- return () => {
51
- listeners.delete(onChange);
52
- if (listeners.size === 0) {
53
- unsubscribeToken?.();
54
- unsubscribeToken = void 0;
55
- }
56
- };
57
- }
58
- };
59
- };
60
- const getStore = (client) => {
61
- let store = stores.get(client);
62
- if (!store) {
63
- store = createStore(client);
64
- stores.set(client, store);
65
- }
66
- return store;
67
- };
68
- const useAuth = () => {
69
- const $ = c(12);
70
- const client = useLunora();
71
- let t0;
72
- if ($[0] !== client) {
73
- t0 = getStore(client);
74
- $[0] = client;
75
- $[1] = t0;
76
- } else {
77
- t0 = $[1];
78
- }
79
- const store = t0;
80
- let t1;
81
- let t2;
82
- let t3;
83
- if ($[2] !== client) {
84
- t1 = (onChange) => client.onAuthTokenChange(onChange);
85
- t2 = () => client.getAuthToken();
86
- t3 = () => client.getAuthToken();
87
- $[2] = client;
88
- $[3] = t1;
89
- $[4] = t2;
90
- $[5] = t3;
91
- } else {
92
- t1 = $[3];
93
- t2 = $[4];
94
- t3 = $[5];
95
- }
96
- const token = useSyncExternalStore(t1, t2, t3);
97
- const user = useSyncExternalStore(store.subscribe, store.getSnapshot, _temp);
98
- let t4;
99
- if ($[6] !== client) {
100
- t4 = (next) => {
101
- client.setAuthToken(next);
102
- };
103
- $[6] = client;
104
- $[7] = t4;
105
- } else {
106
- t4 = $[7];
107
- }
108
- const setToken = t4;
109
- let t5;
110
- if ($[8] !== setToken || $[9] !== token || $[10] !== user) {
111
- t5 = {
112
- setToken,
113
- token,
114
- user
115
- };
116
- $[8] = setToken;
117
- $[9] = token;
118
- $[10] = user;
119
- $[11] = t5;
120
- } else {
121
- t5 = $[11];
122
- }
123
- return t5;
124
- };
125
- function _temp() {
126
- return null;
127
- }
128
-
129
- export { useAuth as default };
@@ -1,36 +0,0 @@
1
- 'use client';
2
- import { c } from 'react/compiler-runtime';
3
- import { useSyncExternalStore } from 'react';
4
- import useAuth from './useAuth-BSutjJaa.mjs';
5
-
6
- const subscribe = () => () => void 0;
7
- const useAuthState = () => {
8
- const $ = c(3);
9
- const {
10
- token
11
- } = useAuth();
12
- const hydrated = useSyncExternalStore(subscribe, _temp, _temp2);
13
- const t0 = hydrated && token !== null;
14
- const t1 = !hydrated;
15
- let t2;
16
- if ($[0] !== t0 || $[1] !== t1) {
17
- t2 = {
18
- isAuthenticated: t0,
19
- isLoading: t1
20
- };
21
- $[0] = t0;
22
- $[1] = t1;
23
- $[2] = t2;
24
- } else {
25
- t2 = $[2];
26
- }
27
- return t2;
28
- };
29
- function _temp() {
30
- return true;
31
- }
32
- function _temp2() {
33
- return false;
34
- }
35
-
36
- export { useAuthState };
@@ -1,56 +0,0 @@
1
- 'use client';
2
- import { c } from 'react/compiler-runtime';
3
- import { useSyncExternalStore } from 'react';
4
- import { useLunora } from './LunoraProvider-BsuiW4Lk.mjs';
5
-
6
- const useClientQuery = (ref) => {
7
- const $ = c(11);
8
- const client = useLunora();
9
- let t0;
10
- let t1;
11
- let t2;
12
- if ($[0] !== client || $[1] !== ref) {
13
- t0 = (onStoreChange) => {
14
- const unsubscribe = client.subscribeClientQuery(ref, () => {
15
- onStoreChange();
16
- });
17
- return unsubscribe;
18
- };
19
- t1 = () => client.getClientQuery(ref);
20
- t2 = () => client.getClientQuery(ref);
21
- $[0] = client;
22
- $[1] = ref;
23
- $[2] = t0;
24
- $[3] = t1;
25
- $[4] = t2;
26
- } else {
27
- t0 = $[2];
28
- t1 = $[3];
29
- t2 = $[4];
30
- }
31
- const value = useSyncExternalStore(t0, t1, t2);
32
- let t3;
33
- if ($[5] !== client || $[6] !== ref) {
34
- t3 = (next) => {
35
- client.setClientQuery(ref, next);
36
- };
37
- $[5] = client;
38
- $[6] = ref;
39
- $[7] = t3;
40
- } else {
41
- t3 = $[7];
42
- }
43
- const setter = t3;
44
- let t4;
45
- if ($[8] !== setter || $[9] !== value) {
46
- t4 = [value, setter];
47
- $[8] = setter;
48
- $[9] = value;
49
- $[10] = t4;
50
- } else {
51
- t4 = $[10];
52
- }
53
- return t4;
54
- };
55
-
56
- export { useClientQuery as default };
@@ -1,30 +0,0 @@
1
- 'use client';
2
- import { c } from 'react/compiler-runtime';
3
- import { useSyncExternalStore } from 'react';
4
- import { useLunora } from './LunoraProvider-BsuiW4Lk.mjs';
5
-
6
- const useConnectionStatus = () => {
7
- const $ = c(4);
8
- const client = useLunora();
9
- let t0;
10
- let t1;
11
- let t2;
12
- if ($[0] !== client) {
13
- t0 = (onChange) => client.onConnectionStatus(() => {
14
- onChange();
15
- });
16
- t1 = () => client.connectionStatus();
17
- t2 = () => client.connectionStatus();
18
- $[0] = client;
19
- $[1] = t0;
20
- $[2] = t1;
21
- $[3] = t2;
22
- } else {
23
- t0 = $[1];
24
- t1 = $[2];
25
- t2 = $[3];
26
- }
27
- return useSyncExternalStore(t0, t1, t2);
28
- };
29
-
30
- export { useConnectionStatus as default };