beem-component 2.1.25 → 2.1.27

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/src/App.js CHANGED
@@ -666,13 +666,59 @@ const Chat = () => {
666
666
  'https://bm-chatbot-images.s3.eu-west-1.amazonaws.com/081c00de-cc02-44f2-bd91-5cf3a5a73d09.jpeg',
667
667
  },
668
668
  },
669
+ // {
670
+ // id: 109370,
671
+ // message:
672
+ // '{"call_id":"1764099020.52","time_start":"2025-11-25 22:30:20","call_from":"004","call_to":"0782270052","call_duration":2,"talk_duration":129,"src_trunk_name":"","dst_trunk_name":"drtest3cx","pin_code":"","status":"ANSWERED","type":"Outbound","recording":"","did_number":"","did_name":"","agent_ring_time":0,"uid":"202511252230209719F","call_note_id":"20251125223020-33142","enb_call_note":16}',
673
+ // time: '2025-10-06T10:53:38.000Z',
674
+ // direction: 'outbound',
675
+ // message_type: 'call',
676
+ // messageId: '121302f4-50ca-48c3-a32a-2d570064a000',
677
+ // is_live_agent: 0,
678
+ // is_deleted: 0,
679
+ // is_comment: 0,
680
+ // channel: 'voice_call',
681
+ // sent_to_vendor: 1,
682
+ // replyMessageId: null,
683
+
684
+ // agent_name: null,
685
+ // df_agent_name: null,
686
+ // resolve_time: null,
687
+ // metadata: null,
688
+ // statusDetails: {
689
+ // statusCode: 3,
690
+ // },
691
+ // },
692
+ // {
693
+ // id: 109370,
694
+ // message:
695
+ // '{"call_id":"1764099020.52","time_start":"2025-11-25 22:30:20","call_from":"004","call_to":"0782270052","call_duration":2,"talk_duration":129,"src_trunk_name":"","dst_trunk_name":"drtest3cx","pin_code":"","status":"NO ANSWER","type":"Outbound","recording":"","did_number":"","did_name":"","agent_ring_time":0,"uid":"202511252230209719F","call_note_id":"20251125223020-33142","enb_call_note":16}',
696
+ // time: '2025-10-06T10:53:38.000Z',
697
+ // direction: 'outbound',
698
+ // message_type: 'call',
699
+ // messageId: '121302f4-50ca-48c3-a32a-2d570064a000',
700
+ // is_live_agent: 0,
701
+ // is_deleted: 0,
702
+ // is_comment: 0,
703
+ // channel: 'voice_call',
704
+ // sent_to_vendor: 1,
705
+ // replyMessageId: null,
706
+
707
+ // agent_name: null,
708
+ // df_agent_name: null,
709
+ // resolve_time: null,
710
+ // metadata: null,
711
+ // statusDetails: {
712
+ // statusCode: 3,
713
+ // },
714
+ // },
669
715
  {
670
- id: 109370,
716
+ id: 109373,
671
717
  message:
672
- '{"call_id":"1764099020.52","time_start":"2025-11-25 22:30:20","call_from":"004","call_to":"0782270052","call_duration":2,"talk_duration":129,"src_trunk_name":"","dst_trunk_name":"drtest3cx","pin_code":"","status":"ANSWERED","type":"Outbound","recording":"","did_number":"","did_name":"","agent_ring_time":0,"uid":"202511252230209719F","call_note_id":"20251125223020-33142","enb_call_note":16}',
718
+ '{"type":"call","status":"in_progress","call_started_at":"2026-01-01T09:35:00.000Z","message":"Call in progress"}',
673
719
  time: '2025-10-06T10:53:38.000Z',
674
720
  direction: 'outbound',
675
- message_type: 'call',
721
+ message_type: 'interactive',
676
722
  messageId: '121302f4-50ca-48c3-a32a-2d570064a000',
677
723
  is_live_agent: 0,
678
724
  is_deleted: 0,
@@ -690,12 +736,58 @@ const Chat = () => {
690
736
  },
691
737
  },
