@sawport/react-sdk 0.1.0-alpha.21 → 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
@@ -25356,7 +25356,7 @@ function makeGetter(name) {
25356
25356
  return this.isValid() ? this._data[name] : NaN;
25357
25357
  };
25358
25358
  }
25359
- var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days$1 = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years");
25359
+ var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days$2 = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years");
25360
25360
  function weeks() {
25361
25361
  return absFloor(this.days() / 7);
25362
25362
  }
@@ -25479,7 +25479,7 @@ proto$2.milliseconds = milliseconds;
25479
25479
  proto$2.seconds = seconds;
25480
25480
  proto$2.minutes = minutes;
25481
25481
  proto$2.hours = hours;
25482
- proto$2.days = days$1;
25482
+ proto$2.days = days$2;
25483
25483
  proto$2.weeks = weeks;
25484
25484
  proto$2.months = months;
25485
25485
  proto$2.years = years;
@@ -41763,6 +41763,15 @@ const styles$1 = {
41763
41763
  schActionBtnPending
41764
41764
  };
41765
41765
  const PhoneInput = lib.default || lib;
41766
+ const days$1 = {
41767
+ Monday: 1,
41768
+ Tuesday: 2,
41769
+ Wednesday: 3,
41770
+ Thursday: 4,
41771
+ Friday: 5,
41772
+ Saturday: 6,
41773
+ Sunday: 0
41774
+ };
41766
41775
  const Offline = react.exports.memo(({
41767
41776
  company_id,
41768
41777
  website_name,
@@ -41771,7 +41780,9 @@ const Offline = react.exports.memo(({
41771
41780
  calendar: calendar2,
41772
41781
  hexcode,
41773
41782
  toTime,
41774
- fromTime
41783
+ fromTime,
41784
+ toDay,
41785
+ fromDay
41775
41786
  }) => {
41776
41787
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
41777
41788
  const [ipAddress, setIpAddress] = react.exports.useState("");
@@ -41788,16 +41799,16 @@ const Offline = react.exports.memo(({
41788
41799
  full_name: create$4().required("Your full name is required"),
41789
41800
  email: create$4().email().required(),
41790
41801
  account: create$3().min(5).required("Your account no. is required"),
41791
- date: create$2().required("Please specify a date"),
41792
- time: create$4().min(4).required("Please specify a time").test("time", "Selected time is out of Hours of Operations", function(value2) {
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();
41804
+ const startDay = days$1[fromDay];
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) {
41793
41809
  const timeformat = "hh:mm:ss";
41794
41810
  const check2 = hooks(value2, timeformat), beforeTime = hooks(fromTime, timeformat), afterTime = hooks(toTime, timeformat);
41795
- const validTime = hooks(check2).isBetween(beforeTime, afterTime);
41796
- if (validTime) {
41797
- return true;
41798
- } else {
41799
- return false;
41800
- }
41811
+ return hooks(check2).isBetween(beforeTime, afterTime);
41801
41812
  }),
41802
41813
  reason: create$4().min(1).required("Reason is required")
41803
41814
  });
@@ -46323,11 +46334,14 @@ function useVideoCalling({ userId, conversation_id }) {
46323
46334
  const localVideoRef = react.exports.useRef(null);
46324
46335
  const remoteVideoRef = react.exports.useRef(null);
46325
46336
  const { socket: socket2 } = useSocket();
46326
- const playSound = react.exports.useCallback((src2, callOn) => {
46327
- sound.src = src2;
46328
- callOn && callOn(sound);
46329
- sound.play();
46330
- }, [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
+ );
46331
46345
  const pauseSound = react.exports.useCallback(() => sound.pause(), [sound]);
46332
46346
  const resumeSound = react.exports.useCallback(() => sound.resume(), [sound]);
46333
46347
  const stopSound = react.exports.useCallback(() => {
@@ -46415,6 +46429,9 @@ function useVideoCalling({ userId, conversation_id }) {
46415
46429
  isOutgoing: false,
46416
46430
  getCalled: false,
46417
46431
  isCalling: false,
46432
+ muted: false,
46433
+ screenShared: false,
46434
+ videoOff: false,
46418
46435
  ...append
46419
46436
  });
46420
46437
  stopSound();
@@ -46592,7 +46609,17 @@ function useVideoCalling({ userId, conversation_id }) {
46592
46609
  "call-token": onToken
46593
46610
  };
46594
46611
  }
46595
- }, [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
+ ]);
46596
46623
  useSocketListeners({ listeners: listeners2 });
46597
46624
  react.exports.useEffect(() => {
46598
46625
  return () => callCleanup();
@@ -47243,7 +47270,7 @@ const WidgetFormDisplay = react.exports.memo(({
47243
47270
  setIsWidgetLaunched,
47244
47271
  isWidgetLaunched
47245
47272
  }) => {
47246
- var _a, _b, _c, _d, _e;
47273
+ var _a, _b, _c, _d, _e, _f;
47247
47274
  const {
47248
47275
  socket: socket2
47249
47276
  } = useSocket();
@@ -47300,9 +47327,9 @@ const WidgetFormDisplay = react.exports.memo(({
47300
47327
  ((_a2 = dataRef.current) == null ? void 0 : _a2.wait) && socket2.emit("chat.ended", {
47301
47328
  to: (_b2 = agent == null ? void 0 : agent.user) == null ? void 0 : _b2.id,
47302
47329
  waitId: (_d2 = (_c2 = dataRef.current) == null ? void 0 : _c2.wait) == null ? void 0 : _d2.id,
47303
- agent
47330
+ customer
47304
47331
  });
47305
- }, [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]);
47306
47333
  const setChatClose = (chatClose2) => {
47307
47334
  var _a2, _b2, _c2;
47308
47335
  t$1.emit("chat-ended");
@@ -47364,7 +47391,7 @@ const WidgetFormDisplay = react.exports.memo(({
47364
47391
  quickStopChat,
47365
47392
  company,
47366
47393
  videoRef
47367
- }), !!((_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", {
47368
47395
  className: `widget-body-container px-3 ${companyClosed && "widget-body-container-offline"} `,
47369
47396
  children: isLoadingCustomer ? /* @__PURE__ */ jsx(Spinner$2, {}) : isScheduling ? /* @__PURE__ */ jsx(Schedules, {
47370
47397
  setParentState: setState,
@@ -47380,11 +47407,13 @@ const WidgetFormDisplay = react.exports.memo(({
47380
47407
  website_name: company == null ? void 0 : company.name,
47381
47408
  setIsScheduling,
47382
47409
  toTime: company == null ? void 0 : company.to_time,
47383
- fromTime: company == null ? void 0 : company.from_time
47410
+ fromTime: company == null ? void 0 : company.from_time,
47411
+ toDay: company == null ? void 0 : company.to_day,
47412
+ fromDay: company == null ? void 0 : company.from_day
47384
47413
  }) : chatInit && !chatClose ? /* @__PURE__ */ jsx(Feedback$1, {
47385
47414
  quickStopChat,
47386
47415
  agent,
47387
- 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
47388
47417
  }) : !chatInit ? /* @__PURE__ */ jsx(WidgetInitForm$1, {
47389
47418
  company_id,
47390
47419
  companyUser,