callix-dialer-widget 1.0.0 → 1.0.1

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.
@@ -53492,7 +53492,7 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout }) {
53492
53492
  void Promise.resolve(
53493
53493
  finishAfterCall({
53494
53494
  result: "success",
53495
- qualificationId: null
53495
+ qualificationId: void 0
53496
53496
  })
53497
53497
  );
53498
53498
  }
@@ -54817,14 +54817,514 @@ function ActiveCallSummary({
54817
54817
  ] })
54818
54818
  ] }) });
54819
54819
  }
54820
+ function FaMicrophoneSlash(props) {
54821
+ return GenIcon({ "attr": { "viewBox": "0 0 640 512" }, "child": [{ "tag": "path", "attr": { "d": "M633.82 458.1l-157.8-121.96C488.61 312.13 496 285.01 496 256v-48c0-8.84-7.16-16-16-16h-16c-8.84 0-16 7.16-16 16v48c0 17.92-3.96 34.8-10.72 50.2l-26.55-20.52c3.1-9.4 5.28-19.22 5.28-29.67V96c0-53.02-42.98-96-96-96s-96 42.98-96 96v45.36L45.47 3.37C38.49-2.05 28.43-.8 23.01 6.18L3.37 31.45C-2.05 38.42-.8 48.47 6.18 53.9l588.36 454.73c6.98 5.43 17.03 4.17 22.46-2.81l19.64-25.27c5.41-6.97 4.16-17.02-2.82-22.45zM400 464h-56v-33.77c11.66-1.6 22.85-4.54 33.67-8.31l-50.11-38.73c-6.71.4-13.41.87-20.35.2-55.85-5.45-98.74-48.63-111.18-101.85L144 241.31v6.85c0 89.64 63.97 169.55 152 181.69V464h-56c-8.84 0-16 7.16-16 16v16c0 8.84 7.16 16 16 16h160c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16z" }, "child": [] }] })(props);
54822
+ }
54823
+ function FaMicrophone(props) {
54824
+ return GenIcon({ "attr": { "viewBox": "0 0 352 512" }, "child": [{ "tag": "path", "attr": { "d": "M176 352c53.02 0 96-42.98 96-96V96c0-53.02-42.98-96-96-96S80 42.98 80 96v160c0 53.02 42.98 96 96 96zm160-160h-16c-8.84 0-16 7.16-16 16v48c0 74.8-64.49 134.82-140.79 127.38C96.71 376.89 48 317.11 48 250.3V208c0-8.84-7.16-16-16-16H16c-8.84 0-16 7.16-16 16v40.16c0 89.64 63.97 169.55 152 181.69V464H96c-8.84 0-16 7.16-16 16v16c0 8.84 7.16 16 16 16h160c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16h-56v-33.77C285.71 418.47 352 344.9 352 256v-48c0-8.84-7.16-16-16-16z" }, "child": [] }] })(props);
54825
+ }
54826
+ function FaPause(props) {
54827
+ return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z" }, "child": [] }] })(props);
54828
+ }
54829
+ function FaPhoneSlash(props) {
54830
+ return GenIcon({ "attr": { "viewBox": "0 0 640 512" }, "child": [{ "tag": "path", "attr": { "d": "M268.2 381.4l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48c-10.7 4.6-16.5 16.1-13.9 27.5l24 104c2.5 10.8 12.1 18.6 23.4 18.6 100.7 0 193.7-32.4 269.7-86.9l-80-61.8c-10.9 6.5-22.1 12.7-33.6 18.1zm365.6 76.7L475.1 335.5C537.9 256.4 576 156.9 576 48c0-11.2-7.7-20.9-18.6-23.4l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-12.2 26.1-27.9 50.3-46 72.8L45.5 3.4C38.5-2 28.5-.8 23 6.2L3.4 31.4c-5.4 7-4.2 17 2.8 22.4l588.4 454.7c7 5.4 17 4.2 22.5-2.8l19.6-25.3c5.4-6.8 4.1-16.9-2.9-22.3z" }, "child": [] }] })(props);
54831
+ }
54832
+ function FaPhone(props) {
54833
+ return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M493.4 24.6l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-36 76.7-98.9 140.5-177.2 177.2l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48C3.9 366.5-2 378.1.6 389.4l24 104C27.1 504.2 36.7 512 48 512c256.1 0 464-207.5 464-464 0-11.2-7.7-20.9-18.6-23.4z" }, "child": [] }] })(props);
54834
+ }
54835
+ function FaPlay(props) {
54836
+ return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z" }, "child": [] }] })(props);
54837
+ }
54838
+ function FaVolumeDown(props) {
54839
+ return GenIcon({ "attr": { "viewBox": "0 0 384 512" }, "child": [{ "tag": "path", "attr": { "d": "M215.03 72.04L126.06 161H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V89.02c0-21.47-25.96-31.98-40.97-16.98zm123.2 108.08c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 229.28 336 242.62 336 257c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.87z" }, "child": [] }] })(props);
54840
+ }
54841
+ function FaVolumeMute(props) {
54842
+ return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z" }, "child": [] }] })(props);
54843
+ }
54844
+ function FaVolumeOff(props) {
54845
+ return GenIcon({ "attr": { "viewBox": "0 0 256 512" }, "child": [{ "tag": "path", "attr": { "d": "M215 71l-89 89H24a24 24 0 0 0-24 24v144a24 24 0 0 0 24 24h102.06L215 441c15 15 41 4.47 41-17V88c0-21.47-26-32-41-17z" }, "child": [] }] })(props);
54846
+ }
54847
+ function FaVolumeUp(props) {
54848
+ return GenIcon({ "attr": { "viewBox": "0 0 576 512" }, "child": [{ "tag": "path", "attr": { "d": "M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z" }, "child": [] }] })(props);
54849
+ }
54850
+ function AudioControls() {
54851
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 w-full max-w-md mx-auto mt-4 ", children: [
54852
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AudioInputControls, {}),
54853
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AudioOutputControls, {})
54854
+ ] });
54855
+ }
54856
+ function AudioInputControls() {
54857
+ const [isMuted, setMute] = clientSdkReactExports.useCallOperatorAudioInputMuted();
54858
+ function toggleMute() {
54859
+ setMute(!isMuted);
54860
+ }
54861
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-4 p-4 bg-gray-100 rounded-lg", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
54862
+ "button",
54863
+ {
54864
+ type: "button",
54865
+ onClick: toggleMute,
54866
+ className: `p-3 rounded-full ${isMuted ? "bg-red-500 text-white" : "bg-gray-200"}`,
54867
+ "aria-label": isMuted ? "Unmute" : "Mute",
54868
+ children: isMuted ? /* @__PURE__ */ jsxRuntimeExports.jsx(FaMicrophoneSlash, { className: "h-6 w-6" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(FaMicrophone, { className: "h-6 w-6" })
54869
+ }
54870
+ ) });
54871
+ }
54872
+ function AudioOutputControls() {
54873
+ const [isMuted, setMute] = clientSdkReactExports.useCallOperatorAudioOutputMuted();
54874
+ const [volume, setVolume] = clientSdkReactExports.useCallOperatorAudioOutputVolume();
54875
+ const handleVolumeChange = (e) => {
54876
+ const newVolume = parseFloat(e.target.value);
54877
+ setVolume(newVolume);
54878
+ };
54879
+ const toggleMute = () => {
54880
+ setMute(!isMuted);
54881
+ };
54882
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center w-full gap-4 p-4 bg-gray-100 rounded-lg", children: [
54883
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
54884
+ "button",
54885
+ {
54886
+ type: "button",
54887
+ onClick: toggleMute,
54888
+ className: `p-3 rounded-full ${isMuted ? "bg-red-500 text-white" : "bg-gray-200"}`,
54889
+ "aria-label": isMuted ? "Unmute" : "Mute",
54890
+ children: isMuted ? /* @__PURE__ */ jsxRuntimeExports.jsx(FaVolumeMute, { className: "h-6 w-6" }) : volume > 0.5 ? /* @__PURE__ */ jsxRuntimeExports.jsx(FaVolumeUp, { className: "h-6 w-6" }) : volume > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(FaVolumeDown, { className: "h-6 w-6" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(FaVolumeOff, { className: "h-6 w-6" })
54891
+ }
54892
+ ),
54893
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
54894
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: "output-volume-control", className: "block text-sm font-medium mb-1", children: [
54895
+ "Output: ",
54896
+ Math.round(volume * 100),
54897
+ "%"
54898
+ ] }),
54899
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
54900
+ "input",
54901
+ {
54902
+ type: "range",
54903
+ id: "output-volume-control",
54904
+ min: "0",
54905
+ max: "1",
54906
+ step: "0.01",
54907
+ value: volume,
54908
+ onChange: handleVolumeChange,
54909
+ className: "w-full"
54910
+ }
54911
+ )
54912
+ ] })
54913
+ ] });
54914
+ }
54915
+ function CallButtons({ isConnected }) {
54916
+ const currentCall = clientSdkReactExports.useCallOperatorCurrentCall();
54917
+ const { answer, reject, hangup, hold, unhold } = clientSdkReactExports.useCallOperatorCurrentCallControls();
54918
+ const [onHold, setOnHold] = useState(false);
54919
+ const isIncoming = (currentCall == null ? void 0 : currentCall.direction) === "incoming";
54920
+ function toggleHold() {
54921
+ const newOnHold = !onHold;
54922
+ setOnHold(newOnHold);
54923
+ if (newOnHold) {
54924
+ hold();
54925
+ } else {
54926
+ unhold();
54927
+ }
54928
+ }
54929
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-4 justify-center", children: isConnected ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
54930
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
54931
+ "button",
54932
+ {
54933
+ type: "button",
54934
+ onClick: toggleHold,
54935
+ className: `px-6 py-3 flex items-center gap-2 ${onHold ? "bg-blue-500 hover:bg-blue-600" : "bg-yellow-500 hover:bg-yellow-600"} text-white rounded-lg transition-colors`,
54936
+ children: [
54937
+ onHold ? /* @__PURE__ */ jsxRuntimeExports.jsx(FaPlay, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(FaPause, {}),
54938
+ onHold ? "Unhold" : "Hold"
54939
+ ]
54940
+ }
54941
+ ),
54942
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
54943
+ "button",
54944
+ {
54945
+ type: "button",
54946
+ onClick: () => hangup(),
54947
+ className: "px-6 py-3 flex items-center gap-2 bg-red-500 text-white rounded-lg hover:bg-red-600 transition-colors",
54948
+ children: [
54949
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FaPhoneSlash, {}),
54950
+ "Hang Up"
54951
+ ]
54952
+ }
54953
+ )
54954
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
54955
+ isIncoming && /* @__PURE__ */ jsxRuntimeExports.jsxs(
54956
+ "button",
54957
+ {
54958
+ type: "button",
54959
+ onClick: () => answer(),
54960
+ className: "px-6 py-3 flex items-center gap-2 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors",
54961
+ children: [
54962
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FaPhone, {}),
54963
+ "Answer"
54964
+ ]
54965
+ }
54966
+ ),
54967
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
54968
+ "button",
54969
+ {
54970
+ type: "button",
54971
+ onClick: () => reject(),
54972
+ className: "px-6 py-3 flex items-center gap-2 bg-red-500 text-white rounded-lg hover:bg-red-600 transition-colors",
54973
+ children: [
54974
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FaPhoneSlash, {}),
54975
+ "Reject"
54976
+ ]
54977
+ }
54978
+ )
54979
+ ] }) });
54980
+ }
54981
+ function CallDetails({ call }) {
54982
+ if (!call) {
54983
+ return null;
54984
+ }
54985
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-white shadow-md rounded-lg p-6 max-w-md mx-auto", children: [
54986
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-semibold mb-2", children: "Call Details" }),
54987
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
54988
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "flex justify-between", children: [
54989
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "Call ID:" }),
54990
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs", children: call.id })
54991
+ ] }),
54992
+ call.data.callUuid && /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "flex justify-between", children: [
54993
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "UUID:" }),
54994
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs", children: call.data.callUuid })
54995
+ ] }),
54996
+ call.data.protocol && /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "flex justify-between", children: [
54997
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "Protocol:" }),
54998
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs", children: call.data.protocol })
54999
+ ] })
55000
+ ] })
55001
+ ] });
55002
+ }
55003
+ function CallManagerAfterCall() {
55004
+ const { finishAfterCall } = clientSdkReactExports.useCallOperatorControls();
55005
+ const [callResult, setCallResult] = useState("success");
55006
+ const [qualificationId, setQualificationId] = useState(null);
55007
+ function handleFinishAfterCall() {
55008
+ if (qualificationId != null) {
55009
+ finishAfterCall({
55010
+ result: callResult,
55011
+ qualificationId
55012
+ });
55013
+ }
55014
+ }
55015
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center justify-center p-8", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-gray-50 p-8 rounded-lg shadow-sm text-center", children: [
55016
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-medium mb-2", children: "Call Ended" }),
55017
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center mb-4", children: [
55018
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mr-2", children: "Call Result:" }),
55019
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
55020
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55021
+ ToggleButton,
55022
+ {
55023
+ label: "Success",
55024
+ isEnabled: callResult === "success",
55025
+ enabledClasses: "bg-green-500 text-white",
55026
+ disabledClasses: "bg-gray-300 text-gray-700",
55027
+ onEnable: () => {
55028
+ setCallResult("success");
55029
+ setQualificationId(null);
55030
+ }
55031
+ }
55032
+ ),
55033
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55034
+ ToggleButton,
55035
+ {
55036
+ label: "Discard",
55037
+ isEnabled: callResult === "failure",
55038
+ enabledClasses: "bg-red-500 text-white",
55039
+ disabledClasses: "bg-gray-300 text-gray-700",
55040
+ onEnable: () => {
55041
+ setCallResult("failure");
55042
+ setQualificationId(null);
55043
+ }
55044
+ }
55045
+ )
55046
+ ] })
55047
+ ] }),
55048
+ callResult === "success" && /* @__PURE__ */ jsxRuntimeExports.jsx(SuccessQualificationSelector, { onSelect: setQualificationId }),
55049
+ callResult === "failure" && /* @__PURE__ */ jsxRuntimeExports.jsx(DiscardQualificationSelector, { onSelect: setQualificationId }),
55050
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55051
+ "button",
55052
+ {
55053
+ type: "button",
55054
+ className: "mt-4 px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700",
55055
+ onClick: handleFinishAfterCall,
55056
+ children: "Finish After Call"
55057
+ }
55058
+ )
55059
+ ] }) });
55060
+ }
55061
+ function ToggleButton(props) {
55062
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
55063
+ "button",
55064
+ {
55065
+ type: "button",
55066
+ className: `p-2 ${props.classes ?? ""} ${props.isEnabled ? props.enabledClasses : props.disabledClasses}`,
55067
+ onClick: props.isEnabled ? void 0 : props.onEnable,
55068
+ children: props.label
55069
+ }
55070
+ );
55071
+ }
55072
+ function Selector(props) {
55073
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
55074
+ "select",
55075
+ {
55076
+ className: "w-full p-2 border border-gray-300 rounded",
55077
+ onChange: (e) => props.onSelect(Number(e.target.value)),
55078
+ children: [
55079
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "-- Select Option --" }),
55080
+ props.options.map((option) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: option.id, children: option.name }, option.id))
55081
+ ]
55082
+ }
55083
+ );
55084
+ }
55085
+ function SuccessQualificationSelector(props) {
55086
+ const successQualifications = clientSdkReactExports.useCallOperatorSuccessQualifications();
55087
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4", children: [
55088
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-medium mb-2", children: "Select Qualification" }),
55089
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Selector, { options: successQualifications, onSelect: props.onSelect })
55090
+ ] });
55091
+ }
55092
+ function DiscardQualificationSelector(props) {
55093
+ const discardQualifications = clientSdkReactExports.useCallOperatorDiscardQualifications();
55094
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4", children: [
55095
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-medium mb-2", children: "Select Qualification" }),
55096
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Selector, { options: discardQualifications, onSelect: props.onSelect })
55097
+ ] });
55098
+ }
55099
+ function CallTimer({ call }) {
55100
+ const [duration, setDuration] = useState(0);
55101
+ useEffect(() => {
55102
+ if (!call) {
55103
+ setDuration(0);
55104
+ return;
55105
+ }
55106
+ setDuration(call.currentDurationSeconds);
55107
+ const timer = setInterval(() => {
55108
+ if (call) {
55109
+ setDuration(call.currentDurationSeconds);
55110
+ }
55111
+ }, 1e3);
55112
+ return () => clearInterval(timer);
55113
+ }, [call]);
55114
+ const formatTime = (seconds) => {
55115
+ const mins = Math.floor(seconds / 60);
55116
+ const secs = seconds % 60;
55117
+ return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
55118
+ };
55119
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-2xl font-bold text-center py-4", children: formatTime(duration) });
55120
+ }
55121
+ const validatePhoneNumber = (phoneNumber) => {
55122
+ if (!phoneNumber) {
55123
+ return "Phone number is required";
55124
+ }
55125
+ const isValid2 = isValidPhoneNumber(phoneNumber, "BR");
55126
+ if (!isValid2) {
55127
+ return "Invalid phone number";
55128
+ }
55129
+ return null;
55130
+ };
55131
+ function ManualCallPanel() {
55132
+ const { makeManualCall } = clientSdkReactExports.useCallOperatorControls();
55133
+ const operatorState = clientSdkReactExports.useCallOperatorState();
55134
+ const [phoneNumber, setPhoneNumber] = useState("");
55135
+ const [isCalling, setIsCalling] = useState(false);
55136
+ const [error2, setError] = useState(null);
55137
+ useEffect(() => {
55138
+ if ((operatorState == null ? void 0 : operatorState.state) === "callRinging" || (operatorState == null ? void 0 : operatorState.state) === "callInProgress") {
55139
+ setIsCalling(false);
55140
+ setPhoneNumber("");
55141
+ }
55142
+ }, [operatorState == null ? void 0 : operatorState.state]);
55143
+ const handleCall = useCallback(() => {
55144
+ const phoneNumberTrimmed = phoneNumber.trim();
55145
+ const err = validatePhoneNumber(phoneNumberTrimmed);
55146
+ setError(err);
55147
+ if (err) {
55148
+ return;
55149
+ }
55150
+ try {
55151
+ setIsCalling(true);
55152
+ makeManualCall(phoneNumberTrimmed);
55153
+ } catch (e) {
55154
+ console.error(e);
55155
+ setError("Failed to start call");
55156
+ setIsCalling(false);
55157
+ }
55158
+ }, [phoneNumber, makeManualCall]);
55159
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
55160
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
55161
+ /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "manual-call-number", className: "block text-sm font-medium text-gray-700 mb-1", children: "Phone Number" }),
55162
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55163
+ "input",
55164
+ {
55165
+ id: "manual-call-number",
55166
+ type: "tel",
55167
+ inputMode: "tel",
55168
+ autoComplete: "tel",
55169
+ placeholder: "e.g. +5511999999999",
55170
+ className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",
55171
+ value: phoneNumber,
55172
+ onChange: (e) => {
55173
+ setPhoneNumber(e.target.value);
55174
+ if (error2) setError(null);
55175
+ },
55176
+ onKeyDown: (e) => {
55177
+ if (e.key === "Enter") {
55178
+ e.preventDefault();
55179
+ handleCall();
55180
+ }
55181
+ },
55182
+ disabled: isCalling
55183
+ }
55184
+ ),
55185
+ error2 && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-xs text-red-600", children: error2 })
55186
+ ] }),
55187
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55188
+ "button",
55189
+ {
55190
+ type: "button",
55191
+ onClick: handleCall,
55192
+ disabled: isCalling || !!validatePhoneNumber(phoneNumber),
55193
+ className: "w-full flex justify-center items-center gap-2 rounded-md bg-blue-600 px-4 py-2 text-white font-medium hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
55194
+ children: isCalling ? "Calling..." : "Call"
55195
+ }
55196
+ )
55197
+ ] });
55198
+ }
55199
+ function RingingAnimation() {
55200
+ const [visible, setVisible] = useState(true);
55201
+ useEffect(() => {
55202
+ const interval = setInterval(() => {
55203
+ setVisible((prev) => !prev);
55204
+ }, 500);
55205
+ return () => {
55206
+ clearInterval(interval);
55207
+ };
55208
+ }, []);
55209
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center my-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
55210
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55211
+ "div",
55212
+ {
55213
+ className: `absolute inset-0 rounded-full bg-green-500 opacity-30 ${visible ? "scale-150" : "scale-100"} transition-transform duration-500`
55214
+ }
55215
+ ),
55216
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative z-10 w-12 h-12 bg-green-500 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
55217
+ "svg",
55218
+ {
55219
+ xmlns: "http://www.w3.org/2000/svg",
55220
+ fill: "none",
55221
+ viewBox: "0 0 24 24",
55222
+ stroke: "currentColor",
55223
+ className: "w-6 h-6 text-white",
55224
+ "aria-hidden": "true",
55225
+ children: [
55226
+ /* @__PURE__ */ jsxRuntimeExports.jsx("title", { children: "Phone" }),
55227
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55228
+ "path",
55229
+ {
55230
+ strokeLinecap: "round",
55231
+ strokeLinejoin: "round",
55232
+ strokeWidth: 2,
55233
+ d: "M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"
55234
+ }
55235
+ )
55236
+ ]
55237
+ }
55238
+ ) })
55239
+ ] }) });
55240
+ }
55241
+ function CallManager() {
55242
+ const callOperatorState = clientSdkReactExports.useCallOperatorState();
55243
+ console.log("callOperatorState", callOperatorState);
55244
+ if (!callOperatorState) {
55245
+ return null;
55246
+ }
55247
+ if (callOperatorState.state === "starting") {
55248
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center justify-center p-8", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-gray-50 p-8 rounded-lg shadow-sm text-center", children: [
55249
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-medium mb-2", children: "Initializing Call Operator" }),
55250
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-gray-600", children: "Please wait..." })
55251
+ ] }) });
55252
+ }
55253
+ if (callOperatorState.state === "idle") {
55254
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center justify-center p-8", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-gray-50 p-8 rounded-lg shadow-sm w-full max-w-md space-y-6", children: [
55255
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center space-y-2", children: [
55256
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-medium", children: "No Active Call" }),
55257
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-gray-600", children: "You can place a manual outbound call below." })
55258
+ ] }),
55259
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ManualCallPanel, {})
55260
+ ] }) });
55261
+ }
55262
+ if (callOperatorState.state === "onBreak") {
55263
+ const serviceBreak = callOperatorState.break;
55264
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center justify-center p-8", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-gray-50 p-8 rounded-lg shadow-sm text-center", children: [
55265
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-medium mb-2", children: "On Break" }),
55266
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-gray-600", children: "You are currently on break." }),
55267
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-gray-600", children: [
55268
+ "Break: ",
55269
+ serviceBreak.name,
55270
+ " (",
55271
+ serviceBreak.id,
55272
+ ")"
55273
+ ] })
55274
+ ] }) });
55275
+ }
55276
+ if (callOperatorState.state === "callRinging") {
55277
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-6 w-full max-w-lg mx-auto p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-white shadow-lg rounded-lg overflow-hidden", children: [
55278
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-blue-600 text-white p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-semibold text-center", children: "Incoming Call" }) }),
55279
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 space-y-6", children: [
55280
+ /* @__PURE__ */ jsxRuntimeExports.jsx(RingingAnimation, {}),
55281
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CallButtons, { isConnected: false }),
55282
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CallDetails, { call: callOperatorState.call })
55283
+ ] })
55284
+ ] }) });
55285
+ }
55286
+ if (callOperatorState.state === "manualCallSetup" || callOperatorState.state === "manualCallRinging") {
55287
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-6 w-full max-w-lg mx-auto p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-white shadow-lg rounded-lg overflow-hidden", children: [
55288
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-blue-600 text-white p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-semibold text-center", children: "Call in Progress" }) }),
55289
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 space-y-6", children: [
55290
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CallTimer, { call: callOperatorState.call }),
55291
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CallButtons, { isConnected: false }),
55292
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CallDetails, { call: callOperatorState.call })
55293
+ ] })
55294
+ ] }) });
55295
+ }
55296
+ if (callOperatorState.state === "callInProgress") {
55297
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-6 w-full max-w-lg mx-auto p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-white shadow-lg rounded-lg overflow-hidden", children: [
55298
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-blue-600 text-white p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-semibold text-center", children: "Call in Progress" }) }),
55299
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-6 space-y-6", children: [
55300
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CallTimer, { call: callOperatorState.call }),
55301
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CallButtons, { isConnected: true }),
55302
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AudioControls, {}),
55303
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CallDetails, { call: callOperatorState.call }),
55304
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CallInfoDisplay, {})
55305
+ ] })
55306
+ ] }) });
55307
+ }
55308
+ if (callOperatorState.state === "afterCall") {
55309
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(CallManagerAfterCall, {});
55310
+ }
55311
+ if (callOperatorState.state === "error") {
55312
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center justify-center p-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-red-50 p-8 rounded-lg shadow-sm text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-medium mb-2", children: "Error" }) }) });
55313
+ }
55314
+ if (callOperatorState.state === "offline") {
55315
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center justify-center p-8", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-gray-50 p-8 rounded-lg shadow-sm text-center", children: [
55316
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-medium mb-2", children: "Offline" }),
55317
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-gray-600", children: "You are currently offline. Please check your connection." })
55318
+ ] }) });
55319
+ }
55320
+ }
54820
55321
  function InlineDialer({
54821
55322
  isAuthenticated,
54822
55323
  username,
54823
55324
  onLogin,
54824
55325
  onLogout,
54825
55326
  isLoadingSession,
54826
- sessionError,
54827
- children: children2
55327
+ sessionError
54828
55328
  }) {
54829
55329
  const [inputUsername, setInputUsername] = useState(username ?? "");
54830
55330
  const [hasBlurred, setHasBlurred] = useState(false);
@@ -54975,7 +55475,7 @@ function InlineDialer({
54975
55475
  ] })
54976
55476
  }
54977
55477
  ),
54978
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: tw`p-4`, children: children2 })
55478
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: tw`p-4`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CallManager, {}) })
54979
55479
  ]
54980
55480
  }
54981
55481
  );
@@ -55025,12 +55525,6 @@ class CallixDialerWidget {
55025
55525
  }
55026
55526
  }
55027
55527
  }
55028
- const STORAGE_KEYS = {
55029
- USERNAME: "callix_dialer_username",
55030
- SESSION_TOKEN: "callix_dialer_session_token",
55031
- DOMAIN: "callix_dialer_domain",
55032
- TIMESTAMP: "callix_dialer_timestamp"
55033
- };
55034
55528
  const SESSION_EXPIRATION_MS = 8 * 60 * 60 * 1e3;
55035
55529
  function DialerWrapper({ options }) {
55036
55530
  const [username, setUsername] = useState(null);