692
738
  {
693
- id: 109370,
739
+ id: 109373,
694
740
  message:
695
- '{"call_id":"1764099020.52","time_start":"2025-11-25 22:30:20","call_from":"004","call_to":"0782270052","call_duration":2,"talk_duration":129,"src_trunk_name":"","dst_trunk_name":"drtest3cx","pin_code":"","status":"NO ANSWER","type":"Outbound","recording":"","did_number":"","did_name":"","agent_ring_time":0,"uid":"202511252230209719F","call_note_id":"20251125223020-33142","enb_call_note":16}',
741
+ '{"type":"call","status":"answered","call_started_at":"2026-01-01T09:35:00.000Z","message":{"call_id":"1764099020.52","time_start":"2025-11-25 22:30:20","call_from":"004","call_to":"0782270052","call_duration":2,"talk_duration":129,"src_trunk_name":"","dst_trunk_name":"drtest3cx","pin_code":"","status":"NO ANSWER","type":"Outbound","recording":"","did_number":"","did_name":"","agent_ring_time":0,"uid":"202511252230209719F","call_note_id":"20251125223020-33142","enb_call_note":16}}',
742
+ time: '2025-10-06T10:53:38.000Z',
743
+ direction: 'inbound',
744
+ message_type: 'interactive',
745
+ messageId: '121302f4-50ca-48c3-a32a-2d570064a000',
746
+ is_live_agent: 0,
747
+ is_deleted: 0,
748
+ is_comment: 0,
749
+ channel: 'voice_call',
750
+ sent_to_vendor: 1,
751
+ replyMessageId: null,
752
+
753
+ agent_name: null,
754
+ df_agent_name: null,
755
+ resolve_time: null,
756
+ metadata: null,
757
+ statusDetails: {
758
+ statusCode: 3,
759
+ },
760
+ },
761
+ {
762
+ id: 109373,
763
+ message:
764
+ '{"type":"call","status":"no answer","call_started_at":"2026-01-01T09:35:00.000Z","message":{"call_id":"1764099020.52","time_start":"2025-11-25 22:30:20","call_from":"004","call_to":"0782270052","call_duration":2,"talk_duration":129,"src_trunk_name":"","dst_trunk_name":"drtest3cx","pin_code":"","status":"NO ANSWER","type":"Outbound","recording":"","did_number":"","did_name":"","agent_ring_time":0,"uid":"202511252230209719F","call_note_id":"20251125223020-33142","enb_call_note":16}}',
765
+ time: '2025-10-06T10:53:38.000Z',
766
+ direction: 'inbound',
767
+ message_type: 'interactive',
768
+ messageId: '121302f4-50ca-48c3-a32a-2d570064a000',
769
+ is_live_agent: 0,
770
+ is_deleted: 0,
771
+ is_comment: 0,
772
+ channel: 'voice_call',
773
+ sent_to_vendor: 1,
774
+ replyMessageId: null,
775
+
776
+ agent_name: null,
777
+ df_agent_name: null,
778
+ resolve_time: null,
779
+ metadata: null,
780
+ statusDetails: {
781
+ statusCode: 3,
782
+ },
783
+ },
784
+ {
785
+ id: 109373,
786
+ message:
787
+ '{"type":"call","status":"no answer","call_started_at":"2026-01-01T09:35:00.000Z","message":{"call_id":"1764099020.52","time_start":"2025-11-25 22:30:20","call_from":"004","call_to":"0782270052","call_duration":2,"talk_duration":129,"src_trunk_name":"","dst_trunk_name":"drtest3cx","pin_code":"","status":"NO ANSWER","type":"Outbound","recording":"","did_number":"","did_name":"","agent_ring_time":0,"uid":"202511252230209719F","call_note_id":"20251125223020-33142","enb_call_note":16}}',
696
788
  time: '2025-10-06T10:53:38.000Z',
697
789
  direction: 'outbound',
698
- message_type: 'call',
790
+ message_type: 'interactive',
699
791
  messageId: '121302f4-50ca-48c3-a32a-2d570064a000',
700
792
  is_live_agent: 0,
701
793
  is_deleted: 0,
@@ -771,6 +863,12 @@ const Chat = () => {
771
863
  connector,
772
864
  };
773
865
  }
866
+ if (finalMessage?.type === 'call') {
867
+ return {
868
+ message: finalMessage,
869
+ connector: 'yeastar',
870
+ };
871
+ }
774
872
 
775
873
  console.log(finalMessage);
