call-control-sdk 2.0.0 → 2.2.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # React Call Control SDK
2
2
 
3
- A React-based call control SDK with Material-UI components, providing a draggable control panel for call management.
3
+ Achala provide call control SDK with Material-UI components, providing a draggable control panel for call management.
4
4
 
5
5
  ## Features
6
6
 
@@ -16,7 +16,7 @@ A React-based call control SDK with Material-UI components, providing a draggabl
16
16
  ## Installation
17
17
 
18
18
  ```bash
19
- npm install react-call-control-sdk
19
+ npm install call-control-sdk
20
20
  ```
21
21
 
22
22
  ## Peer Dependencies
@@ -32,17 +32,30 @@ npm install react react-dom @mui/material @mui/icons-material @emotion/react @em
32
32
  ### 1. Initialize the SDK
33
33
 
34
34
  ```typescript
35
- import { initCallSDK } from 'react-call-control-sdk';
35
+ import { initSDK } from 'call-control-sdk';
36
36
 
37
37
  // Initialize at the top level of your app
38
- initCallSDK('YOUR_API_KEY');
38
+ useEffect(() => {
39
+ // Initialize the SDK with a test API key
40
+ try {
41
+ initSDK({
42
+ apiKey: "apiKey",
43
+ tenantId: "tenantId",
44
+ agentId: "agentId",
45
+ baseUrl: "baseUrl",
46
+ });
47
+ console.log("SDK initialized successfully");
48
+ } catch (error) {
49
+ console.error("SDK initialization failed:", error);
50
+ }
51
+ }, []);
39
52
  ```
40
53
 
41
54
  ### 2. Use the CallControlPanel
42
55
 
43
56
  ```typescript
44
57
  import React from 'react';
45
- import { CallControlPanel } from 'react-call-control-sdk';
58
+ import { CallControlPanel } from 'call-control-sdk';
46
59
 
47
60
  function App() {
48
61
  const handleDataChange = ({ mobileNumber, callReferenceId, agentLoginId }) => {
@@ -58,27 +71,17 @@ function App() {
58
71
  }
59
72
  ```
60
73
 
61
- ### 3. Update Call Data (Optional)
62
-
63
- ```typescript
64
- import { updateCallData } from 'react-call-control-sdk';
65
-
66
- // Update call information
67
- updateCallData({
68
- mobileNumber: '+1-555-123-4567',
69
- callReferenceId: 'CALL-2024-001',
70
- agentLoginId: 'AGENT-123'
71
- });
72
- ```
73
-
74
74
  ## API Reference
75
75
 
76
- ### `initCallSDK(sdkApiKey: string)`
76
+ ### `initSDK({apiKey: "apiKey",tenantId: "tenantId",agentId: "agentId",baseUrl: "baseUrl",})`
77
77
 
78
- Initializes the SDK with an API key. Must be called before using any components.
78
+ Initializes the SDK with an API key, tenantId, agentId, baseUrl. Must be called before using any components.
79
79
 
80
80
  **Parameters:**
81
- - `sdkApiKey` (string): Your API key for SDK authentication
81
+ - `apiKey` (string): Your API key for SDK authentication
82
+ - `tenantId` (string): Your Tenant Id key for Events authentication
83
+ - `agentId` (string): Agent Id for access call controls
84
+ - `baseUrl` (string): Base URL for save events info
82
85
 
83
86
  **Throws:** Error if API key is missing or invalid
84
87
 
@@ -103,7 +106,6 @@ Updates the call data that will be passed to the `onDataChange` callback.
103
106
 
104
107
  ### Status Management
105
108
  - **Idle**: Default state, no active call
106
- - **Ready**: Agent is ready to take calls
107
109
  - **Break**: Agent is on break
108
110
 
109
111
  ### Call Controls
@@ -123,26 +125,6 @@ All control states are automatically saved to localStorage:
123
125
 
124
126
  The SDK uses Material-UI components and respects your app's MUI theme. Ensure you wrap your app with a `ThemeProvider`:
125
127
 
126
- ```typescript
127
- import { ThemeProvider, createTheme } from '@mui/material/styles';
128
- import CssBaseline from '@mui/material/CssBaseline';
129
-
130
- const theme = createTheme({
131
- palette: {
132
- mode: 'light',
133
- primary: { main: '#1976d2' }
134
- }
135
- });
136
-
137
- function App() {
138
- return (
139
- <ThemeProvider theme={theme}>
140
- <CssBaseline />
141
- {/* Your app content */}
142
- </ThemeProvider>
143
- );
144
- }
145
- ```
146
128
 
147
129
  ## Browser Support
148
130
 
@@ -153,4 +135,4 @@ function App() {
153
135
 
154
136
  ## License
155
137
 
156
- MIT © [Your Name]
138
+ MIT © RDX
package/dist/index.d.mts CHANGED
@@ -8,23 +8,21 @@ interface CallData {
8
8
  interface CallControlPanelProps {
9
9
  onDataChange?: (data: CallData) => void;
10
10
  }
11
+ type CallStatus = "idle" | "ready" | "break";
11
12
 
12
- declare function CallControlPanel({ onDataChange }: CallControlPanelProps): react_jsx_runtime.JSX.Element;
13
+ declare function CallControlPanel({ onDataChange }: CallControlPanelProps): react_jsx_runtime.JSX.Element | null;
13
14
 
14
15
  /**
15
16
  * Initialize the Call Control SDK with an API key
16
17
  * @param sdkApiKey - The API key for SDK authentication
17
18
  * @throws {Error} When API key is missing or invalid
18
19
  */
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;
20
+ type intiSDKParams = {
21
+ apiKey: string;
22
+ tenantId: string;
23
+ agentId: string;
24
+ baseUrl: string;
25
+ };
26
+ declare function initSDK({ apiKey, tenantId, agentId, baseUrl, }: intiSDKParams): void;
29
27
 
30
- export { CallControlPanel, initCallSDK, updateCallData };
28
+ export { CallControlPanel, type CallControlPanelProps, type CallData, type CallStatus, initSDK };
package/dist/index.d.ts CHANGED
@@ -8,23 +8,21 @@ interface CallData {
8
8
  interface CallControlPanelProps {
9
9
  onDataChange?: (data: CallData) => void;
10
10
  }
11
+ type CallStatus = "idle" | "ready" | "break";
11
12
 
12
- declare function CallControlPanel({ onDataChange }: CallControlPanelProps): react_jsx_runtime.JSX.Element;
13
+ declare function CallControlPanel({ onDataChange }: CallControlPanelProps): react_jsx_runtime.JSX.Element | null;
13
14
 
14
15
  /**
15
16
  * Initialize the Call Control SDK with an API key
16
17
  * @param sdkApiKey - The API key for SDK authentication
17
18
  * @throws {Error} When API key is missing or invalid
18
19
  */
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;
20
+ type intiSDKParams = {
21
+ apiKey: string;
22
+ tenantId: string;
23
+ agentId: string;
24
+ baseUrl: string;
25
+ };
26
+ declare function initSDK({ apiKey, tenantId, agentId, baseUrl, }: intiSDKParams): void;
29
27
 
30
- export { CallControlPanel, initCallSDK, updateCallData };
28
+ export { CallControlPanel, type CallControlPanelProps, type CallData, type CallStatus, initSDK };