call-control-sdk 1.0.0 → 2.0.0

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.
@@ -0,0 +1,30 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface CallData {
4
+ mobileNumber: string;
5
+ callReferenceId: string;
6
+ agentLoginId: string;
7
+ }
8
+ interface CallControlPanelProps {
9
+ onDataChange?: (data: CallData) => void;
10
+ }
11
+
12
+ declare function CallControlPanel({ onDataChange }: CallControlPanelProps): react_jsx_runtime.JSX.Element;
13
+
14
+ /**
15
+ * Initialize the Call Control SDK with an API key
16
+ * @param sdkApiKey - The API key for SDK authentication
17
+ * @throws {Error} When API key is missing or invalid
18
+ */
19
+ declare function initCallSDK(sdkApiKey: string): void;
20
+ /**
21
+ * Update call data (used by host application)
22
+ * @param data - Partial call data to update
23
+ */
24
+ declare function updateCallData(data: {
25
+ mobileNumber?: string;
26
+ callReferenceId?: string;
27
+ agentLoginId?: string;
28
+ }): void;
29
+
30
+ export { CallControlPanel, initCallSDK, updateCallData };
@@ -0,0 +1,30 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface CallData {
4
+ mobileNumber: string;
5
+ callReferenceId: string;
6
+ agentLoginId: string;
7
+ }
8
+ interface CallControlPanelProps {
9
+ onDataChange?: (data: CallData) => void;
10
+ }
11
+
12
+ declare function CallControlPanel({ onDataChange }: CallControlPanelProps): react_jsx_runtime.JSX.Element;
13
+
14
+ /**
15
+ * Initialize the Call Control SDK with an API key
16
+ * @param sdkApiKey - The API key for SDK authentication
17
+ * @throws {Error} When API key is missing or invalid
18
+ */
19
+ declare function initCallSDK(sdkApiKey: string): void;
20
+ /**
21
+ * Update call data (used by host application)
22
+ * @param data - Partial call data to update
23
+ */
24
+ declare function updateCallData(data: {
25
+ mobileNumber?: string;
26
+ callReferenceId?: string;
27
+ agentLoginId?: string;
28
+ }): void;
29
+
30
+ export { CallControlPanel, initCallSDK, updateCallData };
package/dist/index.js ADDED
@@ -0,0 +1,630 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
+
22
+ // src/index.ts
23
+ var index_exports = {};
24
+ __export(index_exports, {
25
+ CallControlPanel: () => CallControlPanel,
26
+ initCallSDK: () => initCallSDK,
27
+ updateCallData: () => updateCallData
28
+ });
29
+ module.exports = __toCommonJS(index_exports);
30
+
31
+ // src/lib/sdk-state.ts
32
+ var SDKStateManager = class {
33
+ constructor() {
34
+ __publicField(this, "state");
35
+ __publicField(this, "listeners", []);
36
+ __publicField(this, "STORAGE_KEY", "call-control-sdk-state");
37
+ this.state = this.getInitialState();
38
+ this.loadFromStorage();
39
+ }
40
+ getInitialState() {
41
+ return {
42
+ apiKey: null,
43
+ isInitialized: false,
44
+ isHolding: false,
45
+ isMuted: false,
46
+ status: "idle",
47
+ callStartTime: null,
48
+ position: { x: 50, y: 50 },
49
+ callData: {
50
+ mobileNumber: "",
51
+ callReferenceId: "",
52
+ agentLoginId: ""
53
+ }
54
+ };
55
+ }
56
+ loadFromStorage() {
57
+ try {
58
+ const stored = localStorage.getItem(this.STORAGE_KEY);
59
+ if (stored) {
60
+ const parsedState = JSON.parse(stored);
61
+ this.state = {
62
+ ...this.state,
63
+ isHolding: parsedState.isHolding || false,
64
+ isMuted: parsedState.isMuted || false,
65
+ status: parsedState.status || "idle",
66
+ position: parsedState.position || { x: 50, y: 50 },
67
+ callStartTime: parsedState.callStartTime || null
68
+ };
69
+ }
70
+ } catch (error) {
71
+ console.warn("Failed to load SDK state from localStorage:", error);
72
+ }
73
+ }
74
+ saveToStorage() {
75
+ try {
76
+ const persistentState = {
77
+ isHolding: this.state.isHolding,
78
+ isMuted: this.state.isMuted,
79
+ status: this.state.status,
80
+ position: this.state.position,
81
+ callStartTime: this.state.callStartTime
82
+ };
83
+ localStorage.setItem(this.STORAGE_KEY, JSON.stringify(persistentState));
84
+ } catch (error) {
85
+ console.warn("Failed to save SDK state to localStorage:", error);
86
+ }
87
+ }
88
+ notifyListeners() {
89
+ this.listeners.forEach((listener) => listener());
90
+ }
91
+ initialize(apiKey) {
92
+ if (!apiKey || typeof apiKey !== "string" || apiKey.trim().length === 0) {
93
+ throw new Error("API key not available");
94
+ }
95
+ this.state.apiKey = apiKey;
96
+ this.state.isInitialized = true;
97
+ this.notifyListeners();
98
+ }
99
+ getState() {
100
+ return { ...this.state };
101
+ }
102
+ subscribe(listener) {
103
+ this.listeners.push(listener);
104
+ return () => {
105
+ const index = this.listeners.indexOf(listener);
106
+ if (index > -1) {
107
+ this.listeners.splice(index, 1);
108
+ }
109
+ };
110
+ }
111
+ setHolding(isHolding) {
112
+ this.state.isHolding = isHolding;
113
+ this.saveToStorage();
114
+ this.notifyListeners();
115
+ }
116
+ setMuted(isMuted) {
117
+ this.state.isMuted = isMuted;
118
+ this.saveToStorage();
119
+ this.notifyListeners();
120
+ }
121
+ setStatus(status) {
122
+ this.state.status = status;
123
+ this.saveToStorage();
124
+ this.notifyListeners();
125
+ }
126
+ setPosition(position) {
127
+ this.state.position = position;
128
+ this.saveToStorage();
129
+ this.notifyListeners();
130
+ }
131
+ startCall() {
132
+ this.state.callStartTime = Date.now();
133
+ this.state.status = "ready";
134
+ this.saveToStorage();
135
+ this.notifyListeners();
136
+ }
137
+ endCall() {
138
+ this.state.callStartTime = null;
139
+ this.state.status = "idle";
140
+ this.state.isHolding = false;
141
+ this.state.isMuted = false;
142
+ this.saveToStorage();
143
+ this.notifyListeners();
144
+ }
145
+ updateCallData(data) {
146
+ this.state.callData = { ...this.state.callData, ...data };
147
+ this.notifyListeners();
148
+ }
149
+ };
150
+ var sdkStateManager = new SDKStateManager();
151
+
152
+ // src/lib/components/CallControlPanel.tsx
153
+ var import_react3 = require("react");
154
+ var import_material = require("@mui/material");
155
+ var import_icons_material = require("@mui/icons-material");
156
+
157
+ // src/lib/hooks/useSDKState.ts
158
+ var import_react = require("react");
159
+ function useSDKState() {
160
+ const [state, setState] = (0, import_react.useState)(sdkStateManager.getState());
161
+ (0, import_react.useEffect)(() => {
162
+ const unsubscribe = sdkStateManager.subscribe(() => {
163
+ setState(sdkStateManager.getState());
164
+ });
165
+ return unsubscribe;
166
+ }, []);
167
+ return state;
168
+ }
169
+
170
+ // src/lib/hooks/useDraggable.ts
171
+ var import_react2 = require("react");
172
+ function useDraggable(initialPosition, onPositionChange) {
173
+ const [position, setPosition] = (0, import_react2.useState)(initialPosition);
174
+ const [isDragging, setIsDragging] = (0, import_react2.useState)(false);
175
+ const dragRef = (0, import_react2.useRef)(null);
176
+ const dragStart = (0, import_react2.useRef)({ x: 0, y: 0 });
177
+ const elementStart = (0, import_react2.useRef)({ x: 0, y: 0 });
178
+ const updatePosition = (0, import_react2.useCallback)(
179
+ (newPosition) => {
180
+ const element = dragRef.current;
181
+ if (!element) return;
182
+ const rect = element.getBoundingClientRect();
183
+ const viewportWidth = window.innerWidth;
184
+ const viewportHeight = window.innerHeight;
185
+ const constrainedPosition = {
186
+ x: Math.max(0, Math.min(newPosition.x, viewportWidth - rect.width)),
187
+ y: Math.max(0, Math.min(newPosition.y, viewportHeight - rect.height))
188
+ };
189
+ setPosition(constrainedPosition);
190
+ onPositionChange?.(constrainedPosition);
191
+ },
192
+ [onPositionChange]
193
+ );
194
+ const handleStart = (0, import_react2.useCallback)(
195
+ (clientX, clientY) => {
196
+ setIsDragging(true);
197
+ dragStart.current = { x: clientX, y: clientY };
198
+ elementStart.current = position;
199
+ const handleMove = (moveClientX, moveClientY) => {
200
+ const deltaX = moveClientX - dragStart.current.x;
201
+ const deltaY = moveClientY - dragStart.current.y;
202
+ const newPosition = {
203
+ x: elementStart.current.x + deltaX,
204
+ y: elementStart.current.y + deltaY
205
+ };
206
+ updatePosition(newPosition);
207
+ };
208
+ const handleMouseMove = (e) => {
209
+ e.preventDefault();
210
+ handleMove(e.clientX, e.clientY);
211
+ };
212
+ const handleTouchMove = (e) => {
213
+ e.preventDefault();
214
+ const touch = e.touches[0];
215
+ if (touch) {
216
+ handleMove(touch.clientX, touch.clientY);
217
+ }
218
+ };
219
+ const handleEnd = () => {
220
+ setIsDragging(false);
221
+ document.removeEventListener("mousemove", handleMouseMove);
222
+ document.removeEventListener("mouseup", handleEnd);
223
+ document.removeEventListener("touchmove", handleTouchMove);
224
+ document.removeEventListener("touchend", handleEnd);
225
+ };
226
+ document.addEventListener("mousemove", handleMouseMove);
227
+ document.addEventListener("mouseup", handleEnd);
228
+ document.addEventListener("touchmove", handleTouchMove, {
229
+ passive: false
230
+ });
231
+ document.addEventListener("touchend", handleEnd);
232
+ },
233
+ [position, updatePosition]
234
+ );
235
+ const handleMouseDown = (0, import_react2.useCallback)(
236
+ (e) => {
237
+ e.preventDefault();
238
+ handleStart(e.clientX, e.clientY);
239
+ },
240
+ [handleStart]
241
+ );
242
+ const handleTouchStart = (0, import_react2.useCallback)(
243
+ (e) => {
244
+ e.preventDefault();
245
+ const touch = e.touches[0];
246
+ if (touch) {
247
+ handleStart(touch.clientX, touch.clientY);
248
+ }
249
+ },
250
+ [handleStart]
251
+ );
252
+ return {
253
+ position,
254
+ isDragging,
255
+ dragRef,
256
+ handleMouseDown,
257
+ handleTouchStart
258
+ };
259
+ }
260
+
261
+ // src/lib/components/CallControlPanel.tsx
262
+ var import_jsx_runtime = require("react/jsx-runtime");
263
+ function CallControlPanel({ onDataChange }) {
264
+ const theme = (0, import_material.useTheme)();
265
+ const state = useSDKState();
266
+ const [anchorEl, setAnchorEl] = (0, import_react3.useState)(null);
267
+ const [moreOptionsAnchorEl, setMoreOptionsAnchorEl] = (0, import_react3.useState)(null);
268
+ const [callDuration, setCallDuration] = (0, import_react3.useState)(0);
269
+ const { position, isDragging, dragRef, handleMouseDown, handleTouchStart } = useDraggable(
270
+ state.position,
271
+ (newPosition) => sdkStateManager.setPosition(newPosition)
272
+ );
273
+ (0, import_react3.useEffect)(() => {
274
+ let interval;
275
+ if (state.callStartTime) {
276
+ interval = setInterval(() => {
277
+ const elapsed = Math.floor((Date.now() - state.callStartTime) / 1e3);
278
+ setCallDuration(elapsed);
279
+ }, 1e3);
280
+ } else {
281
+ setCallDuration(0);
282
+ }
283
+ return () => {
284
+ if (interval) clearInterval(interval);
285
+ };
286
+ }, [state.callStartTime]);
287
+ (0, import_react3.useEffect)(() => {
288
+ if (onDataChange) {
289
+ onDataChange(state.callData);
290
+ }
291
+ }, [state.callData, onDataChange]);
292
+ const formatDuration = (0, import_react3.useCallback)((seconds) => {
293
+ const mins = Math.floor(seconds / 60);
294
+ const secs = seconds % 60;
295
+ return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
296
+ }, []);
297
+ const getStatusColor = (0, import_react3.useCallback)((status) => {
298
+ switch (status) {
299
+ case "ready":
300
+ return "success";
301
+ case "break":
302
+ return "warning";
303
+ case "idle":
304
+ return "default";
305
+ default:
306
+ return "default";
307
+ }
308
+ }, []);
309
+ const handleHoldToggle = () => {
310
+ sdkStateManager.setHolding(!state.isHolding);
311
+ };
312
+ const handleMuteToggle = () => {
313
+ sdkStateManager.setMuted(!state.isMuted);
314
+ };
315
+ const handleStatusChange = (newStatus) => {
316
+ sdkStateManager.setStatus(newStatus);
317
+ setAnchorEl(null);
318
+ };
319
+ const handleEndCall = () => {
320
+ sdkStateManager.endCall();
321
+ };
322
+ const handleStartCall = () => {
323
+ sdkStateManager.startCall();
324
+ };
325
+ const handleMoreClick = (event) => {
326
+ setAnchorEl(event.currentTarget);
327
+ };
328
+ const handleMoreOptions = (event) => {
329
+ setMoreOptionsAnchorEl(event.currentTarget);
330
+ };
331
+ const handleMoreClose = () => {
332
+ setAnchorEl(null);
333
+ };
334
+ const handleMoreOptionsClose = () => {
335
+ setMoreOptionsAnchorEl(null);
336
+ };
337
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
338
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Fade, { in: true, timeout: 300, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
339
+ import_material.Paper,
340
+ {
341
+ ref: dragRef,
342
+ elevation: isDragging ? 2 : 1,
343
+ sx: {
344
+ position: "fixed",
345
+ left: position.x,
346
+ top: position.y,
347
+ p: 1,
348
+ borderRadius: 3,
349
+ bgcolor: "background.paper",
350
+ cursor: isDragging ? "grabbing" : "grab",
351
+ transition: theme.transitions.create(["box-shadow", "transform"], {
352
+ duration: theme.transitions.duration.short
353
+ }),
354
+ transform: isDragging ? "scale(1.01)" : "scale(1)",
355
+ minWidth: 320,
356
+ userSelect: "none"
357
+ },
358
+ onMouseDown: handleMouseDown,
359
+ onTouchStart: handleTouchStart,
360
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
361
+ import_material.Box,
362
+ {
363
+ sx: {
364
+ display: "flex",
365
+ alignItems: "center"
366
+ },
367
+ children: [
368
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
369
+ import_material.Box,
370
+ {
371
+ sx: {
372
+ display: "flex",
373
+ justifyContent: "space-between",
374
+ alignItems: "center"
375
+ },
376
+ children: [
377
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
378
+ import_material.Typography,
379
+ {
380
+ variant: "h6",
381
+ sx: {
382
+ color: state.callStartTime ? "success.main" : "text.secondary",
383
+ marginRight: "8px",
384
+ display: "flex",
385
+ justifyContent: "space-between",
386
+ alignItems: "center"
387
+ },
388
+ children: [
389
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
390
+ import_icons_material.DragIndicator,
391
+ {
392
+ sx: {
393
+ marginRight: "10px"
394
+ }
395
+ }
396
+ ),
397
+ " ",
398
+ formatDuration(callDuration)
399
+ ]
400
+ }
401
+ ),
402
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Tooltip, { title: "Status", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
403
+ import_material.Button,
404
+ {
405
+ sx: {
406
+ backgroundColor: getStatusColor(state.status),
407
+ fontWeight: "bold",
408
+ borderRadius: "16px",
409
+ display: "flex",
410
+ alignItems: "center",
411
+ justifyContent: "space-between",
412
+ marginRight: "8px"
413
+ },
414
+ onClick: (e) => {
415
+ e.stopPropagation();
416
+ handleMoreClick(e);
417
+ },
418
+ variant: "outlined",
419
+ children: [
420
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
421
+ import_material.Typography,
422
+ {
423
+ width: 50,
424
+ variant: "body2",
425
+ sx: {
426
+ fontWeight: "bold"
427
+ },
428
+ children: state.status.toUpperCase()
429
+ }
430
+ ),
431
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.KeyboardArrowDown, {})
432
+ ]
433
+ }
434
+ ) })
435
+ ]
436
+ }
437
+ ),
438
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
439
+ import_material.Box,
440
+ {
441
+ sx: {
442
+ display: "flex",
443
+ gap: 1,
444
+ justifyContent: "center",
445
+ alignItems: "center"
446
+ },
447
+ children: [
448
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Tooltip, { title: "Redial", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
449
+ import_material.IconButton,
450
+ {
451
+ onClick: (e) => {
452
+ e.stopPropagation();
453
+ },
454
+ color: "default",
455
+ sx: {
456
+ bgcolor: "action.hover",
457
+ "&:hover": {
458
+ bgcolor: "warning"
459
+ }
460
+ },
461
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Cached, {})
462
+ }
463
+ ) }),
464
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Tooltip, { title: state.isHolding ? "Resume" : "Hold", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
465
+ import_material.IconButton,
466
+ {
467
+ onClick: (e) => {
468
+ e.stopPropagation();
469
+ handleHoldToggle();
470
+ },
471
+ color: state.isHolding ? "warning" : "default",
472
+ sx: {
473
+ bgcolor: state.isHolding ? "warning.info" : "action.hover"
474
+ },
475
+ children: state.isHolding ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.PlayCircle, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.PauseCircle, {})
476
+ }
477
+ ) }),
478
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Tooltip, { title: state.isMuted ? "Unmute" : "Mute", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
479
+ import_material.IconButton,
480
+ {
481
+ onClick: (e) => {
482
+ e.stopPropagation();
483
+ handleMuteToggle();
484
+ },
485
+ color: state.isMuted ? "error" : "default",
486
+ sx: {
487
+ bgcolor: state.isMuted ? "error.info" : "action.hover"
488
+ },
489
+ children: state.isMuted ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.MicOff, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Mic, {})
490
+ }
491
+ ) }),
492
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Tooltip, { title: "More Options", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
493
+ import_material.IconButton,
494
+ {
495
+ onClick: (e) => {
496
+ e.stopPropagation();
497
+ handleMoreOptions(e);
498
+ },
499
+ sx: {
500
+ bgcolor: "action.hover",
501
+ "&:hover": { bgcolor: "action.selected" }
502
+ },
503
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.MoreVert, {})
504
+ }
505
+ ) }),
506
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Tooltip, { title: state.callStartTime ? "End Call" : "Start Call", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
507
+ import_material.IconButton,
508
+ {
509
+ onClick: (e) => {
510
+ e.stopPropagation();
511
+ (state.callStartTime ? handleEndCall : handleStartCall)();
512
+ },
513
+ color: "error",
514
+ sx: {
515
+ bgcolor: state.callStartTime ? "error.main" : "success.light",
516
+ color: "white",
517
+ "&:hover": {
518
+ bgcolor: state.callStartTime ? "error.light" : "success.dark"
519
+ }
520
+ },
521
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.CallEnd, {})
522
+ }
523
+ ) })
524
+ ]
525
+ }
526
+ )
527
+ ]
528
+ }
529
+ )
530
+ }
531
+ ) }),
532
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
533
+ import_material.Menu,
534
+ {
535
+ anchorEl,
536
+ open: Boolean(anchorEl),
537
+ onClose: handleMoreClose,
538
+ onClick: (e) => e.stopPropagation(),
539
+ children: [
540
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
541
+ import_material.MenuItem,
542
+ {
543
+ onClick: () => handleStatusChange("ready"),
544
+ sx: {
545
+ backgroundColor: state.status === "ready" ? "#0038f01c" : "initial"
546
+ },
547
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
548
+ import_material.Box,
549
+ {
550
+ sx: {
551
+ display: "flex",
552
+ alignItems: "center",
553
+ gap: 1
554
+ },
555
+ children: [
556
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Phone, { color: "success" }),
557
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { children: "Ready" })
558
+ ]
559
+ }
560
+ )
561
+ }
562
+ ),
563
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
564
+ import_material.MenuItem,
565
+ {
566
+ onClick: () => handleStatusChange("break"),
567
+ sx: {
568
+ backgroundColor: state.status === "break" ? "#0038f01c" : "initial"
569
+ },
570
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
571
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.FreeBreakfast, { color: "error" }),
572
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { children: "Break" })
573
+ ] })
574
+ }
575
+ ),
576
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
577
+ import_material.MenuItem,
578
+ {
579
+ onClick: () => handleStatusChange("idle"),
580
+ sx: {
581
+ backgroundColor: state.status === "idle" ? "#0038f01c" : "initial"
582
+ },
583
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
584
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.AirlineSeatIndividualSuite, { color: "warning" }),
585
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { children: "Idle" })
586
+ ] })
587
+ }
588
+ )
589
+ ]
590
+ }
591
+ ),
592
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
593
+ import_material.Menu,
594
+ {
595
+ anchorEl: moreOptionsAnchorEl,
596
+ open: Boolean(moreOptionsAnchorEl),
597
+ onClose: handleMoreOptionsClose,
598
+ onClick: (e) => e.stopPropagation(),
599
+ children: [
600
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.MenuItem, { onClick: () => setMoreOptionsAnchorEl(null), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
601
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.TransferWithinAStation, { color: "secondary" }),
602
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { children: "Call Transfer" })
603
+ ] }) }),
604
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.MenuItem, { onClick: () => setMoreOptionsAnchorEl(null), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
605
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Groups, { color: "secondary" }),
606
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { children: "Conference Call" })
607
+ ] }) }),
608
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.MenuItem, { onClick: () => setMoreOptionsAnchorEl(null), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
609
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.SpatialAudioOff, { color: "secondary" }),
610
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { children: "Queue Waiting" })
611
+ ] }) })
612
+ ]
613
+ }
614
+ )
615
+ ] });
616
+ }
617
+
618
+ // src/index.ts
619
+ function initCallSDK(sdkApiKey) {
620
+ sdkStateManager.initialize(sdkApiKey);
621
+ }
622
+ function updateCallData(data) {
623
+ sdkStateManager.updateCallData(data);
624
+ }
625
+ // Annotate the CommonJS export names for ESM import in node:
626
+ 0 && (module.exports = {
627
+ CallControlPanel,
628
+ initCallSDK,
629
+ updateCallData
630
+ });