@superinterface/react 2.6.1 → 2.7.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.
- package/dist/index.cjs +7 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +7 -25
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +39 -20
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +39 -20
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -20,7 +20,6 @@ declare const options: {
|
|
|
20
20
|
type Args$6 = {
|
|
21
21
|
children: React.ReactNode;
|
|
22
22
|
baseUrl?: string;
|
|
23
|
-
publicApiKey?: string;
|
|
24
23
|
variables?: {
|
|
25
24
|
[key: string]: any;
|
|
26
25
|
};
|
|
@@ -30,7 +29,7 @@ type Args$6 = {
|
|
|
30
29
|
};
|
|
31
30
|
threadIdCookieOptions?: typeof options | null;
|
|
32
31
|
};
|
|
33
|
-
declare const SuperinterfaceProvider: ({ children, baseUrl,
|
|
32
|
+
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdCookieOptions, }: Args$6) => react_jsx_runtime.JSX.Element;
|
|
34
33
|
|
|
35
34
|
declare const useSuperinterfaceContext: () => {
|
|
36
35
|
baseUrl: string | null;
|
|
@@ -39,7 +38,6 @@ declare const useSuperinterfaceContext: () => {
|
|
|
39
38
|
queries: Record<string, any>;
|
|
40
39
|
mutations: Record<string, any>;
|
|
41
40
|
};
|
|
42
|
-
publicApiKey?: string | undefined;
|
|
43
41
|
threadIdCookieOptions: {
|
|
44
42
|
get: ({ assistantId, }: {
|
|
45
43
|
assistantId: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ declare const options: {
|
|
|
20
20
|
type Args$6 = {
|
|
21
21
|
children: React.ReactNode;
|
|
22
22
|
baseUrl?: string;
|
|
23
|
-
publicApiKey?: string;
|
|
24
23
|
variables?: {
|
|
25
24
|
[key: string]: any;
|
|
26
25
|
};
|
|
@@ -30,7 +29,7 @@ type Args$6 = {
|
|
|
30
29
|
};
|
|
31
30
|
threadIdCookieOptions?: typeof options | null;
|
|
32
31
|
};
|
|
33
|
-
declare const SuperinterfaceProvider: ({ children, baseUrl,
|
|
32
|
+
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdCookieOptions, }: Args$6) => react_jsx_runtime.JSX.Element;
|
|
34
33
|
|
|
35
34
|
declare const useSuperinterfaceContext: () => {
|
|
36
35
|
baseUrl: string | null;
|
|
@@ -39,7 +38,6 @@ declare const useSuperinterfaceContext: () => {
|
|
|
39
38
|
queries: Record<string, any>;
|
|
40
39
|
mutations: Record<string, any>;
|
|
41
40
|
};
|
|
42
|
-
publicApiKey?: string | undefined;
|
|
43
41
|
threadIdCookieOptions: {
|
|
44
42
|
get: ({ assistantId, }: {
|
|
45
43
|
assistantId: string;
|
package/dist/index.js
CHANGED
|
@@ -334,12 +334,10 @@ var useSuperinterfaceContext = function() {
|
|
|
334
334
|
// src/components/core/SuperinterfaceProvider/index.tsx
|
|
335
335
|
import { jsx } from "react/jsx-runtime";
|
|
336
336
|
var SuperinterfaceProvider = function(param) {
|
|
337
|
-
var children = param.children, baseUrl2 = param.baseUrl,
|
|
337
|
+
var children = param.children, baseUrl2 = param.baseUrl, variables = param.variables, defaultOptions = param.defaultOptions, threadIdCookieOptions = param.threadIdCookieOptions;
|
|
338
338
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
339
339
|
var value = merge(superinterfaceContext, _object_spread({}, baseUrl2 ? {
|
|
340
340
|
baseUrl: baseUrl2
|
|
341
|
-
} : {}, publicApiKey ? {
|
|
342
|
-
publicApiKey: publicApiKey
|
|
343
341
|
} : {}, variables ? {
|
|
344
342
|
variables: variables
|
|
345
343
|
} : {}, defaultOptions ? {
|
|
@@ -398,11 +396,7 @@ var queryOptions = function(param) {
|
|
|
398
396
|
})));
|
|
399
397
|
return [
|
|
400
398
|
2,
|
|
401
|
-
fetch("".concat(superinterfaceContext.baseUrl).concat(path, "?").concat(params)
|
|
402
|
-
headers: {
|
|
403
|
-
Authorization: "Bearer ".concat(superinterfaceContext.publicApiKey)
|
|
404
|
-
}
|
|
405
|
-
} : {})).then(function() {
|
|
399
|
+
fetch("".concat(superinterfaceContext.baseUrl).concat(path, "?").concat(params)).then(function() {
|
|
406
400
|
var _ref = _async_to_generator(function(response) {
|
|
407
401
|
var errorResponse, error;
|
|
408
402
|
return _ts_generator(this, function(_state) {
|
|
@@ -2021,17 +2015,13 @@ var mutationFn = function(param) {
|
|
|
2021
2015
|
case 0:
|
|
2022
2016
|
return [
|
|
2023
2017
|
4,
|
|
2024
|
-
fetch("".concat(superinterfaceContext.baseUrl, "/messages"),
|
|
2018
|
+
fetch("".concat(superinterfaceContext.baseUrl, "/messages"), {
|
|
2025
2019
|
method: "POST",
|
|
2026
2020
|
body: JSON.stringify(body({
|
|
2027
2021
|
variables: variables,
|
|
2028
2022
|
superinterfaceContext: superinterfaceContext
|
|
2029
2023
|
}))
|
|
2030
|
-
}
|
|
2031
|
-
headers: {
|
|
2032
|
-
Authorization: "Bearer ".concat(superinterfaceContext.publicApiKey)
|
|
2033
|
-
}
|
|
2034
|
-
} : {}))
|
|
2024
|
+
})
|
|
2035
2025
|
];
|
|
2036
2026
|
case 1:
|
|
2037
2027
|
response = _state.sent();
|
|
@@ -3015,10 +3005,8 @@ var useMessageAudio = function(param) {
|
|
|
3015
3005
|
});
|
|
3016
3006
|
var searchParams = new URLSearchParams(_object_spread({
|
|
3017
3007
|
input: firstUnplayedMessageSentence.sentence
|
|
3018
|
-
},
|
|
3019
|
-
|
|
3020
|
-
} : {}));
|
|
3021
|
-
audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/tts?").concat(searchParams), _object_spread({
|
|
3008
|
+
}, superinterfaceContext.variables));
|
|
3009
|
+
audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/tts?").concat(searchParams), {
|
|
3022
3010
|
format: "mp3",
|
|
3023
3011
|
autoplay: true,
|
|
3024
3012
|
html5: isHtmlAudioSupported,
|
|
@@ -3028,13 +3016,7 @@ var useMessageAudio = function(param) {
|
|
|
3028
3016
|
onEnd();
|
|
3029
3017
|
}
|
|
3030
3018
|
}
|
|
3031
|
-
}
|
|
3032
|
-
xhr: _object_spread({}, superinterfaceContext.publicApiKey ? {
|
|
3033
|
-
headers: {
|
|
3034
|
-
Authorization: "Bearer ".concat(superinterfaceContext.publicApiKey)
|
|
3035
|
-
}
|
|
3036
|
-
} : {})
|
|
3037
|
-
}));
|
|
3019
|
+
});
|
|
3038
3020
|
}, [
|
|
3039
3021
|
unplayedMessageSentences,
|
|
3040
3022
|
isPlaying,
|