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"
,
"name"
:
"boxdialer"
,
"version"
:
"2.0.
3
"
,
"version"
:
"2.0.
4
"
,
"description"
:
""
,
"description"
:
""
,
"main"
:
"src/boxDialer.js"
,
"main"
:
"src/boxDialer.js"
,
"scripts"
:
{
"scripts"
:
{
...
...
src/index.js
View file @
0f75677e
...
@@ -17,6 +17,6 @@ root.render(
...
@@ -17,6 +17,6 @@ root.render(
<
Toaster
/>
<
Toaster
/>
{
/* {controlRenderBX({ rootComponent: <Root /> })} */
}
{
/* {controlRenderBX({ rootComponent: <Root /> })} */
}
{
/* <Root /> */
}
{
/* <Root /> */
}
<
ControlRenderBX
rootComponent
=
{
<
Root
/>
}
/
>
<
ControlRenderBX
/>
<
/React.StrictMode>
,
<
/React.StrictMode>
,
);
);
src/lib/controlRenderBX.jsx
View file @
0f75677e
/** @format */
/** @format */
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
Root
from
'
../root
'
;
const
ControlRenderBX
=
(
{
rootComponent
}
)
=>
{
const
ControlRenderBX
=
()
=>
{
const
[
data
,
setData
]
=
useState
({});
const
[
data
,
setData
]
=
useState
({});
// const intervalFetchToBx = null;
const
[
typeEnvironments
,
setTypeEnvironments
]
=
useState
(
'
none
'
);
// window.alovoice_wsphone;
var
intervalFetchToBx
;
var
intervalFetchToBx
;
useEffect
(()
=>
{
useEffect
(()
=>
{
intervalFetchToBx
=
setInterval
(
intervalFunc
,
1000
);
intervalFetchToBx
=
setInterval
(
intervalFunc
,
1000
);
},
[]);
},
[]);
...
@@ -17,8 +18,16 @@ const ControlRenderBX = ({ rootComponent }) => {
...
@@ -17,8 +18,16 @@ const ControlRenderBX = ({ rootComponent }) => {
clearInterval
(
intervalFetchToBx
);
clearInterval
(
intervalFetchToBx
);
}
}
};
};
console
.
log
(
'
check_data
'
,
Boolean
(
data
?.
number
));
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
;
export
default
ControlRenderBX
;
src/root/index.jsx
View file @
0f75677e
...
@@ -9,22 +9,21 @@ import BxMiniWidjetUi from '../components/BxMiniWidjetUi';
...
@@ -9,22 +9,21 @@ import BxMiniWidjetUi from '../components/BxMiniWidjetUi';
import
SecondNotifSip
from
'
../components/SecondNotifSip
'
;
import
SecondNotifSip
from
'
../components/SecondNotifSip
'
;
const
Root
=
({
data
,
onSetDnd
})
=>
{
const
Root
=
({
data
,
onSetDnd
})
=>
{
let
localValue
=
localStorage
.
getItem
(
'
activeValue
'
)
||
false
;
// const [dataSecond, setDataSecond] = useState([]);
const
[
dataSecond
,
setDataSecond
]
=
useState
([]);
// if (!data) {
if
(
!
data
)
{
// data = {
data
=
{
// iscloud: true,
iscloud
:
true
,
// number: '4003',
number
:
'
4003
'
,
// wsurl: 'cld.alovoice.uz:61040',
wsurl
:
'
cld.alovoice.uz:61040
'
,
// server_id: 40,
server_id
:
40
,
// secret: '26a830',
secret
:
'
26a830
'
,
// lefttime: 231461,
lefttime
:
231461
,
// reasons: ['free', 'outcalls', 'home', 'totop'],
reasons
:
[
'
free
'
,
'
outcalls
'
,
'
home
'
,
'
totop
'
],
// reason: 'free',
reason
:
'
free
'
,
// variant: 'bxmini',
variant
:
'
bxmini
'
,
// position: 'bottomRight',
position
:
'
bottomRight
'
,
// };
};
// }
}
if
(
window
?.
alovoice_wsphone
)
{
if
(
window
?.
alovoice_wsphone
)
{
data
=
window
.
alovoice_wsphone
;
data
=
window
.
alovoice_wsphone
;
...
@@ -54,18 +53,18 @@ const Root = ({ data, onSetDnd }) => {
...
@@ -54,18 +53,18 @@ const Root = ({ data, onSetDnd }) => {
boxDialer
.
setSipStateChangeCallback
(
setSecondLine
,
'
secondLine
'
);
boxDialer
.
setSipStateChangeCallback
(
setSecondLine
,
'
secondLine
'
);
boxDialer
.
sipRegister
(
data
);
boxDialer
.
sipRegister
(
data
);
}
}
setDataSeco
nd
(
data
);
onSetD
nd
(
data
);
},
[]);
},
[]);
const
hangupButton
=
()
=>
{
const
hangupButton
=
()
=>
{
boxDialer
.
hangupButtonClick
();
boxDialer
.
hangupButtonClick
();
};
};
window
.
setWSData
=
(
result
)
=>
{
window
.
setWSData
=
(
result
)
=>
{
setDataSeco
nd
(
result
);
onSetD
nd
(
result
);
};
};
const
reasonSelect
=
async
(
e
)
=>
{
const
reasonSelect
=
async
(
e
)
=>
{
let
result
=
await
onSetDnd
(
e
);
let
result
=
await
onSetDnd
(
e
);
setDataSeco
nd
(
result
);
onSetD
nd
(
result
);
// data = result;
// data = result;
};
};
const
selectWidjetType
=
(
type
)
=>
{
const
selectWidjetType
=
(
type
)
=>
{
...
@@ -75,9 +74,9 @@ const Root = ({ data, onSetDnd }) => {
...
@@ -75,9 +74,9 @@ const Root = ({ data, onSetDnd }) => {
<
BxMiniWidjetUi
<
BxMiniWidjetUi
widjetState=
{
dynamicValue
}
widjetState=
{
dynamicValue
}
phoneNumber=
{
data
?.
number
}
phoneNumber=
{
data
?.
number
}
reason=
{
data
Second
?.
reason
}
reason=
{
data
?.
reason
}
widjetVersion=
{
packageJson
?.
version
}
widjetVersion=
{
packageJson
?.
version
}
leftTime=
{
data
Second
.
lefttime
||
data
.
lefttime
}
leftTime=
{
data
.
lefttime
}
position=
{
data
.
position
||
'
bottomLeft
'
}
position=
{
data
.
position
||
'
bottomLeft
'
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
phoneModal
?
setPhoneModal
(
false
)
:
setPhoneModal
(
true
);
phoneModal
?
setPhoneModal
(
false
)
:
setPhoneModal
(
true
);
...
@@ -89,7 +88,7 @@ const Root = ({ data, onSetDnd }) => {
...
@@ -89,7 +88,7 @@ const Root = ({ data, onSetDnd }) => {
<
DefaultWidjetUi
<
DefaultWidjetUi
widjetState=
{
dynamicValue
}
widjetState=
{
dynamicValue
}
phoneNumber=
{
data
?.
number
}
phoneNumber=
{
data
?.
number
}
reason=
{
data
Second
?.
reason
}
reason=
{
data
?.
reason
}
widjetVersion=
{
packageJson
?.
version
}
widjetVersion=
{
packageJson
?.
version
}
leftTime=
{
data
.
lefttime
}
leftTime=
{
data
.
lefttime
}
position=
{
data
.
position
||
'
bottomLeft
'
}
position=
{
data
.
position
||
'
bottomLeft
'
}
...
@@ -111,7 +110,7 @@ const Root = ({ data, onSetDnd }) => {
...
@@ -111,7 +110,7 @@ const Root = ({ data, onSetDnd }) => {
modalState=
{
modalState
}
modalState=
{
modalState
}
phoneModal=
{
phoneModal
}
phoneModal=
{
phoneModal
}
reasons=
{
data
?.
reasons
}
reasons=
{
data
?.
reasons
}
reason=
{
data
Second
?.
reason
}
reason=
{
data
?.
reason
}
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
dynamicValue=
{
dynamicValue
}
dynamicValue=
{
dynamicValue
}
onSetDnd=
{
reasonSelect
}
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