Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
BoxDialer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
BoxDialer
Commits
0f75677e
Commit
0f75677e
authored
Sep 21, 2023
by
Muhammadali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1af429c7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
29 deletions
+37
-29
package.json
package.json
+1
-1
index.js
src/index.js
+1
-1
controlRenderBX.jsx
src/lib/controlRenderBX.jsx
+13
-4
index.jsx
src/root/index.jsx
+22
-23
No files found.
package.json
View file @
0f75677e
{
"name"
:
"boxdialer"
,
"version"
:
"2.0.
3
"
,
"version"
:
"2.0.
4
"
,
"description"
:
""
,
"main"
:
"src/boxDialer.js"
,
"scripts"
:
{
...
...
src/index.js
View file @
0f75677e
...
...
@@ -17,6 +17,6 @@ root.render(
<
Toaster
/>
{
/* {controlRenderBX({ rootComponent: <Root /> })} */
}
{
/* <Root /> */
}
<
ControlRenderBX
rootComponent
=
{
<
Root
/>
}
/
>
<
ControlRenderBX
/>
<
/React.StrictMode>
,
);
src/lib/controlRenderBX.jsx
View file @
0f75677e
/** @format */
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
Root
from
'
../root
'
;
const
ControlRenderBX
=
(
{
rootComponent
}
)
=>
{
const
ControlRenderBX
=
()
=>
{
const
[
data
,
setData
]
=
useState
({});
// const intervalFetchToBx = null;
// window.alovoice_wsphone;
const
[
typeEnvironments
,
setTypeEnvironments
]
=
useState
(
'
none
'
);
var
intervalFetchToBx
;
useEffect
(()
=>
{
intervalFetchToBx
=
setInterval
(
intervalFunc
,
1000
);
},
[]);
...
...
@@ -17,8 +18,16 @@ const ControlRenderBX = ({ rootComponent }) => {
clearInterval
(
intervalFetchToBx
);
}
};
console
.
log
(
'
check_data
'
,
Boolean
(
data
?.
number
));
return
rootComponent
;
switch
(
typeEnvironments
)
{
case
'
bitrix
'
:
return
<
Root
setData=
{
setData
}
data=
{
data
}
/>;
case
'
cloud
'
:
return
<
Root
setData=
{
setData
}
data=
{
data
}
/>;
default
:
return
<
Root
setData=
{
setData
}
data=
{
data
}
/>;
}
};
export
default
ControlRenderBX
;
src/root/index.jsx
View file @
0f75677e
...
...
@@ -9,22 +9,21 @@ import BxMiniWidjetUi from '../components/BxMiniWidjetUi';
import
SecondNotifSip
from
'
../components/SecondNotifSip
'
;
const
Root
=
({
data
,
onSetDnd
})
=>
{
let
localValue
=
localStorage
.
getItem
(
'
activeValue
'
)
||
false
;
const
[
dataSecond
,
setDataSecond
]
=
useState
([]);
if
(
!
data
)
{
data
=
{
iscloud
:
true
,
number
:
'
4003
'
,
wsurl
:
'
cld.alovoice.uz:61040
'
,
server_id
:
40
,
secret
:
'
26a830
'
,
lefttime
:
231461
,
reasons
:
[
'
free
'
,
'
outcalls
'
,
'
home
'
,
'
totop
'
],
reason
:
'
free
'
,
variant
:
'
bxmini
'
,
position
:
'
bottomRight
'
,
};
}
// const [dataSecond, setDataSecond] = useState([]);
// if (!data) {
// data = {
// iscloud: true,
// number: '4003',
// wsurl: 'cld.alovoice.uz:61040',
// server_id: 40,
// secret: '26a830',
// lefttime: 231461,
// reasons: ['free', 'outcalls', 'home', 'totop'],
// reason: 'free',
// variant: 'bxmini',
// position: 'bottomRight',
// };
// }
if
(
window
?.
alovoice_wsphone
)
{
data
=
window
.
alovoice_wsphone
;
...
...
@@ -54,18 +53,18 @@ const Root = ({ data, onSetDnd }) => {
boxDialer
.
setSipStateChangeCallback
(
setSecondLine
,
'
secondLine
'
);
boxDialer
.
sipRegister
(
data
);
}
setDataSeco
nd
(
data
);
onSetD
nd
(
data
);
},
[]);
const
hangupButton
=
()
=>
{
boxDialer
.
hangupButtonClick
();
};
window
.
setWSData
=
(
result
)
=>
{
setDataSeco
nd
(
result
);
onSetD
nd
(
result
);
};
const
reasonSelect
=
async
(
e
)
=>
{
let
result
=
await
onSetDnd
(
e
);
setDataSeco
nd
(
result
);
onSetD
nd
(
result
);
// data = result;
};
const
selectWidjetType
=
(
type
)
=>
{
...
...
@@ -75,9 +74,9 @@ const Root = ({ data, onSetDnd }) => {
<
BxMiniWidjetUi
widjetState=
{
dynamicValue
}
phoneNumber=
{
data
?.
number
}
reason=
{
data
Second
?.
reason
}
reason=
{
data
?.
reason
}
widjetVersion=
{
packageJson
?.
version
}
leftTime=
{
data
Second
.
lefttime
||
data
.
lefttime
}
leftTime=
{
data
.
lefttime
}
position=
{
data
.
position
||
'
bottomLeft
'
}
onClick=
{
()
=>
{
phoneModal
?
setPhoneModal
(
false
)
:
setPhoneModal
(
true
);
...
...
@@ -89,7 +88,7 @@ const Root = ({ data, onSetDnd }) => {
<
DefaultWidjetUi
widjetState=
{
dynamicValue
}
phoneNumber=
{
data
?.
number
}
reason=
{
data
Second
?.
reason
}
reason=
{
data
?.
reason
}
widjetVersion=
{
packageJson
?.
version
}
leftTime=
{
data
.
lefttime
}
position=
{
data
.
position
||
'
bottomLeft
'
}
...
...
@@ -111,7 +110,7 @@ const Root = ({ data, onSetDnd }) => {
modalState=
{
modalState
}
phoneModal=
{
phoneModal
}
reasons=
{
data
?.
reasons
}
reason=
{
data
Second
?.
reason
}
reason=
{
data
?.
reason
}
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
dynamicValue=
{
dynamicValue
}
onSetDnd=
{
reasonSelect
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment