@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.js CHANGED
@@ -10897,7 +10897,7 @@ var useWebrtcAudioRuntime = function() {
10897
10897
  };
10898
10898
  openaiEventsDataChannel = peerConn.createDataChannel("oai-events");
10899
10899
  openaiEventsDataChannel.addEventListener("message", /* @__PURE__ */ function() {
10900
- var _ref4 = _asyncToGenerator12(function(e) {
10900
+ var _ref6 = _asyncToGenerator12(function(e) {
10901
10901
  var parsedData, searchParams, eventsResponse, reader, decoder, _ref, value, done, buffer, lines, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, line, event, ref;
10902
10902
  return _ts_generator(this, function(_state) {
10903
10903
  switch(_state.label){
@@ -10997,7 +10997,7 @@ var useWebrtcAudioRuntime = function() {
10997
10997
  });
10998
10998
  });
10999
10999
  return function(_x) {
11000
- return _ref4.apply(this, arguments);
11000
+ return _ref6.apply(this, arguments);
11001
11001
  };
11002
11002
  }());
11003
11003
  return [
@@ -11092,6 +11092,61 @@ var useWebrtcAudioRuntime = function() {
11092
11092
  });
11093
11093
  return _initRealtimeSession.apply(this, arguments);
11094
11094
  }
11095
+ var start = /* @__PURE__ */ function() {
11096
+ var _ref4 = _asyncToGenerator12(function() {
11097
+ return _ts_generator(this, function(_state) {
11098
+ switch(_state.label){
11099
+ case 0:
11100
+ return [
11101
+ 4,
11102
+ startSessionIfNeeded()
11103
+ ];
11104
+ case 1:
11105
+ _state.sent();
11106
+ setAssistantPaused(false);
11107
+ setAssistantPlaying(true);
11108
+ if (assistantAudioElRef.current) {
11109
+ assistantAudioElRef.current.play().catch(function(err_1) {
11110
+ console.error("Assistant play error:", err_1);
11111
+ });
11112
+ }
11113
+ if (localStreamRef.current) {
11114
+ localStreamRef.current.getAudioTracks().forEach(function(t_0) {
11115
+ return t_0.enabled = true;
11116
+ });
11117
+ }
11118
+ return [
11119
+ 2
11120
+ ];
11121
+ }
11122
+ });
11123
+ });
11124
+ return function start2() {
11125
+ return _ref4.apply(this, arguments);
11126
+ };
11127
+ }();
11128
+ var pause = /* @__PURE__ */ function() {
11129
+ var _ref5 = _asyncToGenerator12(function() {
11130
+ return _ts_generator(this, function(_state) {
11131
+ if (!sessionStartedRef.current) return [
11132
+ 2
11133
+ ];
11134
+ setAssistantPaused(true);
11135
+ setAssistantPlaying(false);
11136
+ if (localStreamRef.current) {
11137
+ localStreamRef.current.getAudioTracks().forEach(function(t_1) {
11138
+ return t_1.enabled = false;
11139
+ });
11140
+ }
11141
+ return [
11142
+ 2
11143
+ ];
11144
+ });
11145
+ });
11146
+ return function pause2() {
11147
+ return _ref5.apply(this, arguments);
11148
+ };
11149
+ }();
11095
11150
  return useMemo20(function() {
11096
11151
  return {
11097
11152
  webrtcAudioRuntime: {
@@ -11099,174 +11154,27 @@ var useWebrtcAudioRuntime = function() {
11099
11154
  start: function() {
11100
11155
  var _start = _asyncToGenerator12(function() {
11101
11156
  return _ts_generator(this, function(_state) {
11102
- switch(_state.label){
11103
- case 0:
11104
- return [
11105
- 4,
11106
- startSessionIfNeeded()
11107
- ];
11108
- case 1:
11109
- _state.sent();
11110
- setRecorderStatus("recording");
11111
- if (localStreamRef.current) {
11112
- localStreamRef.current.getAudioTracks().forEach(function(t_0) {
11113
- return t_0.enabled = true;
11114
- });
11115
- }
11116
- return [
11117
- 2
11118
- ];
11119
- }
11120
- });
11121
- });
11122
- function start() {
11123
- return _start.apply(this, arguments);
11124
- }
11125
- return start;
11126
- }(),
11127
- pause: function() {
11128
- var _pause = _asyncToGenerator12(function() {
11129
- return _ts_generator(this, function(_state) {
11130
- if (!sessionStartedRef.current) return [
11131
- 2
11132
- ];
11133
- setRecorderStatus("paused");
11134
- if (localStreamRef.current) {
11135
- localStreamRef.current.getAudioTracks().forEach(function(t_1) {
11136
- return t_1.enabled = false;
11137
- });
11138
- }
11139
11157
  return [
11140
11158
  2
11141
11159
  ];
11142
11160
  });
11143
11161
  });
11144
- function pause() {
11145
- return _pause.apply(this, arguments);
11146
- }
11147
- return pause;
11148
- }(),
11149
- resume: function() {
11150
- var _resume = _asyncToGenerator12(function() {
11151
- return _ts_generator(this, function(_state) {
11152
- if (!sessionStartedRef.current) return [
11153
- 2
11154
- ];
11155
- setRecorderStatus("recording");
11156
- if (localStreamRef.current) {
11157
- localStreamRef.current.getAudioTracks().forEach(function(t_2) {
11158
- return t_2.enabled = true;
11159
- });
11160
- }
11161
- return [
11162
- 2
11163
- ];
11164
- });
11165
- });
11166
- function resume() {
11167
- return _resume.apply(this, arguments);
11168
- }
11169
- return resume;
11170
- }(),
11171
- stop: function() {
11172
- var _stop = _asyncToGenerator12(function() {
11173
- return _ts_generator(this, function(_state) {
11174
- if (!sessionStartedRef.current) return [
11175
- 2
11176
- ];
11177
- setRecorderStatus("stopped");
11178
- if (localStreamRef.current) {
11179
- localStreamRef.current.getTracks().forEach(function(track) {
11180
- return track.stop();
11181
- });
11182
- }
11183
- return [
11184
- 2
11185
- ];
11186
- });
11187
- });
11188
- function stop() {
11189
- return _stop.apply(this, arguments);
11162
+ function start2() {
11163
+ return _start.apply(this, arguments);
11190
11164
  }
11191
- return stop;
11165
+ return start2;
11192
11166
  }(),
11167
+ pause: pause,
11168
+ resume: start,
11169
+ stop: pause,
11193
11170
  isPending: userIsPending,
11194
11171
  visualizationAnalyser: userAnalyserRef.current,
11195
11172
  rawStatus: recorderStatus
11196
11173
  },
11197
11174
  assistant: {
11198
- play: function() {
11199
- var _play = _asyncToGenerator12(function() {
11200
- return _ts_generator(this, function(_state) {
11201
- switch(_state.label){
11202
- case 0:
11203
- return [
11204
- 4,
11205
- startSessionIfNeeded()
11206
- ];
11207
- case 1:
11208
- _state.sent();
11209
- setAssistantPaused(false);
11210
- setAssistantPlaying(true);
11211
- if (assistantAudioElRef.current) {
11212
- assistantAudioElRef.current.play().catch(function(err_1) {
11213
- console.error("Assistant play error:", err_1);
11214
- });
11215
- }
11216
- return [
11217
- 2
11218
- ];
11219
- }
11220
- });
11221
- });
11222
- function play() {
11223
- return _play.apply(this, arguments);
11224
- }
11225
- return play;
11226
- }(),
11227
- pause: function() {
11228
- var _pause2 = _asyncToGenerator12(function() {
11229
- return _ts_generator(this, function(_state) {
11230
- if (!sessionStartedRef.current) return [
11231
- 2
11232
- ];
11233
- setAssistantPaused(true);
11234
- setAssistantPlaying(false);
11235
- if (assistantAudioElRef.current) {
11236
- assistantAudioElRef.current.pause();
11237
- }
11238
- return [
11239
- 2
11240
- ];
11241
- });
11242
- });
11243
- function pause() {
11244
- return _pause2.apply(this, arguments);
11245
- }
11246
- return pause;
11247
- }(),
11248
- stop: function() {
11249
- var _stop2 = _asyncToGenerator12(function() {
11250
- return _ts_generator(this, function(_state) {
11251
- if (!sessionStartedRef.current) return [
11252
- 2
11253
- ];
11254
- setAssistantPaused(false);
11255
- setAssistantPlaying(false);
11256
- if (assistantAudioElRef.current) {
11257
- assistantAudioElRef.current.pause();
11258
- assistantAudioElRef.current.currentTime = 0;
11259
- }
11260
- return [
11261
- 2
11262
- ];
11263
- });
11264
- });
11265
- function stop() {
11266
- return _stop2.apply(this, arguments);
11267
- }
11268
- return stop;
11269
- }(),
11175
+ play: start,
11176
+ pause: pause,
11177
+ stop: pause,
11270
11178
  visualizationAnalyser: assistantAnalyserRef.current,
11271
11179
  playing: assistantPlaying,
11272
11180
  paused: assistantPaused,