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