Commit f82e2fe9 authored by Muhammadali's avatar Muhammadali

update

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