Commit 80c1e21d authored by Muhammadali's avatar Muhammadali

update-

parent c8b6c416
{ {
"name": "boxdialer", "name": "boxdialer",
"version": "4.8.14", "version": "4.8.15",
"description": "", "description": "",
"main": "src/boxDialer.js", "main": "src/boxDialer.js",
"scripts": { "scripts": {
......
...@@ -11,15 +11,13 @@ import MicIcon from '@mui/icons-material/Mic'; ...@@ -11,15 +11,13 @@ import MicIcon from '@mui/icons-material/Mic';
import MicOffIcon from '@mui/icons-material/MicOff'; import MicOffIcon from '@mui/icons-material/MicOff';
import PlayArrowIcon from '@mui/icons-material/PlayArrow'; import PlayArrowIcon from '@mui/icons-material/PlayArrow';
import PauseIcon from '@mui/icons-material/Pause'; import PauseIcon from '@mui/icons-material/Pause';
import { contextModalEventProperty } from '../../context/modalEventProperty';
import { useContext } from 'react';
const InnerCaller = ({ hidden, type, from, innerTimer }) => { const InnerCaller = ({ hidden, type, from, innerTimer }) => {
const boxDialer = window.BoxDialer; const boxDialer = window.BoxDialer;
const translator = useTranslator(); const translator = useTranslator();
const [callEvents, setCallEvents] = useContext(contextModalEventProperty);
const [callEvents, setCallEvents] = useState({});
useEffect(() => {
boxDialer.setSipStateChangeCallback(setCallEvents, 'setCallEvents');
}, []);
const dataFormatter = (secund) => { const dataFormatter = (secund) => {
let ts = intervalToDuration({ let ts = intervalToDuration({
start: 0, start: 0,
...@@ -29,7 +27,7 @@ const InnerCaller = ({ hidden, type, from, innerTimer }) => { ...@@ -29,7 +27,7 @@ const InnerCaller = ({ hidden, type, from, innerTimer }) => {
? `${ts.hours}:${ts.minutes}:${ts.seconds}` ? `${ts.hours}:${ts.minutes}:${ts.seconds}`
: `${ts.minutes}:${ts.seconds}`; : `${ts.minutes}:${ts.seconds}`;
}; };
console.log('callEvents_callHold: ', callEvents.callHold); console.log('callEvents_callHold: ', callEvents?.callHold);
const selectModalType = (type) => { const selectModalType = (type) => {
switch (type) { switch (type) {
...@@ -39,14 +37,14 @@ const InnerCaller = ({ hidden, type, from, innerTimer }) => { ...@@ -39,14 +37,14 @@ const InnerCaller = ({ hidden, type, from, innerTimer }) => {
<div className='button timer'> <div className='button timer'>
<div>{dataFormatter(innerTimer)}</div> <div>{dataFormatter(innerTimer)}</div>
<div onClick={() => boxDialer.holdButtonClick()}> <div onClick={() => boxDialer.holdButtonClick()}>
{callEvents.callHold ? ( {callEvents?.callHold ? (
<PlayArrowIcon style={{ color: '#fff' }} /> <PlayArrowIcon style={{ color: '#fff' }} />
) : ( ) : (
<PauseIcon style={{ color: '#fff' }} /> <PauseIcon style={{ color: '#fff' }} />
)} )}
</div> </div>
<div onClick={() => boxDialer.muteButtonClick()}> <div onClick={() => boxDialer.muteButtonClick()}>
{callEvents.callMute ? ( {callEvents?.callMute ? (
<MicOffIcon style={{ color: '#fff' }} /> <MicOffIcon style={{ color: '#fff' }} />
) : ( ) : (
<MicIcon style={{ color: '#fff' }} /> <MicIcon style={{ color: '#fff' }} />
......
...@@ -12,18 +12,21 @@ import SendToMobileIcon from '@mui/icons-material/SendToMobile'; ...@@ -12,18 +12,21 @@ import SendToMobileIcon from '@mui/icons-material/SendToMobile';
import DialpadIcon from '@mui/icons-material/Dialpad'; import DialpadIcon from '@mui/icons-material/Dialpad';
import CallCardDropDown from '../CallCardDropDown'; import CallCardDropDown from '../CallCardDropDown';
import ModalNumpad from '../ModalNumpad'; import ModalNumpad from '../ModalNumpad';
import { useContext } from 'react';
import { contextModalEventProperty } from '../../context/modalEventProperty';
const Modal = ({ children, hidden, hangupButton, phoneNumber, callType }) => { const Modal = ({ children, hidden, hangupButton, phoneNumber, callType }) => {
const boxDialer = window.BoxDialer; const boxDialer = window.BoxDialer;
const [rollUp, setRollUp] = useState(false); const [rollUp, setRollUp] = useState(false);
const [modalHidden, setModalHidden] = useState(false); const [modalHidden, setModalHidden] = useState(false);
const [callEvents, setCallEvents] = useState({}); // const [callEvents, setCallEvents] = useState({});
const [transferModel, setTransferModel] = useState(true); const [transferModel, setTransferModel] = useState(true);
const [numpadModal, setNumpadModal] = useState(false); const [numpadModal, setNumpadModal] = useState(false);
useEffect(() => { const [callEvents, setCallEvents] = useContext(contextModalEventProperty);
boxDialer.setSipStateChangeCallback(setCallEvents, 'setCallEvents'); // useEffect(() => {
}, []); // boxDialer.setSipStateChangeCallback(setCallEvents, 'setCallEvents');
// }, []);
useEffect(() => { useEffect(() => {
setModalHidden(hidden); setModalHidden(hidden);
...@@ -99,14 +102,14 @@ const Modal = ({ children, hidden, hangupButton, phoneNumber, callType }) => { ...@@ -99,14 +102,14 @@ const Modal = ({ children, hidden, hangupButton, phoneNumber, callType }) => {
<ModalContainer.Footer justify={'space-between'} rollUp={rollUp}> <ModalContainer.Footer justify={'space-between'} rollUp={rollUp}>
<div className='outcomingEventStyle'> <div className='outcomingEventStyle'>
<div onClick={() => boxDialer.holdButtonClick()}> <div onClick={() => boxDialer.holdButtonClick()}>
{callEvents.callHold ? ( {callEvents?.callHold ? (
<PlayArrowIcon style={{ color: '#fff' }} /> <PlayArrowIcon style={{ color: '#fff' }} />
) : ( ) : (
<PauseIcon style={{ color: '#fff' }} /> <PauseIcon style={{ color: '#fff' }} />
)} )}
</div> </div>
<div onClick={() => boxDialer.muteButtonClick()}> <div onClick={() => boxDialer.muteButtonClick()}>
{callEvents.callMute ? ( {callEvents?.callMute ? (
<MicOffIcon style={{ color: '#fff' }} /> <MicOffIcon style={{ color: '#fff' }} />
) : ( ) : (
<MicIcon style={{ color: '#fff' }} /> <MicIcon style={{ color: '#fff' }} />
......
...@@ -29,7 +29,6 @@ const ModalPhoneNumpad = ({ ...@@ -29,7 +29,6 @@ const ModalPhoneNumpad = ({
const [exNum, setExNum] = useState(); const [exNum, setExNum] = useState();
const translator = useTranslator(); const translator = useTranslator();
useEffect(() => { useEffect(() => {
let currentCalls = localStorage.getItem('callhistory') let currentCalls = localStorage.getItem('callhistory')
? JSON.parse(localStorage.getItem('callhistory')) ? JSON.parse(localStorage.getItem('callhistory'))
...@@ -296,7 +295,7 @@ const ModalPhoneNumpad = ({ ...@@ -296,7 +295,7 @@ const ModalPhoneNumpad = ({
setExNum(false); setExNum(false);
callButton(); callButton();
}}> }}>
{title}({number}) {title}
</p> </p>
))} ))}
</NumberButton.CallButtonModalInset> </NumberButton.CallButtonModalInset>
......
/** @format */
import React from 'react';
import ModalEventProperty from './modalEventProperty';
const CreateContext = ({ children }) => {
return (
<>
<ModalEventProperty>{children}</ModalEventProperty>
</>
);
};
export default CreateContext;
/** @format */
import React from 'react';
import { createContext } from 'react';
import { useEffect } from 'react';
import { useState } from 'react';
export const contextModalEventProperty = createContext();
const ModalEventProperty = ({ children }) => {
const [callEvents, setCallEvents] = useState();
const boxDialer = window.BoxDialer;
useEffect(() => {
boxDialer.setSipStateChangeCallback(setCallEvents, 'setCallEvents');
}, []);
return (
<contextModalEventProperty.Provider value={[callEvents, setCallEvents]}>
{children}
</contextModalEventProperty.Provider>
);
};
export default ModalEventProperty;
...@@ -8,6 +8,7 @@ import Root from './root'; ...@@ -8,6 +8,7 @@ import Root from './root';
import './index.css'; import './index.css';
import ControlRenderBX from './lib/controlRenderBX'; import ControlRenderBX from './lib/controlRenderBX';
import LanguageController from './lib/languageController'; import LanguageController from './lib/languageController';
import CreateContext from './context';
window.BoxDialer = new BoxDialer(); window.BoxDialer = new BoxDialer();
const container = document.getElementById('boxdialerwidjet'); const container = document.getElementById('boxdialerwidjet');
...@@ -15,9 +16,11 @@ const root = createRoot(container); ...@@ -15,9 +16,11 @@ const root = createRoot(container);
root.render( root.render(
<React.StrictMode> <React.StrictMode>
<LanguageController> <CreateContext>
<Toaster /> <LanguageController>
<ControlRenderBX /> <Toaster />
</LanguageController> <ControlRenderBX />
</LanguageController>
</CreateContext>
</React.StrictMode>, </React.StrictMode>,
); );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment