Commit f82e2fe9 authored by Muhammadali's avatar Muhammadali

update

parent 2021c99d
{ {
"name": "boxdialer", "name": "boxdialer",
"version": "2.1.9", "version": "2.2.0",
"description": "", "description": "",
"main": "src/boxDialer.js", "main": "src/boxDialer.js",
"scripts": { "scripts": {
......
...@@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react'; ...@@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react';
import Root from '../root'; import Root from '../root';
const ControlRenderBX = () => { const ControlRenderBX = () => {
const [data, setData] = useState({}); const [wsphonedata, setWsphonedata] = useState({});
const [typeEnvironments, setTypeEnvironments] = useState('none'); const [typeEnvironments, setTypeEnvironments] = useState('none');
var intervalFetchToBx; var intervalFetchToBx;
...@@ -13,10 +13,10 @@ const ControlRenderBX = () => { ...@@ -13,10 +13,10 @@ const ControlRenderBX = () => {
}, []); }, []);
const intervalFunc = () => { const intervalFunc = () => {
if (!Boolean(data?.number)) { if (!Boolean(wsphonedata?.number)) {
setData(window.alovoice_wsphone); setWsphonedata(window.alovoice_wsphone);
} }
if (Boolean(data?.number)) { if (Boolean(wsphonedata?.number)) {
clearInterval(intervalFetchToBx); clearInterval(intervalFetchToBx);
intervalFetchToBx = null; intervalFetchToBx = null;
} }
...@@ -24,12 +24,9 @@ const ControlRenderBX = () => { ...@@ -24,12 +24,9 @@ const ControlRenderBX = () => {
const testFunc = (e) => { const testFunc = (e) => {
console.log('dsadasdsd', e); console.log('dsadasdsd', e);
setData(e); setWsphonedata(e);
setTimeout(() => {
setData({});
}, 3000);
}; };
console.log('check_data', data); console.log('check_data', wsphonedata);
// switch (typeEnvironments) { // switch (typeEnvironments) {
// case 'bitrix': // case 'bitrix':
// return <Root setData={setData} data={data} />; // return <Root setData={setData} data={data} />;
...@@ -38,7 +35,17 @@ const ControlRenderBX = () => { ...@@ -38,7 +35,17 @@ const ControlRenderBX = () => {
// default: // default:
// return <Root setData={setData} data={data} />; // return <Root setData={setData} data={data} />;
// } // }
return <div>{data?.number && <Root setData={testFunc} data={data} />}</div>; return (
<div>
{data?.number && (
<Root
setWsphonedata={testFunc}
onSetDnd={window.alovoice_onsetdnd}
wsphonedata={wsphonedata}
/>
)}
</div>
);
}; };
export default ControlRenderBX; export default ControlRenderBX;
...@@ -8,7 +8,7 @@ import Modal from '../components/Modal'; ...@@ -8,7 +8,7 @@ import Modal from '../components/Modal';
import BxMiniWidjetUi from '../components/BxMiniWidjetUi'; import BxMiniWidjetUi from '../components/BxMiniWidjetUi';
import SecondNotifSip from '../components/SecondNotifSip'; import SecondNotifSip from '../components/SecondNotifSip';
const Root = ({ data, onSetDnd, setData }) => { const Root = ({ wsphonedata, onSetDnd, setData }) => {
// const [dataSecond, setDataSecond] = useState([]); // const [dataSecond, setDataSecond] = useState([]);
// if (!data) { // if (!data) {
// data = { // data = {
...@@ -25,10 +25,10 @@ const Root = ({ data, onSetDnd, setData }) => { ...@@ -25,10 +25,10 @@ const Root = ({ data, onSetDnd, setData }) => {
// }; // };
// } // }
if (window?.alovoice_wsphone) { // if (window?.alovoice_wsphone) {
data = window.alovoice_wsphone; // wsphonedata = window.alovoice_wsphone;
onSetDnd = window.alovoice_onsetdnd; // onSetDnd = window.alovoice_onsetdnd;
} // }
const [phoneModal, setPhoneModal] = useState(false); const [phoneModal, setPhoneModal] = useState(false);
const [dynamicValue, setDynamicValue] = useState('pending'); const [dynamicValue, setDynamicValue] = useState('pending');
...@@ -46,12 +46,12 @@ const Root = ({ data, onSetDnd, setData }) => { ...@@ -46,12 +46,12 @@ const Root = ({ data, onSetDnd, setData }) => {
}, [secondLine]); }, [secondLine]);
useEffect(() => { useEffect(() => {
if (data && data?.number) { if (wsphonedata && wsphonedata?.number) {
boxDialer.setSipStateChangeCallback(setDynamicValue, 'dynamicValue'); boxDialer.setSipStateChangeCallback(setDynamicValue, 'dynamicValue');
boxDialer.setSipStateChangeCallback(setModalState, 'modalState'); boxDialer.setSipStateChangeCallback(setModalState, 'modalState');
boxDialer.setSipStateChangeCallback(setPhoneModal, 'phoneModal'); boxDialer.setSipStateChangeCallback(setPhoneModal, 'phoneModal');
boxDialer.setSipStateChangeCallback(setSecondLine, 'secondLine'); boxDialer.setSipStateChangeCallback(setSecondLine, 'secondLine');
boxDialer.sipRegister(data); boxDialer.sipRegister(wsphonedata);
} }
// setData(data); // setData(data);
}, []); }, []);
...@@ -75,11 +75,11 @@ const Root = ({ data, onSetDnd, setData }) => { ...@@ -75,11 +75,11 @@ const Root = ({ data, onSetDnd, setData }) => {
return ( return (
<BxMiniWidjetUi <BxMiniWidjetUi
widjetState={dynamicValue} widjetState={dynamicValue}
phoneNumber={data?.number} phoneNumber={wsphonedata?.number}
reason={data?.reason} reason={wsphonedata?.reason}
widjetVersion={packageJson?.version} widjetVersion={packageJson?.version}
leftTime={data.lefttime} leftTime={wsphonedata.lefttime}
position={data.position || 'bottomLeft'} position={wsphonedata.position || 'bottomLeft'}
onClick={() => { onClick={() => {
phoneModal ? setPhoneModal(false) : setPhoneModal(true); phoneModal ? setPhoneModal(false) : setPhoneModal(true);
}} }}
...@@ -89,11 +89,11 @@ const Root = ({ data, onSetDnd, setData }) => { ...@@ -89,11 +89,11 @@ const Root = ({ data, onSetDnd, setData }) => {
return ( return (
<DefaultWidjetUi <DefaultWidjetUi
widjetState={dynamicValue} widjetState={dynamicValue}
phoneNumber={data?.number} phoneNumber={wsphonedata?.number}
reason={data?.reason} reason={wsphonedata?.reason}
widjetVersion={packageJson?.version} widjetVersion={packageJson?.version}
leftTime={data.lefttime} leftTime={wsphonedata.lefttime}
position={data.position || 'bottomLeft'} position={wsphonedata.position || 'bottomLeft'}
onClick={() => { onClick={() => {
phoneModal ? setPhoneModal(false) : setPhoneModal(true); phoneModal ? setPhoneModal(false) : setPhoneModal(true);
}} }}
...@@ -102,22 +102,22 @@ const Root = ({ data, onSetDnd, setData }) => { ...@@ -102,22 +102,22 @@ const Root = ({ data, onSetDnd, setData }) => {
} }
}; };
if (!data || !data?.number || !data?.position) return; if (!wsphonedata || !wsphonedata?.number || !wsphonedata?.position) return;
console.log(modalState, 'modalState'); console.log(modalState, 'modalState');
return ( return (
<> <>
{selectWidjetType(data.variant)} {selectWidjetType(wsphonedata.variant)}
<ModalPhoneNumpad <ModalPhoneNumpad
modalState={modalState} modalState={modalState}
phoneModal={phoneModal} phoneModal={phoneModal}
reasons={data?.reasons} reasons={wsphonedata?.reasons}
reason={data?.reason} reason={wsphonedata?.reason}
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
dynamicValue={dynamicValue} dynamicValue={dynamicValue}
onSetDnd={reasonSelect} onSetDnd={reasonSelect}
variant={data.variant || 'defaultWidjet'} variant={wsphonedata.variant || 'defaultWidjet'}
position={data.position || 'bottomLeft'} position={wsphonedata.position || 'bottomLeft'}
/> />
<Modal <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