Commit 26ebe526 authored by Muhammadali's avatar Muhammadali

update

parent 418e4f89
{
"name": "boxdialer",
"version": "1.9.9",
"version": "2.0.0",
"description": "",
"main": "src/boxDialer.js",
"scripts": {
......
......@@ -9,8 +9,8 @@ import BxMiniWidjetUi from '../components/BxMiniWidjetUi';
import SecondNotifSip from '../components/SecondNotifSip';
const Root = ({ data, onSetDnd }) => {
const [stateData, setStateData] = useState({});
let localValue = localStorage.getItem('activeValue') || false;
const [dataSecond, setDataSecond] = useState([]);
if (!data) {
data = {
iscloud: true,
......@@ -31,13 +31,6 @@ const Root = ({ data, onSetDnd }) => {
onSetDnd = window.alovoice_onsetdnd;
}
useEffect(() => {
if (data || window.alovoice_wsphone) {
setStateData(data);
}
});
console.log('stateData:', stateData, data);
const [phoneModal, setPhoneModal] = useState(false);
const [dynamicValue, setDynamicValue] = useState('pending');
const [modalState, setModalState] = useState(false);
......@@ -54,25 +47,25 @@ const Root = ({ data, onSetDnd }) => {
}, [secondLine]);
useEffect(() => {
if (stateData && stateData?.number) {
if (data && data?.number) {
boxDialer.setSipStateChangeCallback(setDynamicValue, 'dynamicValue');
boxDialer.setSipStateChangeCallback(setModalState, 'modalState');
boxDialer.setSipStateChangeCallback(setPhoneModal, 'phoneModal');
boxDialer.setSipStateChangeCallback(setSecondLine, 'secondLine');
boxDialer.sipRegister(stateData);
boxDialer.sipRegister(data);
}
setStateData(stateData);
setDataSecond(data);
}, []);
const hangupButton = () => {
boxDialer.hangupButtonClick();
};
window.setWSData = (result) => {
setStateData(result);
setDataSecond(result);
};
const reasonSelect = async (e) => {
let result = await onSetDnd(e);
setStateData(result);
setDataSecond(result);
// data = result;
};
const selectWidjetType = (type) => {
......@@ -81,11 +74,11 @@ const Root = ({ data, onSetDnd }) => {
return (
<BxMiniWidjetUi
widjetState={dynamicValue}
phoneNumber={stateData?.number}
reason={stateData?.reason}
phoneNumber={data?.number}
reason={dataSecond?.reason}
widjetVersion={packageJson?.version}
leftTime={stateData.lefttime}
position={stateData.position || 'bottomLeft'}
leftTime={dataSecond.lefttime || data.lefttime}
position={data.position || 'bottomLeft'}
onClick={() => {
phoneModal ? setPhoneModal(false) : setPhoneModal(true);
}}
......@@ -95,11 +88,11 @@ const Root = ({ data, onSetDnd }) => {
return (
<DefaultWidjetUi
widjetState={dynamicValue}
phoneNumber={stateData?.number}
reason={stateData?.reason}
phoneNumber={data?.number}
reason={dataSecond?.reason}
widjetVersion={packageJson?.version}
leftTime={stateData.lefttime}
position={stateData.position || 'bottomLeft'}
leftTime={data.lefttime}
position={data.position || 'bottomLeft'}
onClick={() => {
phoneModal ? setPhoneModal(false) : setPhoneModal(true);
}}
......@@ -108,21 +101,22 @@ const Root = ({ data, onSetDnd }) => {
}
};
if (!stateData || !stateData?.number || !stateData?.position) return;
if (!data || !data?.number || !data?.position) return;
console.log(modalState, 'modalState');
return (
<>
{selectWidjetType(stateData.variant)}
{selectWidjetType(data.variant)}
<ModalPhoneNumpad
modalState={modalState}
phoneModal={phoneModal}
reasons={stateData?.reasons}
reason={stateData?.reason}
reasons={data?.reasons}
reason={dataSecond?.reason}
onClick={(e) => e.stopPropagation()}
dynamicValue={dynamicValue}
onSetDnd={reasonSelect}
variant={stateData.variant || 'defaultWidjet'}
position={stateData.position || 'bottomLeft'}
variant={data.variant || 'defaultWidjet'}
position={data.position || 'bottomLeft'}
/>
<Modal
......
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