@superinterface/react 2.0.2 → 2.0.4
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/dist/index-u67QcaWg.d.cts +11 -0
- package/dist/index-u67QcaWg.d.ts +11 -0
- package/dist/index.cjs +34 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -11
- package/dist/index.d.ts +2 -11
- package/dist/index.js +34 -18
- package/dist/index.js.map +1 -1
- package/dist/queryFns.cjs +151 -1
- package/dist/queryFns.cjs.map +1 -1
- package/dist/queryFns.d.cts +25 -1
- package/dist/queryFns.d.ts +25 -1
- package/dist/queryFns.js +143 -1
- package/dist/queryFns.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { MessagesPage, Message } from './types/index.cjs';
|
|
3
3
|
import { UseInfiniteQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/react-query';
|
|
4
|
+
export { u as useSuperinterfaceContext, u as useThreadContext } from './index-u67QcaWg.cjs';
|
|
4
5
|
import * as react from 'react';
|
|
5
6
|
import { Dispatch, SetStateAction } from 'react';
|
|
6
7
|
import * as _tanstack_query_core_build_legacy_queryClient_Ho_z40Sw from '@tanstack/query-core/build/legacy/queryClient-Ho-z40Sw';
|
|
@@ -22,16 +23,6 @@ type Args$7 = {
|
|
|
22
23
|
};
|
|
23
24
|
declare const SuperinterfaceProvider: ({ children, baseUrl, publicApiKey, variables, defaultOptions, }: Args$7) => react_jsx_runtime.JSX.Element;
|
|
24
25
|
|
|
25
|
-
declare const useSuperinterfaceContext: () => {
|
|
26
|
-
baseUrl: string | null;
|
|
27
|
-
variables: Record<string, any>;
|
|
28
|
-
defaultOptions: {
|
|
29
|
-
queries: Record<string, any>;
|
|
30
|
-
mutations: Record<string, any>;
|
|
31
|
-
};
|
|
32
|
-
publicApiKey?: string | undefined;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
26
|
type Args$6 = Args$7;
|
|
36
27
|
|
|
37
28
|
type Args$5 = Omit<Args$6, 'children'>;
|
|
@@ -1245,4 +1236,4 @@ type Args = {
|
|
|
1245
1236
|
};
|
|
1246
1237
|
declare const FunctionBase: ({ fn, runStep, title, }: Args) => react_jsx_runtime.JSX.Element;
|
|
1247
1238
|
|
|
1248
|
-
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, FunctionBase, FunctionComponentsContext, MarkdownContext, Suggestion, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, useCreateMessage, useCreateRun, useIsRunActive, useLatestMessage, useLatestRun, useLifecycle, useMarkdownContext, useMessages, useRuns
|
|
1239
|
+
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, FunctionBase, FunctionComponentsContext, MarkdownContext, Suggestion, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, useCreateMessage, useCreateRun, useIsRunActive, useLatestMessage, useLatestRun, useLifecycle, useMarkdownContext, useMessages, useRuns };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { MessagesPage, Message } from './types/index.js';
|
|
3
3
|
import { UseInfiniteQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/react-query';
|
|
4
|
+
export { u as useSuperinterfaceContext, u as useThreadContext } from './index-u67QcaWg.js';
|
|
4
5
|
import * as react from 'react';
|
|
5
6
|
import { Dispatch, SetStateAction } from 'react';
|
|
6
7
|
import * as _tanstack_query_core_build_legacy_queryClient_Ho_z40Sw from '@tanstack/query-core/build/legacy/queryClient-Ho-z40Sw';
|
|
@@ -22,16 +23,6 @@ type Args$7 = {
|
|
|
22
23
|
};
|
|
23
24
|
declare const SuperinterfaceProvider: ({ children, baseUrl, publicApiKey, variables, defaultOptions, }: Args$7) => react_jsx_runtime.JSX.Element;
|
|
24
25
|
|
|
25
|
-
declare const useSuperinterfaceContext: () => {
|
|
26
|
-
baseUrl: string | null;
|
|
27
|
-
variables: Record<string, any>;
|
|
28
|
-
defaultOptions: {
|
|
29
|
-
queries: Record<string, any>;
|
|
30
|
-
mutations: Record<string, any>;
|
|
31
|
-
};
|
|
32
|
-
publicApiKey?: string | undefined;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
26
|
type Args$6 = Args$7;
|
|
36
27
|
|
|
37
28
|
type Args$5 = Omit<Args$6, 'children'>;
|
|
@@ -1245,4 +1236,4 @@ type Args = {
|
|
|
1245
1236
|
};
|
|
1246
1237
|
declare const FunctionBase: ({ fn, runStep, title, }: Args) => react_jsx_runtime.JSX.Element;
|
|
1247
1238
|
|
|
1248
|
-
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, FunctionBase, FunctionComponentsContext, MarkdownContext, Suggestion, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, useCreateMessage, useCreateRun, useIsRunActive, useLatestMessage, useLatestRun, useLifecycle, useMarkdownContext, useMessages, useRuns
|
|
1239
|
+
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, FunctionBase, FunctionComponentsContext, MarkdownContext, Suggestion, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, useCreateMessage, useCreateRun, useIsRunActive, useLatestMessage, useLatestRun, useLifecycle, useMarkdownContext, useMessages, useRuns };
|
package/dist/index.js
CHANGED
|
@@ -405,6 +405,19 @@ var queryOptions = function(param) {
|
|
|
405
405
|
queryKey: queryKey
|
|
406
406
|
}), threadContext.defaultOptions.queries));
|
|
407
407
|
};
|
|
408
|
+
// src/lib/messages/messagesQueryOptions.ts
|
|
409
|
+
var messagesQueryOptions = function(param) {
|
|
410
|
+
var queryClient = param.queryClient, threadContext = param.threadContext, superinterfaceContext = param.superinterfaceContext;
|
|
411
|
+
return queryOptions({
|
|
412
|
+
queryKeyBase: [
|
|
413
|
+
"messages"
|
|
414
|
+
],
|
|
415
|
+
path: "/messages",
|
|
416
|
+
queryClient: queryClient,
|
|
417
|
+
threadContext: threadContext,
|
|
418
|
+
superinterfaceContext: superinterfaceContext
|
|
419
|
+
});
|
|
420
|
+
};
|
|
408
421
|
// src/hooks/messages/useMessages/index.tsx
|
|
409
422
|
var messages = function(param) {
|
|
410
423
|
var props = param.props;
|
|
@@ -417,11 +430,7 @@ var useMessages = function() {
|
|
|
417
430
|
var queryClient = useQueryClient2();
|
|
418
431
|
var threadContext = useSuperinterfaceContext();
|
|
419
432
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
420
|
-
var props = useInfiniteQuery(
|
|
421
|
-
queryKeyBase: [
|
|
422
|
-
"messages"
|
|
423
|
-
],
|
|
424
|
-
path: "/messages",
|
|
433
|
+
var props = useInfiniteQuery(messagesQueryOptions({
|
|
425
434
|
queryClient: queryClient,
|
|
426
435
|
threadContext: threadContext,
|
|
427
436
|
superinterfaceContext: superinterfaceContext
|
|
@@ -1195,6 +1204,19 @@ import { useMemo as useMemo7 } from "react";
|
|
|
1195
1204
|
// src/hooks/runs/useRuns/index.tsx
|
|
1196
1205
|
import { useMemo as useMemo6 } from "react";
|
|
1197
1206
|
import { useInfiniteQuery as useInfiniteQuery2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
1207
|
+
// src/lib/runs/runsQueryOptions.ts
|
|
1208
|
+
var runsQueryOptions = function(param) {
|
|
1209
|
+
var queryClient = param.queryClient, threadContext = param.threadContext, superinterfaceContext = param.superinterfaceContext;
|
|
1210
|
+
return queryOptions({
|
|
1211
|
+
queryKeyBase: [
|
|
1212
|
+
"runs"
|
|
1213
|
+
],
|
|
1214
|
+
path: "/runs",
|
|
1215
|
+
queryClient: queryClient,
|
|
1216
|
+
threadContext: threadContext,
|
|
1217
|
+
superinterfaceContext: superinterfaceContext
|
|
1218
|
+
});
|
|
1219
|
+
};
|
|
1198
1220
|
// src/hooks/runs/useRuns/lib/getRuns.ts
|
|
1199
1221
|
var getRuns = function(param) {
|
|
1200
1222
|
var data3 = param.data;
|
|
@@ -1208,11 +1230,7 @@ var useRuns = function() {
|
|
|
1208
1230
|
var queryClient = useQueryClient3();
|
|
1209
1231
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
1210
1232
|
var threadContext = useSuperinterfaceContext();
|
|
1211
|
-
var props = useInfiniteQuery2(
|
|
1212
|
-
queryKeyBase: [
|
|
1213
|
-
"runs"
|
|
1214
|
-
],
|
|
1215
|
-
path: "/runs",
|
|
1233
|
+
var props = useInfiniteQuery2(runsQueryOptions({
|
|
1216
1234
|
queryClient: queryClient,
|
|
1217
1235
|
threadContext: threadContext,
|
|
1218
1236
|
superinterfaceContext: superinterfaceContext
|
|
@@ -1964,8 +1982,7 @@ import { useContext as useContext7 } from "react";
|
|
|
1964
1982
|
import { createContext as createContext6 } from "react";
|
|
1965
1983
|
var MessageFormContext = createContext6({
|
|
1966
1984
|
isDisabled: false,
|
|
1967
|
-
isLoading: false
|
|
1968
|
-
submit: function() {}
|
|
1985
|
+
isLoading: false
|
|
1969
1986
|
});
|
|
1970
1987
|
// src/hooks/messages/useMessageFormContext/index.ts
|
|
1971
1988
|
var useMessageFormContext = function() {
|
|
@@ -2213,8 +2230,7 @@ var Root2 = function(param) {
|
|
|
2213
2230
|
return /* @__PURE__ */ jsx39(MessageFormContext.Provider, {
|
|
2214
2231
|
value: {
|
|
2215
2232
|
isDisabled: isDisabled,
|
|
2216
|
-
isLoading: isLoading
|
|
2217
|
-
submit: handleSubmit(onSubmit)
|
|
2233
|
+
isLoading: isLoading
|
|
2218
2234
|
},
|
|
2219
2235
|
children: /* @__PURE__ */ jsx39(FormProvider, _object_spread_props(_object_spread({}, formProps), {
|
|
2220
2236
|
children: /* @__PURE__ */ jsx39("form", {
|
|
@@ -2285,7 +2301,7 @@ var Root3 = function(param) {
|
|
|
2285
2301
|
var Control = function() {
|
|
2286
2302
|
var assistantNameContext = useContext8(AssistantNameContext);
|
|
2287
2303
|
var register = useFormContext().register;
|
|
2288
|
-
var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading
|
|
2304
|
+
var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading;
|
|
2289
2305
|
var isSubmitDisabled = useMemo10(function() {
|
|
2290
2306
|
return isDisabled || isLoading;
|
|
2291
2307
|
}, [
|
|
@@ -2311,12 +2327,12 @@ var Control = function() {
|
|
|
2311
2327
|
disabled: isDisabled,
|
|
2312
2328
|
onKeyDown: function(e) {
|
|
2313
2329
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
2330
|
+
var _e_currentTarget_form;
|
|
2314
2331
|
e.preventDefault();
|
|
2315
2332
|
if (isSubmitDisabled) return;
|
|
2316
|
-
|
|
2333
|
+
(_e_currentTarget_form = e.currentTarget.form) === null || _e_currentTarget_form === void 0 ? void 0 : _e_currentTarget_form.requestSubmit();
|
|
2317
2334
|
}
|
|
2318
|
-
}
|
|
2319
|
-
autoFocus: true
|
|
2335
|
+
}
|
|
2320
2336
|
}, textareaProps), {
|
|
2321
2337
|
ref: function(e) {
|
|
2322
2338
|
textareaProps.ref(e);
|