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.
@@ -1,238 +0,0 @@
1
- // // CallPill.jsx
2
- // import React from 'react';
3
- // import styled from 'styled-components';
4
- // import PhoneIcon from '@mui/icons-material/Phone';
5
-
6
- // export const CallPill = ({ message, icon: Icon = PhoneIcon }) => {
7
- // if (!message) return null; // safety check
8
- // const formatDuration = (seconds) => {
9
- // const mins = Math.floor(seconds / 60);
10
- // const secs = seconds % 60;
11
-
12
- // const minsPart = mins ? `${mins} min${mins > 1 ? 's' : ''}` : '';
13
- // const secsPart = secs ? `${secs}s` : '';
14
-
15
- // return [minsPart, secsPart].filter(Boolean).join(' ');
16
- // };
17
-
18
- // console.log(message);
19
- // console.log('SSSSS');
20
- // const label = `${message.type} • ${message.status}`;
21
- // const duration = formatDuration(message.talk_duration);
22
- // console.log(`${label} • ${duration}`);
23
- // return (
24
- // <SessionTimelineWrapper>
25
- // <Container>
26
- // <IconWrapper>
27
- // <Icon fontSize="small" />
28
- // </IconWrapper>
29
- // <Text>
30
- // {label} • {duration}
31
- // </Text>
32
- // </Container>
33
- // </SessionTimelineWrapper>
34
- // );
35
- // };
36
- // const SessionTimelineWrapper = styled.div`
37
- // display: flex;
38
- // flex-direction: row;
39
- // justify-content: center;
40
- // align-items: center;
41
- // text-align: center;
42
- // margin-bottom: 0.5rem;
43
- // margin-top: 0.5rem;
44
- // `;
45
- // const Container = styled.div`
46
- // display: flex;
47
- // flex-direction: row;
48
- // justify-content: center;
49
- // align-items: center;
50
- // text-align: center;
51
- // /* display: inline-flex;
52
- // justify-content: center;
53
- // align-items: center; */
54
- // gap: 6px;
55
- // background: #f4f5f7;
56
- // border-radius: 999px;
57
- // padding: 6px 14px;
58
- // font-size: 14px;
59
- // color: #4a4a4a;
60
- // border: 1px solid #e2e2e2;
61
- // max-width: fit-content;
62
- // white-space: nowrap;
63
-
64
- // @media (max-width: 480px) {
65
- // font-size: 12px;
66
- // padding: 5px 10px;
67
- // }
68
- // `;
69
-
70
- // const IconWrapper = styled.div`
71
- // display: flex;
72
- // align-items: center;
73
- // `;
74
-
75
- // const Text = styled.span`
76
- // display: inline-block;
77
- // overflow: hidden;
78
- // text-overflow: ellipsis;
79
- // `;
80
-
81
- // // import PhoneIcon from '@mui/icons-material/Phone';
82
-
83
- // // export default {
84
- // // title: 'Components/CallPill',
85
- // // component: CallPill,
86
- // // argTypes: {
87
- // // icon: { control: false },
88
- // // },
89
- // // };
90
-
91
- // // const Template = (args) => <CallPill {...args} />;
92
-
93
- // // export const SampleNoAnswer = Template.bind({});
94
- // // SampleNoAnswer.args = {
95
- // // call: {
96
- // // call_id: '1764099020.52',
97
- // // time_start: '2025-11-25 22:30:20',
98
- // // call_from: '004',
99
- // // call_to: '0782270052',
100
- // // call_duration: 2,
101
- // // talk_duration: 0,
102
- // // src_trunk_name: '',
103
- // // dst_trunk_name: 'drtest3cx',
104
- // // pin_code: '',
105
- // // status: 'NO ANSWER',
106
- // // type: 'Outbound',
107
- // // recording: '',
108
- // // did_number: '',
109
- // // did_name: '',
110
- // // agent_ring_time: 0,
111
- // // uid: '202511252230209719F',
112
- // // call_note_id: '20251125223020-33142',
113
- // // enb_call_note: 16,
114
- // // },
115
- // // icon: PhoneIcon,
116
- // // };
117
-
118
- // // export const SampleAnswered = Template.bind({});
119
- // // SampleAnswered.args = {
120
- // // call: {
121
- // // call_id: '1764099020.52',
122
- // // time_start: '2025-11-25 22:30:20',
123
- // // call_from: '004',
124
- // // call_to: '0782270052',
125
- // // call_duration: 2,
126
- // // talk_duration: 7,
127
- // // src_trunk_name: '',
128
- // // dst_trunk_name: 'drtest3cx',
129
- // // pin_code: '',
130
- // // status: 'ANSWERED',
131
- // // type: 'Outbound',
132
- // // recording: '',
133
- // // did_number: '',
134
- // // did_name: '',
135
- // // agent_ring_time: 0,
136
- // // uid: '202511252230209719F',
137
- // // call_note_id: '20251125223020-33142',
138
- // // enb_call_note: 16,
139
- // // },
140
- // // icon: PhoneIcon,
141
- // // };
142
-
143
- import React from 'react';
144
- import {
145
- Phone as PhoneIcon,
146
- PhoneMissedOutlined as MissedCallIcon,
147
- } from '@mui/icons-material';
148
- import styled from 'styled-components';
149
- import { format } from 'date-fns';
150
-
151
- const SessionTimelineWrapper = styled.div`
152
- display: flex;
153
- flex-direction: row;
154
- justify-content: center;
155
- align-items: center;
156
- text-align: center;
157
- margin-bottom: 0.5rem;
158
- margin-top: 0.5rem;
159
- `;
160
- const Container = styled.div`
161
- display: flex;
162
- align-items: center;
163
-
164
- padding: 6px 9px;
165
- border-radius: 14px;
166
- font-size: 0.875rem;
167
- border: 0.5px solid
168
- ${({ status }) => (status === 'NO ANSWER' ? '#FEE2E2' : '#e0e0e0')};
169
- background-color: ${({ status }) =>
170
- status === 'NO ANSWER' ? '#FEF2F2' : '#f0f0f0'};
171
- color: ${({ status }) => (status === 'NO ANSWER' ? 'red' : '#6A7282')};
172
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
173
- `;
174
-
175
- const IconWrapper = styled.span`
176
- display: flex;
177
-
178
- margin-right: 0.575rem;
179
-
180
- svg {
181
- color: ${({ color }) => color || 'inherit'};
182
- font-size: ${({ size }) => size || '0.875rem'};
183
-
184
- @media (min-width: 45.7143rem) {
185
- font-size: calc(${({ size }) => size || '0.875rem'} * 1.15);
186
- }
187
-
188
- @media (min-width: 73.1429rem) {
189
- font-size: calc(${({ size }) => size || '0.875rem'} * 1.3);
190
- }
191
- }
192
- `;
193
-
194
- const Text = styled.span`
195
- font-size: inherit;
196
- font-weight: 400;
197
- `;
198
-
199
- export const CallPill = ({ message }) => {
200
- if (!message) return null;
201
-
202
- const label =
203
- message.status === 'NO ANSWER' ? 'Missed call' : 'Answered call';
204
-
205
- const formatDuration = (seconds) => {
206
- const mins = Math.floor(seconds / 60);
207
- const secs = seconds % 60;
208
-
209
- const minsPart = mins ? `${mins} min${mins > 1 ? 's' : ''}` : '';
210
- const secsPart = secs ? `${secs}s` : '';
211
-
212
- return [minsPart, secsPart].filter(Boolean).join(' ');
213
- };
214
-
215
- const formattedTime = format(
216
- new Date(message.time_start),
217
- 'M/d/yyyy hh:mm a'
218
- );
219
-
220
- const Icon = message.status === 'NO ANSWER' ? MissedCallIcon : PhoneIcon;
221
- const duration =
222
- message.status === 'NO ANSWER'
223
- ? formattedTime
224
- : formatDuration(message.talk_duration);
225
-
226
- return (
227
- <SessionTimelineWrapper>
228
- <Container status={message.status}>
229
- <IconWrapper>
230
- <Icon />
231
- </IconWrapper>
232
- <Text>
233
- {label} • {duration}
234
- </Text>
235
- </Container>
236
- </SessionTimelineWrapper>
237
- );
238
- };