776
874
  return {
@@ -857,17 +955,16 @@ const Chat = () => {
857
955
  <GlobalStyle />
858
956
 
859
957
  {metaQuickReply.map((msg, idx) => {
860
- const isCall = msg.message_type === 'call';
861
958
  return msg.message_type !== 'text' ? (
862
959
  <BmChat.Details
863
960
  key={msg.id || idx} // Prefer a stable unique id if available
864
- state={!isCall && msg.direction}
961
+ state={msg.direction}
865
962
  session="bot"
866
- // displayTime={!isCall && && <p>12:00pm</p>}
867
- status={!isCall && 'sent'}
963
+ displayTime={<p>12:10pm</p>}
964
+ status="sent"
868
965
  type={msg.message_type}
869
966
  callLog={msg.message_type === 'call'}
870
- // sessionTimeline={!isCall && && <p>12:00pm</p>}
967
+ sessionTimeline={{ message: '12:00pm' }}
871
968
  style={{ margin: '-0.6% 0 0 0' }}
872
969
  metadata={determineMetadataMessageType(msg.metadata)}
873
970
  isInteractive={determineMetadataIsInteractive(msg.metadata)}
@@ -879,10 +976,10 @@ const Chat = () => {
879
976
  key={msg.id || idx} // Prefer a stable unique id if available
880
977
  state={msg.direction}
881
978
  session="bot"
882
- displayTime={<p>12:00pm</p>}
979
+ displayTime={<p>12:10pm</p>}
883
980
  status="sent"
884
981
  type="text"
885
- sessionTimeline={!isCall && { message: <p>12:00pm</p> }}
982
+ sessionTimeline={{ message: '12:00pm' }}
886
983
  style={{ margin: '-0.6% 0 0 0' }}
887
984
  metadata={determineMetadataMessageType(msg.metadata)}
888
985
  isInteractive={determineMetadataIsInteractive(msg.metadata)}
@@ -1,9 +1,14 @@
1
1
  /* eslint-disable react/no-array-index-key */
2
2
  /* eslint-disable no-nested-ternary */
3
3
  /* eslint-disable react/display-name */
4
- import React, { useState } from 'react';
4
+ import React, { useState, useEffect } from 'react';
5
5
  import { Done, DoneAll } from '@material-ui/icons';
6
6
  import FilePresentIcon from '@mui/icons-material/FilePresent';
7
+ import PhoneCallbackOutlinedIcon from '@mui/icons-material/PhoneCallbackOutlined';
8
+ import PhoneOutlinedIcon from '@mui/icons-material/PhoneOutlined';
9
+
10
+ import PhoneMissedIcon from '@mui/icons-material/PhoneMissed';
11
+
7
12
  import DownloadIcon from '@mui/icons-material/Download';
8
13
  import styled from 'styled-components';
9
14
  import Avatar from 'react-avatar';
@@ -26,10 +31,66 @@ import {
26
31
  BmPrimaryGold,
27
32
  } from '../../colors';
28
33
  import { BmFeedPostComments } from './FeedPostComments';
29
- import { CallPill } from './CallLog';
30
34
 
31
35
  pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;
32
36
 
37
+ const formatDuration = (totalSeconds) => {
38
+ const hours = Math.floor(totalSeconds / 3600);
39
+ const minutes = Math.floor((totalSeconds % 3600) / 60);
40
+ const seconds = totalSeconds % 60;
41
+
42
+ if (hours > 0) {
43
+ return (
44
+ `${String(hours).padStart(2, '0')}:` +
45
+ `${String(minutes).padStart(2, '0')}:` +
46
+ `${String(seconds).padStart(2, '0')}`
47
+ );
48
+ }
49
+
50
+ return (
51
+ `${String(minutes).padStart(2, '0')}:` +
52
+ `${String(seconds).padStart(2, '0')}`
53
+ );
54
+ };
55
+
56
+ const formatCallDuration = (totalSeconds) => {
57
+ // eslint-disable-next-line no-param-reassign
58
+ if (!totalSeconds || totalSeconds < 0) totalSeconds = 0;
59
+
60
+ const hours = Math.floor(totalSeconds / 3600);
61
+ const minutes = Math.floor((totalSeconds % 3600) / 60);
62
+ const seconds = totalSeconds % 60;
63
+
64
+ let result = '';
65
+ if (hours > 0) result += `${hours} hr `;
66
+ result += `${minutes} min ${seconds} sec`;
67
+
68
+ return result.trim();
69
+ };
70
+ const useCallDuration = (running, callStartedAt) => {
71
+ const [seconds, setSeconds] = useState(0);
72
+
73
+ useEffect(() => {
74
+ if (!running || !callStartedAt) return;
75
+
76
+ const startTime = new Date(callStartedAt).getTime();
77
+
78
+ const updateSeconds = () => {
79
+ const now = Date.now();
80
+ const elapsed = Math.max(Math.floor((now - startTime) / 1000), 0);
81
+ setSeconds(elapsed);
82
+ };
83
+
84
+ updateSeconds();
85
+
86
+ const intervalId = setInterval(updateSeconds, 1000);
87
+
88
+ return () => clearInterval(intervalId);
89
+ }, [running, callStartedAt]);
90
+
91
+ return formatDuration(seconds);
92
+ };
93
+
33
94
  const BmChat = styled.div`
34
95
  display: flex;
35
96
  flex-direction: column;
@@ -216,6 +277,62 @@ const CartContent = styled.div`
216
277
  }};
217
278
  `;
218
279
 
280
+ const CallContainer = styled.div`
281
+ display: flex;
282
+ flex-direction: row;
283
+ gap: 0.6rem;
284
+ align-items: center;
285
+ justify-content: center;
286
+ color: ${({ state }) => {
287
+ if (state) {
288
+ if (state === 'inbound') return `${BmPrimaryBlack}`;
289
+ if (state === 'outbound') return `${BmPrimaryWhite}`;
290
+ }
291
+ return `${BmPrimaryWhite}`;
292
+ }};
293
+ `;
294
+ const CallInfoContainer = styled.div`
295
+ display: flex;
296
+ padding-right: 1.5rem;
297
+ flex-direction: column;
298
+ gap: 0.3rem;
299
+ align-items: center;
300
+ justify-content: center;
301
+ color: ${({ state }) => {
302
+ if (state) {
303
+ if (state === 'inbound') return `${BmPrimaryBlack}`;
304
+ if (state === 'outbound') return `${BmPrimaryWhite}`;
305
+ }
306
+ return `${BmPrimaryWhite}`;
307
+ }};
308
+ & > :last-child {
309
+ color: ${({ state }) => (state === 'inbound' ? '#A6A29F' : '#cde3ddff')};
310
+ }
311
+ `;
312
+ const IconContainer = styled.div`
313
+ display: flex;
314
+ align-items: center;
315
+ justify-content: center;
316
+ width: max-content;
317
+ height: max-content;
318
+ padding: 0.8rem;
319
+ border: ${({ state }) => {
320
+ if (state) {
321
+ if (state === 'inbound') return `1px solid #F3F4F6`;
322
+ if (state === 'outbound') return `1px solid #5CC1C8`;
323
+ }
324
+ return `${BmPrimaryWhite}`;
325
+ }};
326
+
327
+ border-radius: 50%;
328
+ background-color: ${({ state }) => {
329
+ if (state) {
330
+ if (state === 'inbound') return `#F3F4F6`;
331
+ if (state === 'outbound') return `#5CC1C8`;
332
+ }
333
+ return `${BmPrimaryWhite}`;
334
+ }};
335
+ `;
219
336
  const MessagesSubDetails = styled.div`
220
337
  display: flex;
221
338
  flex-direction: row;
@@ -580,6 +697,95 @@ const ImageRender = ({
580
697
  </Messages>
581
698
  );
582
699
  };
700
+ const CallRender = ({
701
+ type,
702
+ state,
703
+ isInteractive,
704
+ connector,
705
+ message,
706
+ status,
707
+ call_started_at,
708
+ }) => {
709
+ const duration = useCallDuration(status === 'in_progress', call_started_at);
710
+ const renderers = {
711
+ yeastar: () => (
712
+ <>
713
+ {status === 'in_progress' && (
714
+ <CallContainer state={state}>
715
+ <IconContainer state={state}>
716
+ {state === 'inbound' ? (
717
+ <PhoneCallbackOutlinedIcon sx={{ color: '#4A5565' }} />
718
+ ) : (
719
+ <PhoneOutlinedIcon />
720
+ )}
721
+ </IconContainer>
722
+
723
+ <CallInfoContainer state={state}>
724
+ <h4>
725
+ <strong>Voice Call</strong>
726
+ </h4>
727
+
728
+ <p>{duration}</p>
729
+ </CallInfoContainer>
730
+ </CallContainer>
731
+ )}
732
+ {status === 'answered' && (
733
+ <CallContainer state={state}>
734
+ <IconContainer state={state}>
735
+ {state === 'inbound' ? (
736
+ <PhoneCallbackOutlinedIcon sx={{ color: '#4A5565' }} />
737
+ ) : (
738
+ <PhoneOutlinedIcon />
739
+ )}
740
+ </IconContainer>
741
+
742
+ <CallInfoContainer state={state}>
743
+ <h4>
744
+ <strong>Voice Call</strong>
745
+ </h4>
746
+
747
+ <p>{formatCallDuration(message.talk_duration)}</p>
748
+ </CallInfoContainer>
749
+ </CallContainer>
750
+ )}
751
+ {status === 'no answer' && (
752
+ <CallContainer state={state}>
753
+ <IconContainer state={state}>
754
+ <PhoneMissedIcon sx={{ color: '#e64d4dff' }} />
755
+ </IconContainer>
756
+
757
+ <CallInfoContainer state={state}>
758
+ <h4>
759
+ <strong>Voice Call</strong>
760
+ </h4>
761
+
762
+ <p>No answer</p>
763
+ </CallInfoContainer>
764
+ </CallContainer>
765
+ )}
766
+ </>
767
+ ),
768
+ };
769
+
770
+ const FallbackRenderer = () => (
771
+ <>
772
+ <div>{status}</div>
773
+ </>
774
+ );
775
+
776
+ const ConnectorRenderer = renderers[connector] || FallbackRenderer;
777
+ return (
778
+ <Messages
779
+ type={type}
780
+ state={state}
781
+ isInteractive={isInteractive}
782
+ connector={connector}
783
+ isImg
784
+ >
785
+ <ConnectorRenderer />
786
+ </Messages>
787
+ );
788
+ };
583
789
  const ProductDetailRender = ({ type, state, header, body, isInteractive }) => {
584
790
  return (
585
791
  <>
@@ -820,19 +1026,15 @@ BmChat.Details = ({
820
1026
  sessionTimeline,
821
1027
  feedPostComments,
822
1028
  agentName,
823
- callLog,
1029
+
824
1030
  metadata,
825
1031
  isInteractive,
826
1032
  type,
827
1033
  extension,
828
1034
  ...rest
829
1035
  }) => {
830
- console.log({ type });
831
- console.log(children);
832
- console.log(metadata);
833
1036
  return (
834
1037
  <>
835
- {type === 'call' && <CallPill message={children.message} />}
836
1038
  <Details state={state} {...rest}>
837
1039
  {/* Adding for mobile */}
838
1040
  <MessageState>
@@ -949,6 +1151,14 @@ BmChat.Details = ({
949
1151
  connector={children?.connector}
950
1152
  />
951
1153
  )}
1154
+ {children.message.type === 'call' && (
1155
+ <CallRender
1156
+ {...children.message}
1157
+ type={type}
1158
+ state={state}
1159
+ connector={children?.connector}
1160
+ />
1161
+ )}
952
1162
  </>
953
1163
  ) : type === 'pdf' ? (
954
1164
  <>
@@ -961,12 +1171,7 @@ BmChat.Details = ({
961
1171
  </Document>
962
1172
  </>
963
1173
  ) : (
964
- // : type === 'call' ? (
965
- // <CallPill message={children.message} />
966
- // )
967
- type !== 'call' && (
968
- <Messages state={state}>{children}</Messages>
969
- )
1174
+ <Messages state={state}>{children}</Messages>
970
1175
  )}
971
1176
  </>
972
1177
  )}
@@ -1,221 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CallPill = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _iconsMaterial = require("@mui/icons-material");
9
- var _styledComponents = _interopRequireDefault(require("styled-components"));
10
- var _dateFns = require("date-fns");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- // // CallPill.jsx
13
- // import React from 'react';
14
- // import styled from 'styled-components';
15
- // import PhoneIcon from '@mui/icons-material/Phone';
16
-
17
- // export const CallPill = ({ message, icon: Icon = PhoneIcon }) => {
18
- // if (!message) return null; // safety check
19
- // const formatDuration = (seconds) => {
20
- // const mins = Math.floor(seconds / 60);
21
- // const secs = seconds % 60;
22
-
23
- // const minsPart = mins ? `${mins} min${mins > 1 ? 's' : ''}` : '';
24
- // const secsPart = secs ? `${secs}s` : '';
25
-
26
- // return [minsPart, secsPart].filter(Boolean).join(' ');
27
- // };
28
-
29
- // console.log(message);
30
- // console.log('SSSSS');
31
- // const label = `${message.type} • ${message.status}`;
32
- // const duration = formatDuration(message.talk_duration);
33
- // console.log(`${label} • ${duration}`);
34
- // return (
35
- // <SessionTimelineWrapper>
36
- // <Container>
37
- // <IconWrapper>
38
- // <Icon fontSize="small" />
39
- // </IconWrapper>
40
- // <Text>
41
- // {label} • {duration}
42
- // </Text>
43
- // </Container>
44
- // </SessionTimelineWrapper>
45
- // );
46
- // };
47
- // const SessionTimelineWrapper = styled.div`
48
- // display: flex;
49
- // flex-direction: row;
50
- // justify-content: center;
51
- // align-items: center;
52
- // text-align: center;
53
- // margin-bottom: 0.5rem;
54
- // margin-top: 0.5rem;
55
- // `;
56
- // const Container = styled.div`
57
- // display: flex;
58
- // flex-direction: row;
59
- // justify-content: center;
60
- // align-items: center;
61
- // text-align: center;
62
- // /* display: inline-flex;
63
- // justify-content: center;
64
- // align-items: center; */
65
- // gap: 6px;
66
- // background: #f4f5f7;
67
- // border-radius: 999px;
68
- // padding: 6px 14px;
69
- // font-size: 14px;
70
- // color: #4a4a4a;
71
- // border: 1px solid #e2e2e2;
72
- // max-width: fit-content;
73
- // white-space: nowrap;
74
-
75
- // @media (max-width: 480px) {
76
- // font-size: 12px;
77
- // padding: 5px 10px;
78
- // }
79
- // `;
80
-
81
- // const IconWrapper = styled.div`
82
- // display: flex;
83
- // align-items: center;
84
- // `;
85
-
86
- // const Text = styled.span`
87
- // display: inline-block;
88
- // overflow: hidden;
89
- // text-overflow: ellipsis;
90
- // `;
91
-
92
- // // import PhoneIcon from '@mui/icons-material/Phone';
93
-
94
- // // export default {
95
- // // title: 'Components/CallPill',
96
- // // component: CallPill,
97
- // // argTypes: {
98
- // // icon: { control: false },
99
- // // },
100
- // // };
101
-
102
- // // const Template = (args) => <CallPill {...args} />;
103
-
104
- // // export const SampleNoAnswer = Template.bind({});
105
- // // SampleNoAnswer.args = {
106
- // // call: {
107
- // // call_id: '1764099020.52',
108
- // // time_start: '2025-11-25 22:30:20',
109
- // // call_from: '004',
110
- // // call_to: '0782270052',
111
- // // call_duration: 2,
112
- // // talk_duration: 0,
113
- // // src_trunk_name: '',
114
- // // dst_trunk_name: 'drtest3cx',
115
- // // pin_code: '',
116
- // // status: 'NO ANSWER',
117
- // // type: 'Outbound',
118
- // // recording: '',
119
- // // did_number: '',
120
- // // did_name: '',
121
- // // agent_ring_time: 0,
122
- // // uid: '202511252230209719F',
123
- // // call_note_id: '20251125223020-33142',
124
- // // enb_call_note: 16,
125
- // // },
126
- // // icon: PhoneIcon,
127
- // // };
128
-
129
- // // export const SampleAnswered = Template.bind({});
130
- // // SampleAnswered.args = {
131
- // // call: {
132
- // // call_id: '1764099020.52',
133
- // // time_start: '2025-11-25 22:30:20',
134
- // // call_from: '004',
135
- // // call_to: '0782270052',
136
- // // call_duration: 2,
137
- // // talk_duration: 7,
138
- // // src_trunk_name: '',
139
- // // dst_trunk_name: 'drtest3cx',
140
- // // pin_code: '',
141
- // // status: 'ANSWERED',
142
- // // type: 'Outbound',
143
- // // recording: '',
144
- // // did_number: '',
145
- // // did_name: '',
146
- // // agent_ring_time: 0,
147
- // // uid: '202511252230209719F',
148
- // // call_note_id: '20251125223020-33142',
149
- // // enb_call_note: 16,
150
- // // },
151
- // // icon: PhoneIcon,
152
- // // };
153
-
154
- const SessionTimelineWrapper = _styledComponents.default.div.withConfig({
155
- displayName: "CallLog__SessionTimelineWrapper"
156
- })(["display:flex;flex-direction:row;justify-content:center;align-items:center;text-align:center;margin-bottom:0.5rem;margin-top:0.5rem;"]);
157
- const Container = _styledComponents.default.div.withConfig({
158
- displayName: "CallLog__Container"
159
- })(["display:flex;align-items:center;padding:6px 9px;border-radius:14px;font-size:0.875rem;border:0.5px solid ", ";background-color:", ";color:", ";box-shadow:0 2px 4px rgba(0,0,0,0.1);"], _ref => {
160
- let {
161
- status
162
- } = _ref;
163
- return status === 'NO ANSWER' ? '#FEE2E2' : '#e0e0e0';
164
- }, _ref2 => {
165
- let {
166
- status
167
- } = _ref2;
168
- return status === 'NO ANSWER' ? '#FEF2F2' : '#f0f0f0';
169
- }, _ref3 => {
170
- let {
171
- status
172
- } = _ref3;
173
- return status === 'NO ANSWER' ? 'red' : '#6A7282';
174
- });
175
- const IconWrapper = _styledComponents.default.span.withConfig({
176
- displayName: "CallLog__IconWrapper"
177
- })(["display:flex;margin-right:0.575rem;svg{color:", ";font-size:", ";@media (min-width:45.7143rem){font-size:calc(", " * 1.15);}@media (min-width:73.1429rem){font-size:calc(", " * 1.3);}}"], _ref4 => {
178
- let {
179
- color
180
- } = _ref4;
181
- return color || 'inherit';
182
- }, _ref5 => {
183
- let {
184
- size
185
- } = _ref5;
186
- return size || '0.875rem';
187
- }, _ref6 => {
188
- let {
189
- size
190
- } = _ref6;
191
- return size || '0.875rem';
192
- }, _ref7 => {
193
- let {
194
- size
195
- } = _ref7;
196
- return size || '0.875rem';
197
- });
198
- const Text = _styledComponents.default.span.withConfig({
199
- displayName: "CallLog__Text"
200
- })(["font-size:inherit;font-weight:400;"]);
201
- const CallPill = _ref8 => {
202
- let {
203
- message
204
- } = _ref8;
205
- if (!message) return null;
206
- const label = message.status === 'NO ANSWER' ? 'Missed call' : 'Answered call';
207
- const formatDuration = seconds => {
208
- const mins = Math.floor(seconds / 60);
209
- const secs = seconds % 60;
210
- const minsPart = mins ? "".concat(mins, " min").concat(mins > 1 ? 's' : '') : '';
211
- const secsPart = secs ? "".concat(secs, "s") : '';
212
- return [minsPart, secsPart].filter(Boolean).join(' ');
213
- };
214
- const formattedTime = (0, _dateFns.format)(new Date(message.time_start), 'M/d/yyyy hh:mm a');
215
- const Icon = message.status === 'NO ANSWER' ? _iconsMaterial.PhoneMissedOutlined : _iconsMaterial.Phone;
216
- const duration = message.status === 'NO ANSWER' ? formattedTime : formatDuration(message.talk_duration);
217
- return /*#__PURE__*/_react.default.createElement(SessionTimelineWrapper, null, /*#__PURE__*/_react.default.createElement(Container, {
218
- status: message.status
219
- }, /*#__PURE__*/_react.default.createElement(IconWrapper, null, /*#__PURE__*/_react.default.createElement(Icon, null)), /*#__PURE__*/_react.default.createElement(Text, null, label, " \u2022 ", duration)));
220
- };
221
- exports.CallPill = CallPill;