@sawport/react-sdk 0.1.0-alpha.22 → 0.1.0-alpha.23

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
@@ -41799,16 +41799,16 @@ const Offline = react.exports.memo(({
41799
41799
  full_name: create$4().required("Your full name is required"),
41800
41800
  email: create$4().email().required(),
41801
41801
  account: create$3().min(5).required("Your account no. is required"),
41802
- date: create$2().min(hooks().subtract(1, "day"), "Please choose future date").required("Please specify a date"),
41803
- time: create$4().min(4).required("Please specify a time").test("time", "Selected time is out of Hours of Operations", function(value2, {
41804
- parent: parent2
41805
- }) {
41806
- const timeformat = "hh:mm:ss";
41807
- const day = hooks(parent2.date).day();
41802
+ date: create$2().min(hooks().subtract(1, "day"), "Please choose future date").required("Please specify a date").test("date", "Selected day is out of Days of Operation", (value2) => {
41803
+ const day = hooks(value2).day();
41808
41804
  const startDay = days$1[fromDay];
41809
41805
  const endDay = days$1[toDay];
41806
+ return day >= startDay && day <= endDay;
41807
+ }),
41808
+ time: create$4().min(4).required("Please specify a time").test("time", "Selected time is out of Hours of Operation", function(value2) {
41809
+ const timeformat = "hh:mm:ss";
41810
41810
  const check2 = hooks(value2, timeformat), beforeTime = hooks(fromTime, timeformat), afterTime = hooks(toTime, timeformat);
41811
- return day >= startDay && day <= endDay && hooks(check2).isBetween(beforeTime, afterTime);
41811
+ return hooks(check2).isBetween(beforeTime, afterTime);
41812
41812
  }),
41813
41813
  reason: create$4().min(1).required("Reason is required")
41814
41814
  });
@@ -46334,11 +46334,14 @@ function useVideoCalling({ userId, conversation_id }) {
46334
46334
  const localVideoRef = react.exports.useRef(null);
46335
46335
  const remoteVideoRef = react.exports.useRef(null);
46336
46336
  const { socket: socket2 } = useSocket();
46337
- const playSound = react.exports.useCallback((src2, callOn) => {
46338
- sound.src = src2;
46339
- callOn && callOn(sound);
46340
- sound.play();
46341
- }, [sound]);
46337
+ const playSound = react.exports.useCallback(
46338
+ (src2, callOn) => {
46339
+ sound.src = src2;
46340
+ callOn && callOn(sound);
46341
+ sound.play();
46342
+ },
46343
+ [sound]
46344
+ );
46342
46345
  const pauseSound = react.exports.useCallback(() => sound.pause(), [sound]);
46343
46346
  const resumeSound = react.exports.useCallback(() => sound.resume(), [sound]);
46344
46347
  const stopSound = react.exports.useCallback(() => {
@@ -46426,6 +46429,9 @@ function useVideoCalling({ userId, conversation_id }) {
46426
46429
  isOutgoing: false,
46427
46430
  getCalled: false,
46428
46431
  isCalling: false,
46432
+ muted: false,
46433
+ screenShared: false,
46434
+ videoOff: false,
46429
46435
  ...append
46430
46436
  });
46431
46437
  stopSound();
@@ -46603,7 +46609,17 @@ function useVideoCalling({ userId, conversation_id }) {
46603
46609
  "call-token": onToken
46604
46610
  };
46605
46611
  }
46606
- }, [userId, stateRef, answerIncoming, setBandwidth, initMedia, ref, initPeer, sendOffer, playSound]);
46612
+ }, [
46613
+ userId,
46614
+ stateRef,
46615
+ answerIncoming,
46616
+ setBandwidth,
46617
+ initMedia,
46618
+ ref,
46619
+ initPeer,
46620
+ sendOffer,
46621
+ playSound
46622
+ ]);
46607
46623
  useSocketListeners({ listeners: listeners2 });
46608
46624
  react.exports.useEffect(() => {
46609
46625
  return () => callCleanup();
@@ -47254,7 +47270,7 @@ const WidgetFormDisplay = react.exports.memo(({
47254
47270
  setIsWidgetLaunched,
47255
47271
  isWidgetLaunched
47256
47272
  }) => {
47257
- var _a, _b, _c, _d, _e;
47273
+ var _a, _b, _c, _d, _e, _f;
47258
47274
  const {
47259
47275
  socket: socket2
47260
47276
  } = useSocket();
@@ -47311,9 +47327,9 @@ const WidgetFormDisplay = react.exports.memo(({
47311
47327
  ((_a2 = dataRef.current) == null ? void 0 : _a2.wait) && socket2.emit("chat.ended", {
47312
47328
  to: (_b2 = agent == null ? void 0 : agent.user) == null ? void 0 : _b2.id,
47313
47329
  waitId: (_d2 = (_c2 = dataRef.current) == null ? void 0 : _c2.wait) == null ? void 0 : _d2.id,
47314
- agent
47330
+ customer
47315
47331
  });
47316
- }, [companyIsClosed, (_b = dataRef.current) == null ? void 0 : _b.wait]);
47332
+ }, [companyIsClosed, (_b = dataRef.current) == null ? void 0 : _b.wait, (_c = agent == null ? void 0 : agent.user) == null ? void 0 : _c.id, customer]);
47317
47333
  const setChatClose = (chatClose2) => {
47318
47334
  var _a2, _b2, _c2;
47319
47335
  t$1.emit("chat-ended");
@@ -47375,7 +47391,7 @@ const WidgetFormDisplay = react.exports.memo(({
47375
47391
  quickStopChat,
47376
47392
  company,
47377
47393
  videoRef
47378
- }), !!((_d = (_c = dataRef == null ? void 0 : dataRef.current) == null ? void 0 : _c.wait) == null ? void 0 : _d.createdAt) && !stateRef.current.agent && /* @__PURE__ */ jsx(LongestWaitime, {}), /* @__PURE__ */ jsx("div", {
47394
+ }), !!((_e = (_d = dataRef == null ? void 0 : dataRef.current) == null ? void 0 : _d.wait) == null ? void 0 : _e.createdAt) && !stateRef.current.agent && /* @__PURE__ */ jsx(LongestWaitime, {}), /* @__PURE__ */ jsx("div", {
47379
47395
  className: `widget-body-container px-3 ${companyClosed && "widget-body-container-offline"} `,
47380
47396
  children: isLoadingCustomer ? /* @__PURE__ */ jsx(Spinner$2, {}) : isScheduling ? /* @__PURE__ */ jsx(Schedules, {
47381
47397
  setParentState: setState,
@@ -47397,7 +47413,7 @@ const WidgetFormDisplay = react.exports.memo(({
47397
47413
  }) : chatInit && !chatClose ? /* @__PURE__ */ jsx(Feedback$1, {
47398
47414
  quickStopChat,
47399
47415
  agent,
47400
- conversation_id: (_e = dataRef.current) == null ? void 0 : _e.wait.conversation.id
47416
+ conversation_id: (_f = dataRef.current) == null ? void 0 : _f.wait.conversation.id
47401
47417
  }) : !chatInit ? /* @__PURE__ */ jsx(WidgetInitForm$1, {
47402
47418
  company_id,
47403
47419
  companyUser,