@sawport/react-sdk 0.1.0-alpha.81.1 → 0.1.0-alpha.81.2

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
@@ -75342,7 +75342,7 @@ function ChatWidgetScreen({
75342
75342
  handleCancel,
75343
75343
  setPopupVisible
75344
75344
  }) {
75345
- var _a, _b, _c, _d, _e, _f, _g;
75345
+ var _a, _b, _c, _d, _e, _f;
75346
75346
  const {
75347
75347
  socket: socket2
75348
75348
  } = useSocket();
@@ -75400,12 +75400,12 @@ function ChatWidgetScreen({
75400
75400
  state.transferredAgent = null;
75401
75401
  });
75402
75402
  const listeners2 = reactExports.useMemo(() => {
75403
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j;
75403
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j;
75404
75404
  return {
75405
75405
  [`message.new.${((_a2 = dataRef.current) == null ? void 0 : _a2.wait.conversation.id) || ((_b2 = dataRef.current) == null ? void 0 : _b2.wait.conversation)}`]: async ({
75406
75406
  message
75407
75407
  }) => {
75408
- var _a3, _b3, _c3, _d3, _e3, _f3, _g3;
75408
+ var _a3, _b3, _c3, _d3, _e3, _f3, _g2;
75409
75409
  const sender = ((_a3 = message.user) == null ? void 0 : _a3.id) || message.user;
75410
75410
  const customer = (_b3 = dataRef.current) == null ? void 0 : _b3.customer;
75411
75411
  const isSender = ((_c3 = customer == null ? void 0 : customer.user) == null ? void 0 : _c3.id) === (((_d3 = message.user) == null ? void 0 : _d3.id) || message.user);
@@ -75419,7 +75419,7 @@ function ChatWidgetScreen({
75419
75419
  t$5.emit("agent-joined", message.user);
75420
75420
  }
75421
75421
  if (agentDetails == null ? void 0 : agentDetails.userId) {
75422
- await readConversation(((_f3 = dataRef.current) == null ? void 0 : _f3.wait.conversation.id) || ((_g3 = dataRef.current) == null ? void 0 : _g3.wait.conversation), agentDetails == null ? void 0 : agentDetails.userId);
75422
+ await readConversation(((_f3 = dataRef.current) == null ? void 0 : _f3.wait.conversation.id) || ((_g2 = dataRef.current) == null ? void 0 : _g2.wait.conversation), agentDetails == null ? void 0 : agentDetails.userId);
75423
75423
  }
75424
75424
  },
75425
75425
  [`Conversation.read.${((_c2 = dataRef.current) == null ? void 0 : _c2.wait.conversation.id) || ((_d2 = dataRef.current) == null ? void 0 : _d2.wait.conversation)}`]: async ({
@@ -75451,7 +75451,7 @@ function ChatWidgetScreen({
75451
75451
  state.transferredAgent = agent;
75452
75452
  });
75453
75453
  },
75454
- [`WaitList.transferred.${((_g2 = dataRef.current) == null ? void 0 : _g2.wait.conversation.id) || ((_h = dataRef.current) == null ? void 0 : _h.wait.conversation)}`]: ({
75454
+ [`WaitList.transferred.${((_g = dataRef.current) == null ? void 0 : _g.wait.conversation.id) || ((_h = dataRef.current) == null ? void 0 : _h.wait.conversation)}`]: ({
75455
75455
  agent
75456
75456
  }) => {
75457
75457
  setEvent((state) => {
@@ -75491,14 +75491,16 @@ function ChatWidgetScreen({
75491
75491
  isOngoingChat && clearInterval(timeoutRef.current);
75492
75492
  }, [timeoutRef, isOngoingChat]);
75493
75493
  reactExports.useEffect(() => {
75494
- var _a2, _b2;
75495
- if (((_a2 = company == null ? void 0 : company.options) == null ? void 0 : _a2.schedulePopUpTime) && !agentDetails) {
75494
+ var _a2;
75495
+ if (!agentConnected && !agentDetails) {
75496
75496
  const intervalId = setInterval(() => {
75497
75497
  setPopupVisible(true);
75498
- }, (_b2 = company == null ? void 0 : company.options) == null ? void 0 : _b2.schedulePopUpTime);
75498
+ }, (_a2 = company == null ? void 0 : company.options) == null ? void 0 : _a2.schedulePopUpTime);
75499
75499
  return () => clearInterval(intervalId);
75500
+ } else {
75501
+ setPopupVisible(false);
75500
75502
  }
75501
- }, [(_g = company == null ? void 0 : company.options) == null ? void 0 : _g.schedulePopUpTime, agentDetails]);
75503
+ }, [agentConnected, agentDetails]);
75502
75504
  reactExports.useEffect(() => {
75503
75505
  var _a2, _b2, _c2;
75504
75506
  socket2.connected && socket2.emit("customer-joined-conversation", {