@superinterface/react 3.14.2 → 3.14.3

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 CHANGED
@@ -11068,7 +11068,7 @@ var useWebrtcAudioRuntime = function() {
11068
11068
  };
11069
11069
  openaiEventsDataChannel = peerConn.createDataChannel("oai-events");
11070
11070
  openaiEventsDataChannel.addEventListener("message", /* @__PURE__ */ function() {
11071
- var _ref4 = _asyncToGenerator12(function(e) {
11071
+ var _ref6 = _asyncToGenerator12(function(e) {
11072
11072
  var parsedData, searchParams, eventsResponse, reader, decoder, _ref, value, done, buffer, lines, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, line, event, ref;
11073
11073
  return _ts_generator(this, function(_state) {
11074
11074
  switch(_state.label){
@@ -11168,7 +11168,7 @@ var useWebrtcAudioRuntime = function() {
11168
11168
  });
11169
11169
  });
11170
11170
  return function(_x) {
11171
- return _ref4.apply(this, arguments);
11171
+ return _ref6.apply(this, arguments);
11172
11172
  };
11173
11173
  }());
11174
11174
  return [
@@ -11263,6 +11263,61 @@ var useWebrtcAudioRuntime = function() {
11263
11263
  });
11264
11264
  return _initRealtimeSession.apply(this, arguments);
11265
11265
  }
11266
+ var start = /* @__PURE__ */ function() {
11267
+ var _ref4 = _asyncToGenerator12(function() {
11268
+ return _ts_generator(this, function(_state) {
11269
+ switch(_state.label){
11270
+ case 0:
11271
+ return [
11272
+ 4,
11273
+ startSessionIfNeeded()
11274
+ ];
11275
+ case 1:
11276
+ _state.sent();
11277
+ setAssistantPaused(false);
11278
+ setAssistantPlaying(true);
11279
+ if (assistantAudioElRef.current) {
11280
+ assistantAudioElRef.current.play().catch(function(err_1) {
11281
+ console.error("Assistant play error:", err_1);
11282
+ });
11283
+ }
11284
+ if (localStreamRef.current) {
11285
+ localStreamRef.current.getAudioTracks().forEach(function(t_0) {
11286
+ return t_0.enabled = true;
11287
+ });
11288
+ }
11289
+ return [
11290
+ 2
11291
+ ];
11292
+ }
11293
+ });
11294
+ });
11295
+ return function start2() {
11296
+ return _ref4.apply(this, arguments);
11297
+ };
11298
+ }();
11299
+ var pause = /* @__PURE__ */ function() {
11300
+ var _ref5 = _asyncToGenerator12(function() {
11301
+ return _ts_generator(this, function(_state) {
11302
+ if (!sessionStartedRef.current) return [
11303
+ 2
11304
+ ];
11305
+ setAssistantPaused(true);
11306
+ setAssistantPlaying(false);
11307
+ if (localStreamRef.current) {
11308
+ localStreamRef.current.getAudioTracks().forEach(function(t_1) {
11309
+ return t_1.enabled = false;
11310
+ });
11311
+ }
11312
+ return [
11313
+ 2
11314
+ ];
11315
+ });
11316
+ });
11317
+ return function pause2() {
11318
+ return _ref5.apply(this, arguments);
11319
+ };
11320
+ }();
11266
11321
  return (0, import_react68.useMemo)(function() {
11267
11322
  return {
11268
11323
  webrtcAudioRuntime: {
@@ -11270,174 +11325,27 @@ var useWebrtcAudioRuntime = function() {
11270
11325
  start: function() {
11271
11326
  var _start = _asyncToGenerator12(function() {
11272
11327
  return _ts_generator(this, function(_state) {
11273
- switch(_state.label){
11274
- case 0:
11275
- return [
11276
- 4,
11277
- startSessionIfNeeded()
11278
- ];
11279
- case 1:
11280
- _state.sent();
11281
- setRecorderStatus("recording");
11282
- if (localStreamRef.current) {
11283
- localStreamRef.current.getAudioTracks().forEach(function(t_0) {
11284
- return t_0.enabled = true;
11285
- });
11286
- }
11287
- return [
11288
- 2
11289
- ];
11290
- }
11291
- });
11292
- });
11293
- function start() {
11294
- return _start.apply(this, arguments);
11295
- }
11296
- return start;
11297
- }(),
11298
- pause: function() {
11299
- var _pause = _asyncToGenerator12(function() {
11300
- return _ts_generator(this, function(_state) {
11301
- if (!sessionStartedRef.current) return [
11302
- 2
11303
- ];
11304
- setRecorderStatus("paused");
11305
- if (localStreamRef.current) {
11306
- localStreamRef.current.getAudioTracks().forEach(function(t_1) {
11307
- return t_1.enabled = false;
11308
- });
11309
- }
11310
11328
  return [
11311
11329
  2
11312
11330
  ];
11313
11331
  });
11314
11332
  });
11315
- function pause() {
11316
- return _pause.apply(this, arguments);
11317
- }
11318
- return pause;
11319
- }(),
11320
- resume: function() {
11321
- var _resume = _asyncToGenerator12(function() {
11322
- return _ts_generator(this, function(_state) {
11323
- if (!sessionStartedRef.current) return [
11324
- 2
11325
- ];
11326
- setRecorderStatus("recording");
11327
- if (localStreamRef.current) {
11328
- localStreamRef.current.getAudioTracks().forEach(function(t_2) {
11329
- return t_2.enabled = true;
11330
- });
11331
- }
11332
- return [
11333
- 2
11334
- ];
11335
- });
11336
- });
11337
- function resume() {
11338
- return _resume.apply(this, arguments);
11339
- }
11340
- return resume;
11341
- }(),
11342
- stop: function() {
11343
- var _stop = _asyncToGenerator12(function() {
11344
- return _ts_generator(this, function(_state) {
11345
- if (!sessionStartedRef.current) return [
11346
- 2
11347
- ];
11348
- setRecorderStatus("stopped");
11349
- if (localStreamRef.current) {
11350
- localStreamRef.current.getTracks().forEach(function(track) {
11351
- return track.stop();
11352
- });
11353
- }
11354
- return [
11355
- 2
11356
- ];
11357
- });
11358
- });
11359
- function stop() {
11360
- return _stop.apply(this, arguments);
11333
+ function start2() {
11334
+ return _start.apply(this, arguments);
11361
11335
  }
11362
- return stop;
11336
+ return start2;
11363
11337
  }(),
11338
+ pause: pause,
11339
+ resume: start,
11340
+ stop: pause,
11364
11341
  isPending: userIsPending,
11365
11342
  visualizationAnalyser: userAnalyserRef.current,
11366
11343
  rawStatus: recorderStatus
11367
11344
  },
11368
11345
  assistant: {
11369
- play: function() {
11370
- var _play = _asyncToGenerator12(function() {
11371
- return _ts_generator(this, function(_state) {
11372
- switch(_state.label){
11373
- case 0:
11374
- return [
11375
- 4,
11376
- startSessionIfNeeded()
11377
- ];
11378
- case 1:
11379
- _state.sent();
11380
- setAssistantPaused(false);
11381
- setAssistantPlaying(true);
11382
- if (assistantAudioElRef.current) {
11383
- assistantAudioElRef.current.play().catch(function(err_1) {
11384
- console.error("Assistant play error:", err_1);
11385
- });
11386
- }
11387
- return [
11388
- 2
11389
- ];
11390
- }
11391
- });
11392
- });
11393
- function play() {
11394
- return _play.apply(this, arguments);
11395
- }
11396
- return play;
11397
- }(),
11398
- pause: function() {
11399
- var _pause2 = _asyncToGenerator12(function() {
11400
- return _ts_generator(this, function(_state) {
11401
- if (!sessionStartedRef.current) return [
11402
- 2
11403
- ];
11404
- setAssistantPaused(true);
11405
- setAssistantPlaying(false);
11406
- if (assistantAudioElRef.current) {
11407
- assistantAudioElRef.current.pause();
11408
- }
11409
- return [
11410
- 2
11411
- ];
11412
- });
11413
- });
11414
- function pause() {
11415
- return _pause2.apply(this, arguments);
11416
- }
11417
- return pause;
11418
- }(),
11419
- stop: function() {
11420
- var _stop2 = _asyncToGenerator12(function() {
11421
- return _ts_generator(this, function(_state) {
11422
- if (!sessionStartedRef.current) return [
11423
- 2
11424
- ];
11425
- setAssistantPaused(false);
11426
- setAssistantPlaying(false);
11427
- if (assistantAudioElRef.current) {
11428
- assistantAudioElRef.current.pause();
11429
- assistantAudioElRef.current.currentTime = 0;
11430
- }
11431
- return [
11432
- 2
11433
- ];
11434
- });
11435
- });
11436
- function stop() {
11437
- return _stop2.apply(this, arguments);
11438
- }
11439
- return stop;
11440
- }(),
11346
+ play: start,
11347
+ pause: pause,
11348
+ stop: pause,
11441
11349
  visualizationAnalyser: assistantAnalyserRef.current,
11442
11350
  playing: assistantPlaying,
11443
11351
  paused: assistantPaused,