@superinterface/react 5.3.1-beta.6 → 5.4.0
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 +40 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +76 -114
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +3 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +3 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -37048,14 +37048,9 @@ var import_react3 = require("react");
|
|
|
37048
37048
|
var import_lodash2 = __toESM(require("lodash"), 1);
|
|
37049
37049
|
// src/lib/misc/merge/customizer.ts
|
|
37050
37050
|
var import_lodash = __toESM(require("lodash"), 1);
|
|
37051
|
-
var customizer = function(objectValue, srcValue
|
|
37052
|
-
if (import_lodash.default.isArray(objectValue))
|
|
37053
|
-
|
|
37054
|
-
}
|
|
37055
|
-
if (srcValue && (typeof srcValue === "undefined" ? "undefined" : _type_of(srcValue)) === "object" && "current" in srcValue && typeof key2 === "string" && key2.toLowerCase().includes("ref")) {
|
|
37056
|
-
return srcValue;
|
|
37057
|
-
}
|
|
37058
|
-
return void 0;
|
|
37051
|
+
var customizer = function(objectValue, srcValue) {
|
|
37052
|
+
if (!import_lodash.default.isArray(objectValue)) return;
|
|
37053
|
+
return srcValue;
|
|
37059
37054
|
};
|
|
37060
37055
|
// src/lib/misc/merge/index.ts
|
|
37061
37056
|
var merge = function merge2(obj) {
|
|
@@ -37094,7 +37089,9 @@ var set = function(_ref) {
|
|
|
37094
37089
|
var assistantId = _ref.assistantId, threadId = _ref.threadId;
|
|
37095
37090
|
return import_js_cookie2.default.set(key({
|
|
37096
37091
|
assistantId: assistantId
|
|
37097
|
-
}), threadId
|
|
37092
|
+
}), threadId, {
|
|
37093
|
+
expires: 365
|
|
37094
|
+
});
|
|
37098
37095
|
};
|
|
37099
37096
|
// src/lib/threadIdStorage/cookieOptions/remove.ts
|
|
37100
37097
|
var import_js_cookie3 = __toESM(require("js-cookie"), 1);
|
|
@@ -37209,26 +37206,17 @@ var SuperinterfaceProvider = function(_ref) {
|
|
|
37209
37206
|
var children = _ref.children, baseUrl2 = _ref.baseUrl, variables = _ref.variables, defaultOptions = _ref.defaultOptions, threadIdStorageOptions = _ref.threadIdStorageOptions;
|
|
37210
37207
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
37211
37208
|
var createMessageAbortControllerRef = (0, import_react3.useRef)(null);
|
|
37212
|
-
var value = (
|
|
37213
|
-
|
|
37214
|
-
|
|
37215
|
-
|
|
37216
|
-
|
|
37217
|
-
|
|
37218
|
-
|
|
37219
|
-
|
|
37220
|
-
|
|
37221
|
-
|
|
37222
|
-
|
|
37223
|
-
}));
|
|
37224
|
-
}, [
|
|
37225
|
-
superinterfaceContext,
|
|
37226
|
-
baseUrl2,
|
|
37227
|
-
variables,
|
|
37228
|
-
defaultOptions,
|
|
37229
|
-
threadIdStorageOptions,
|
|
37230
|
-
createMessageAbortControllerRef
|
|
37231
|
-
]);
|
|
37209
|
+
var value = merge(superinterfaceContext, _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, baseUrl2 ? {
|
|
37210
|
+
baseUrl: baseUrl2
|
|
37211
|
+
} : {}), variables ? {
|
|
37212
|
+
variables: variables
|
|
37213
|
+
} : {}), defaultOptions ? {
|
|
37214
|
+
defaultOptions: defaultOptions
|
|
37215
|
+
} : {}), threadIdStorageOptions ? {
|
|
37216
|
+
threadIdStorageOptions: threadIdStorageOptions
|
|
37217
|
+
} : {}), {}, {
|
|
37218
|
+
createMessageAbortControllerRef: createMessageAbortControllerRef
|
|
37219
|
+
}));
|
|
37232
37220
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SuperinterfaceContext.Provider, {
|
|
37233
37221
|
value: value,
|
|
37234
37222
|
children: children
|
|
@@ -40201,14 +40189,6 @@ var mutationFn = function(_ref) {
|
|
|
40201
40189
|
case 0:
|
|
40202
40190
|
abortController = new AbortController();
|
|
40203
40191
|
superinterfaceContext.createMessageAbortControllerRef.current = abortController;
|
|
40204
|
-
_state.label = 1;
|
|
40205
|
-
case 1:
|
|
40206
|
-
_state.trys.push([
|
|
40207
|
-
1,
|
|
40208
|
-
,
|
|
40209
|
-
10,
|
|
40210
|
-
11
|
|
40211
|
-
]);
|
|
40212
40192
|
return [
|
|
40213
40193
|
4,
|
|
40214
40194
|
fetch("".concat(superinterfaceContext.baseUrl, "/messages"), {
|
|
@@ -40220,31 +40200,31 @@ var mutationFn = function(_ref) {
|
|
|
40220
40200
|
signal: abortController.signal
|
|
40221
40201
|
})
|
|
40222
40202
|
];
|
|
40223
|
-
case
|
|
40203
|
+
case 1:
|
|
40224
40204
|
response = _state.sent();
|
|
40225
40205
|
if (!(response.status !== 200)) return [
|
|
40226
40206
|
3,
|
|
40227
|
-
|
|
40207
|
+
5
|
|
40228
40208
|
];
|
|
40229
|
-
_state.label =
|
|
40230
|
-
case
|
|
40209
|
+
_state.label = 2;
|
|
40210
|
+
case 2:
|
|
40231
40211
|
_state.trys.push([
|
|
40232
|
-
|
|
40233
|
-
|
|
40212
|
+
2,
|
|
40213
|
+
4,
|
|
40234
40214
|
,
|
|
40235
|
-
|
|
40215
|
+
5
|
|
40236
40216
|
]);
|
|
40237
40217
|
return [
|
|
40238
40218
|
4,
|
|
40239
40219
|
response.json()
|
|
40240
40220
|
];
|
|
40241
|
-
case
|
|
40221
|
+
case 3:
|
|
40242
40222
|
errorResponse = _state.sent();
|
|
40243
40223
|
throw new Error(errorResponse.error);
|
|
40244
|
-
case
|
|
40224
|
+
case 4:
|
|
40245
40225
|
error = _state.sent();
|
|
40246
40226
|
throw new Error("Failed to send your message, try again. If you are the owner, check the logs.");
|
|
40247
|
-
case
|
|
40227
|
+
case 5:
|
|
40248
40228
|
if (response.body == null) {
|
|
40249
40229
|
throw new Error("The response body is empty.");
|
|
40250
40230
|
}
|
|
@@ -40260,21 +40240,21 @@ var mutationFn = function(_ref) {
|
|
|
40260
40240
|
"messages",
|
|
40261
40241
|
threadContext.variables
|
|
40262
40242
|
];
|
|
40263
|
-
_state.label =
|
|
40264
|
-
case
|
|
40243
|
+
_state.label = 6;
|
|
40244
|
+
case 6:
|
|
40265
40245
|
if (!true) return [
|
|
40266
40246
|
3,
|
|
40267
|
-
|
|
40247
|
+
8
|
|
40268
40248
|
];
|
|
40269
40249
|
return [
|
|
40270
40250
|
4,
|
|
40271
40251
|
reader.read()
|
|
40272
40252
|
];
|
|
40273
|
-
case
|
|
40253
|
+
case 7:
|
|
40274
40254
|
_$_ref = _state.sent(), done = _$_ref.done, value = _$_ref.value;
|
|
40275
40255
|
if (done) return [
|
|
40276
40256
|
3,
|
|
40277
|
-
|
|
40257
|
+
8
|
|
40278
40258
|
];
|
|
40279
40259
|
handleResponse({
|
|
40280
40260
|
value: value,
|
|
@@ -40284,19 +40264,9 @@ var mutationFn = function(_ref) {
|
|
|
40284
40264
|
});
|
|
40285
40265
|
return [
|
|
40286
40266
|
3,
|
|
40287
|
-
|
|
40288
|
-
];
|
|
40289
|
-
case 9:
|
|
40290
|
-
return [
|
|
40291
|
-
3,
|
|
40292
|
-
11
|
|
40293
|
-
];
|
|
40294
|
-
case 10:
|
|
40295
|
-
superinterfaceContext.createMessageAbortControllerRef.current = null;
|
|
40296
|
-
return [
|
|
40297
|
-
7
|
|
40267
|
+
6
|
|
40298
40268
|
];
|
|
40299
|
-
case
|
|
40269
|
+
case 8:
|
|
40300
40270
|
return [
|
|
40301
40271
|
2
|
|
40302
40272
|
];
|
|
@@ -40423,20 +40393,12 @@ var useCreateMessage = function useCreateMessage2() {
|
|
|
40423
40393
|
var queryClient = (0, import_react_query4.useQueryClient)();
|
|
40424
40394
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
40425
40395
|
var threadContext = useSuperinterfaceContext();
|
|
40426
|
-
var
|
|
40427
|
-
|
|
40428
|
-
|
|
40429
|
-
|
|
40430
|
-
|
|
40431
|
-
|
|
40432
|
-
});
|
|
40433
|
-
}, [
|
|
40434
|
-
queryClient,
|
|
40435
|
-
threadContext,
|
|
40436
|
-
superinterfaceContext,
|
|
40437
|
-
onError
|
|
40438
|
-
]);
|
|
40439
|
-
var props = (0, import_react_query4.useMutation)(options);
|
|
40396
|
+
var props = (0, import_react_query4.useMutation)(mutationOptions({
|
|
40397
|
+
queryClient: queryClient,
|
|
40398
|
+
threadContext: threadContext,
|
|
40399
|
+
superinterfaceContext: superinterfaceContext,
|
|
40400
|
+
onError: onError
|
|
40401
|
+
}));
|
|
40440
40402
|
var createMessage = (0, import_react14.useCallback)(function(variables) {
|
|
40441
40403
|
return props.mutateAsync(_objectSpread19(_objectSpread19({}, threadContext.variables), variables));
|
|
40442
40404
|
}, [
|