@sawport/react-sdk 1.2.5-alpha.7 → 1.2.5-alpha.9

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
@@ -104483,7 +104483,7 @@ const EmptySchedule = ({ brandColor = "#1A4C9D" }) => {
104483
104483
  return /* @__PURE__ */ jsxs(Col, { className: `${styles$1.emptyState} mt-4`, children: [
104484
104484
  /* @__PURE__ */ jsx("div", { className: styles$1.schIconCon, children: /* @__PURE__ */ jsx(RefIcon$h, { style: { color: brandColor, fontSize: 18 } }) }),
104485
104485
  /* @__PURE__ */ jsx("p", { className: styles$1.schTitle, children: "No Scheduled Meetings" }),
104486
- /* @__PURE__ */ jsx("p", { className: styles$1.schSubtitle, children: "You have no upcoming virtual meetings yet." })
104486
+ /* @__PURE__ */ jsx("p", { className: styles$1.schSubtitle, children: "You have no upcoming virtual meetings." })
104487
104487
  ] });
104488
104488
  };
104489
104489
  const EmptySchedule$1 = memo(EmptySchedule);
@@ -104851,8 +104851,7 @@ const Offline = memo(
104851
104851
  customer,
104852
104852
  fields,
104853
104853
  offlineMode,
104854
- timezone: companyTimezone,
104855
- inviteLink
104854
+ timezone: companyTimezone
104856
104855
  }) => {
104857
104856
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i2, _j, _k, _l, _m;
104858
104857
  const callRequestOptions = [
@@ -105039,7 +105038,6 @@ const Offline = memo(
105039
105038
  (i2) => sendConversationInvite({
105040
105039
  customer_id: customer == null ? void 0 : customer.id,
105041
105040
  conversation_id,
105042
- invite_link: computedInviteLink,
105043
105041
  email: i2.email,
105044
105042
  name: i2.name
105045
105043
  })
@@ -105147,10 +105145,6 @@ const Offline = memo(
105147
105145
  const removeInvitee = (email2) => {
105148
105146
  setInvitees((prev2) => prev2.filter((i2) => i2.email !== email2));
105149
105147
  };
105150
- const computedInviteLink = useMemo$2(
105151
- () => inviteLink || (typeof window !== "undefined" ? window.location.href : ""),
105152
- [inviteLink]
105153
- );
105154
105148
  return /* @__PURE__ */ jsxs("div", { className: "offline py-2 px-1 m-auto", children: [
105155
105149
  scheduled ? /* @__PURE__ */ jsx(
105156
105150
  Done$1,
@@ -107075,7 +107069,7 @@ function WidgetOnlineHeader({ company }) {
107075
107069
  /* @__PURE__ */ jsxs("p", { className: "my-1", style: { fontSize: 13 }, children: [
107076
107070
  "Please fill out the form below to start virtual ",
107077
107071
  /* @__PURE__ */ jsx("br", {}),
107078
- " engagement with the next available agent"
107072
+ " engagement with the next available agent."
107079
107073
  ] })
107080
107074
  ]
107081
107075
  }
@@ -119928,7 +119922,6 @@ const CallInviteModal = ({
119928
119922
  onCancel,
119929
119923
  conversationId,
119930
119924
  customerId,
119931
- inviteLink,
119932
119925
  brandColor = "#034ea2",
119933
119926
  initialForm,
119934
119927
  onSuccess,
@@ -119953,20 +119946,22 @@ const CallInviteModal = ({
119953
119946
  const onSend = async () => {
119954
119947
  try {
119955
119948
  setLoading(true);
119956
- await sendConversationInvite({
119949
+ const payload = {
119957
119950
  customer_id: customerId,
119958
119951
  conversation_id: conversationId,
119959
- invite_link: inviteLink || "https://meet.com",
119960
119952
  email: form.email,
119961
119953
  name: form.fullName
119962
- });
119954
+ };
119955
+ await sendConversationInvite(payload);
119963
119956
  setLoading(false);
119957
+ y.success("Invitation sent successfully!");
119964
119958
  onSuccess == null ? void 0 : onSuccess({ email: form.email, name: form.fullName });
119965
119959
  setForm({ fullName: "", email: "" });
119966
119960
  onCancel();
119967
119961
  } catch (error) {
119968
119962
  setLoading(false);
119969
119963
  onError == null ? void 0 : onError(error);
119964
+ y.error("Failed to send invitation.");
119970
119965
  }
119971
119966
  };
119972
119967
  return /* @__PURE__ */ jsx(
@@ -120050,11 +120045,23 @@ const CallInviteModal = ({
120050
120045
  }
120051
120046
  ),
120052
120047
  /* @__PURE__ */ jsxs("div", { style: { padding: "20px 32px 28px 32px", textAlign: "left" }, children: [
120053
- /* @__PURE__ */ jsxs("div", { className: "text-sm sm:text-base text-[#222] mb-4 font-medium leading-snug", children: [
120054
- "Invite someone to join this call session",
120055
- /* @__PURE__ */ jsx("br", {}),
120056
- "by sending them an invitation link."
120057
- ] }),
120048
+ /* @__PURE__ */ jsxs(
120049
+ "div",
120050
+ {
120051
+ style: {
120052
+ fontSize: 17,
120053
+ color: "#222",
120054
+ marginBottom: 16,
120055
+ fontWeight: 500,
120056
+ lineHeight: 1.4
120057
+ },
120058
+ children: [
120059
+ "Invite someone to join this call session",
120060
+ /* @__PURE__ */ jsx("br", {}),
120061
+ "by sending them an invitation link."
120062
+ ]
120063
+ }
120064
+ ),
120058
120065
  /* @__PURE__ */ jsx(
120059
120066
  FInput,
120060
120067
  {
@@ -120131,16 +120138,11 @@ const Controls = ({
120131
120138
  stopScreenSharing,
120132
120139
  screenShared,
120133
120140
  conversationId,
120134
- inviteLink,
120135
120141
  brandColor,
120136
120142
  localParticipant,
120137
120143
  isMobile: isMobile2
120138
120144
  }) => {
120139
120145
  const [inviteModalOpen, setInviteModalOpen] = React__default.useState(false);
120140
- const computedInviteLink = useMemo$2(
120141
- () => inviteLink || (typeof window !== "undefined" ? window.location.href : ""),
120142
- [inviteLink]
120143
- );
120144
120146
  const audioOn = (localParticipant == null ? void 0 : localParticipant.audioOn) ?? true;
120145
120147
  const videoOn = (localParticipant == null ? void 0 : localParticipant.videoOn) ?? true;
120146
120148
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -120205,7 +120207,6 @@ const Controls = ({
120205
120207
  onCancel: () => setInviteModalOpen(false),
120206
120208
  conversationId,
120207
120209
  customerId: useUserStore.getState().user.id,
120208
- inviteLink: computedInviteLink,
120209
120210
  brandColor
120210
120211
  }
120211
120212
  )
@@ -120227,9 +120228,7 @@ const VideoChat = ({
120227
120228
  remoteParticipants = [],
120228
120229
  allParticipants = [],
120229
120230
  conversationId,
120230
- inviteLink,
120231
120231
  brandColor,
120232
- error,
120233
120232
  isConnecting = false
120234
120233
  }) => {
120235
120234
  const isMobile2 = useMemo$2(() => detectMobile(), []);
@@ -120312,13 +120311,11 @@ const VideoChat = ({
120312
120311
  screenShared,
120313
120312
  isRecording,
120314
120313
  conversationId,
120315
- inviteLink,
120316
120314
  brandColor,
120317
120315
  localParticipant,
120318
120316
  isMobile: isMobile2
120319
120317
  }
120320
- ) }) }),
120321
- error && /* @__PURE__ */ jsx("div", { className: "text-red-500 text-xs p-2 absolute bottom-2 left-2 bg-white/70 rounded", children: String(error) })
120318
+ ) }) })
120322
120319
  ]
120323
120320
  }
120324
120321
  );
@@ -120479,6 +120476,7 @@ const IncomingVideoCallModal = memo(
120479
120476
  rejectCall,
120480
120477
  callerName = "Caller",
120481
120478
  callerImage,
120479
+ callerTitle = "Agent",
120482
120480
  brandColor = "#ffffff"
120483
120481
  }) => {
120484
120482
  return /* @__PURE__ */ jsx(
@@ -120520,10 +120518,11 @@ const IncomingVideoCallModal = memo(
120520
120518
  "h3",
120521
120519
  {
120522
120520
  className: "text-center mt-4",
120523
- style: { fontSize: 20, fontWeight: 700, color: "#1F2937", letterSpacing: -0.3 },
120521
+ style: { fontSize: 20, fontWeight: 500, color: "#1F2937", letterSpacing: -0.3 },
120524
120522
  children: callerName
120525
120523
  }
120526
- )
120524
+ ),
120525
+ /* @__PURE__ */ jsx("p", { className: "text-black text-center", style: { fontSize: 13 }, children: callerTitle || "Agent" })
120527
120526
  ] }),
120528
120527
  /* @__PURE__ */ jsxs("div", { style: incomingModalStyles.buttonContainer, children: [
120529
120528
  /* @__PURE__ */ jsx(
@@ -120658,10 +120657,7 @@ const incomingModalStyles = {
120658
120657
  const VideoChat$1 = memo(VideoChat);
120659
120658
  const VideoCall = ({ userId, conversation_id, brandColor }) => {
120660
120659
  const sessionToken = useUserStore((state) => state.sessionToken) || "";
120661
- const socketUrl = useMemo$2(
120662
- () => "https://api.dev.sawport.com",
120663
- []
120664
- );
120660
+ const socketUrl = useMemo$2(() => sawportConfig.baseURL, []);
120665
120661
  const [isIncomingCall, setIsIncomingCall] = useState$1(false);
120666
120662
  const [incomingCallerInfo, setIncomingCallerInfo] = useState$1({});
120667
120663
  const [isAnswering, setIsAnswering] = useState$1(false);
@@ -120835,7 +120831,8 @@ const VideoCall = ({ userId, conversation_id, brandColor }) => {
120835
120831
  const fullName = `${firstName} ${lastName}`.trim();
120836
120832
  return {
120837
120833
  name: fullName || "Agent",
120838
- image: agent.profile_picture || agent.image
120834
+ image: agent.profile_picture || agent.image,
120835
+ title: agent.title || "Agent"
120839
120836
  };
120840
120837
  }
120841
120838
  }
@@ -120843,7 +120840,8 @@ const VideoCall = ({ userId, conversation_id, brandColor }) => {
120843
120840
  if (agentParticipant) {
120844
120841
  return {
120845
120842
  name: agentParticipant.displayName || "Agent",
120846
- image: void 0
120843
+ image: void 0,
120844
+ title: void 0
120847
120845
  };
120848
120846
  }
120849
120847
  return null;
@@ -120919,7 +120917,8 @@ const VideoCall = ({ userId, conversation_id, brandColor }) => {
120919
120917
  }
120920
120918
  const callerInfo = {
120921
120919
  name: (agentInfo == null ? void 0 : agentInfo.name) || "Agent",
120922
- image: agentInfo == null ? void 0 : agentInfo.image
120920
+ image: agentInfo == null ? void 0 : agentInfo.image,
120921
+ title: (agentInfo == null ? void 0 : agentInfo.title) || "Agent"
120923
120922
  };
120924
120923
  setIsIncomingCall(true);
120925
120924
  setIncomingCallerInfo(callerInfo);
@@ -121128,6 +121127,7 @@ const VideoCall = ({ userId, conversation_id, brandColor }) => {
121128
121127
  },
121129
121128
  callerName: (incomingCallerInfo == null ? void 0 : incomingCallerInfo.name) || (agentInfo == null ? void 0 : agentInfo.name),
121130
121129
  callerImage: (incomingCallerInfo == null ? void 0 : incomingCallerInfo.image) || (agentInfo == null ? void 0 : agentInfo.image),
121130
+ callerTitle: (incomingCallerInfo == null ? void 0 : incomingCallerInfo.title) || (agentInfo == null ? void 0 : agentInfo.title),
121131
121131
  brandColor
121132
121132
  }
121133
121133
  )