@sawport/react-sdk 0.1.0-alpha.38 → 0.1.0-alpha.39

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
@@ -46627,13 +46627,17 @@ function useVideoCalling({ userId, conversation_id }) {
46627
46627
  sound.pause();
46628
46628
  sound.srcObject = null;
46629
46629
  }, [sound]);
46630
- const getMediaStream = react.exports.useCallback(
46631
- () => navigator.mediaDevices.getUserMedia({
46632
- video: true,
46633
- audio: true
46634
- }),
46635
- []
46636
- );
46630
+ const getMediaStream = react.exports.useCallback(() => {
46631
+ try {
46632
+ return navigator.mediaDevices.getUserMedia({
46633
+ video: true,
46634
+ audio: true
46635
+ });
46636
+ } catch (error) {
46637
+ console.error(error);
46638
+ alert("Error getting camera stream!");
46639
+ }
46640
+ }, []);
46637
46641
  const addStreamToVideo = react.exports.useCallback(
46638
46642
  (stream) => {
46639
46643
  try {
@@ -46717,11 +46721,16 @@ function useVideoCalling({ userId, conversation_id }) {
46717
46721
  };
46718
46722
  const initPeer = react.exports.useCallback(
46719
46723
  ({ response }) => {
46720
- ref.current.peerConnection = new RTCPeerConnection({
46721
- iceServers: response.iceServers,
46722
- offerToReceiveAudio: true,
46723
- offerToReceiveVideo: true
46724
- });
46724
+ try {
46725
+ ref.current.peerConnection = new RTCPeerConnection({
46726
+ iceServers: response.iceServers,
46727
+ offerToReceiveAudio: true,
46728
+ offerToReceiveVideo: true
46729
+ });
46730
+ } catch (error) {
46731
+ console.error(error);
46732
+ alert("Error initializing connection");
46733
+ }
46725
46734
  ref.current.peerConnection.onicecandidate = (event) => {
46726
46735
  var _a;
46727
46736
  if (event.candidate) {
@@ -48197,7 +48206,7 @@ const WidgetFormDisplay = react.exports.memo(({
48197
48206
  videoRef,
48198
48207
  setShowTip
48199
48208
  }), !!((_c = (_b = dataRef == null ? void 0 : dataRef.current) == null ? void 0 : _b.wait) == null ? void 0 : _c.createdAt) && !stateRef.current.agent && /* @__PURE__ */ jsx(LongestWaitime, {}), /* @__PURE__ */ jsx("div", {
48200
- className: `widget-body-container px-3 ${companyClosed && "widget-body-container-offline"} `,
48209
+ className: `widget-body-container py-2 px-3 ${companyClosed && "widget-body-container-offline"} `,
48201
48210
  children: isLoadingCustomer || isLoadingCustomer === void 0 ? /* @__PURE__ */ jsx(Spinner$2, {
48202
48211
  className: "d-flex align-self-center m-5 mx-auto"
48203
48212
  }) : isScheduling ? /* @__PURE__ */ jsx(Schedules, {