Commit 6cc227e7 authored by Muhammadali's avatar Muhammadali

update

parent 19be58e4
{
"name": "boxdialer",
"version": "1.4.2",
"version": "1.4.3",
"description": "",
"main": "src/boxDialer.js",
"scripts": {
......
......@@ -15,6 +15,7 @@ const Root = ({ data, onSetDnd }) => {
// else localStorage.setItem('activeValue', 1);
// }, []);
const [dataSecond, setDataSecond] = useState([]);
const [mainData, setMainData] = useState({});
if (!data) {
data = {
iscloud: true,
......@@ -30,13 +31,15 @@ const Root = ({ data, onSetDnd }) => {
};
}
useEffect(() => {
setMainData(data);
}, []);
if (window?.alovoice_wsphone) {
data = window.alovoice_wsphone;
// data = window.alovoice_wsphone;
setMainData(window.alovoice_wsphone);
onSetDnd = window.alovoice_onsetdnd;
}
useEffect(() => {
console.log(data, 'data');
}, [data.reason]);
const [phoneModal, setPhoneModal] = useState(false);
const [dynamicValue, setDynamicValue] = useState('pending');
......@@ -45,12 +48,11 @@ const Root = ({ data, onSetDnd }) => {
const boxDialer = window.BoxDialer;
useEffect(() => {
if (data && data?.number) {
if (mainData && mainData?.number) {
boxDialer.setSipStateChangeCallback(setDynamicValue, 'dynamicValue');
boxDialer.setSipStateChangeCallback(setModalState, 'modalState');
boxDialer.sipRegister(data);
boxDialer.sipRegister(mainData);
}
setDataSecond(data);
}, []);
const hangupButton = () => {
......@@ -61,7 +63,7 @@ const Root = ({ data, onSetDnd }) => {
let result = await onSetDnd(e);
setDataSecond(result);
console.log(dataSecond, 'select_func');
data = result;
setMainData(result);
};
const selectWidjetType = (type) => {
......@@ -70,11 +72,11 @@ const Root = ({ data, onSetDnd }) => {
return (
<BxMiniWidjetUi
widjetState={dynamicValue}
phoneNumber={data?.number}
reason={data?.reason}
phoneNumber={mainData?.number}
reason={mainData?.reason}
widjetVersion={packageJson?.version}
leftTime={data.lefttime}
position={data.position || 'bottomLeft'}
leftTime={mainData.lefttime}
position={mainData.position || 'bottomLeft'}
onClick={() => {
phoneModal ? setPhoneModal(false) : setPhoneModal(true);
}}
......@@ -84,11 +86,11 @@ const Root = ({ data, onSetDnd }) => {
return (
<DefaultWidjetUi
widjetState={dynamicValue}
phoneNumber={data?.number}
reason={data?.reason}
phoneNumber={mainData?.number}
reason={mainData?.reason}
widjetVersion={packageJson?.version}
leftTime={data.lefttime}
position={data.position || 'bottomLeft'}
leftTime={mainData.lefttime}
position={mainData.position || 'bottomLeft'}
onClick={() => {
phoneModal ? setPhoneModal(false) : setPhoneModal(true);
}}
......@@ -97,22 +99,22 @@ const Root = ({ data, onSetDnd }) => {
}
};
if (!data || !data?.number || !data?.position) return;
if (!mainData || !mainData?.number || !mainData?.position) return;
console.log(modalState, 'modalState');
return (
<>
{selectWidjetType(data.variant)}
{selectWidjetType(mainData.variant)}
<ModalPhoneNumpad
modalState={modalState}
phoneModal={phoneModal}
reasons={data?.reasons}
reason={dataSecond?.reason}
reasons={mainData?.reasons}
reason={mainData?.reason}
onClick={(e) => e.stopPropagation()}
dynamicValue={dynamicValue}
onSetDnd={reasonSelect}
variant={data.variant || 'defaultWidjet'}
position={data.position || 'bottomLeft'}
variant={mainData.variant || 'defaultWidjet'}
position={mainData.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