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
11eb633b
Commit
11eb633b
authored
Nov 07, 2023
by
Muhammadali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update-
parent
fe8dfbb8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
179 additions
and
178 deletions
+179
-178
package.json
package.json
+1
-1
controlRenderBX.jsx
src/lib/controlRenderBX.jsx
+2
-2
index.jsx
src/root/index.jsx
+176
-175
No files found.
package.json
View file @
11eb633b
{
{
"name"
:
"boxdialer"
,
"name"
:
"boxdialer"
,
"version"
:
"4.8.5
4
"
,
"version"
:
"4.8.5
5
"
,
"description"
:
""
,
"description"
:
""
,
"main"
:
"src/boxDialer.js"
,
"main"
:
"src/boxDialer.js"
,
"scripts"
:
{
"scripts"
:
{
...
...
src/lib/controlRenderBX.jsx
View file @
11eb633b
...
@@ -34,13 +34,13 @@ const ControlRenderBX = () => {
...
@@ -34,13 +34,13 @@ const ControlRenderBX = () => {
console
.
log
(
'
window_alovoice_wsphone:
'
,
window
.
alovoice_wsphone
);
console
.
log
(
'
window_alovoice_wsphone:
'
,
window
.
alovoice_wsphone
);
return
(
return
(
<
div
>
<
div
>
{
/*{wsphonedata?.number && (*/
}
{
wsphonedata
?.
number
&&
(
<
Root
<
Root
setWsphonedata=
{
setWsphonedata
}
setWsphonedata=
{
setWsphonedata
}
onSetDnd=
{
window
.
alovoice_onsetdnd
}
onSetDnd=
{
window
.
alovoice_onsetdnd
}
wsphonedata=
{
wsphonedata
}
wsphonedata=
{
wsphonedata
}
/>
/>
{
/*)}*/
}
)
}
</
div
>
</
div
>
);
);
};
};
...
...
src/root/index.jsx
View file @
11eb633b
/** @format */
/** @format */
import
React
,
{
useContext
,
useEffect
,
useState
}
from
'
react
'
;
import
React
,
{
useContext
,
useEffect
,
useState
}
from
'
react
'
;
import
packageJson
from
'
../../package.json
'
;
import
packageJson
from
'
../../package.json
'
;
import
DefaultWidjetUi
from
'
../components/DefaultWidjetUi
'
;
import
DefaultWidjetUi
from
'
../components/DefaultWidjetUi
'
;
import
ModalPhoneNumpad
from
'
../components/ModalPhoneNumpad
'
;
import
ModalPhoneNumpad
from
'
../components/ModalPhoneNumpad
'
;
...
@@ -11,180 +11,181 @@ import InnerCaller from '../components/InnerCaller';
...
@@ -11,180 +11,181 @@ import InnerCaller from '../components/InnerCaller';
import
{
useConfigHoldMute
}
from
"
../storage
"
import
{
useConfigHoldMute
}
from
"
../storage
"
// import { contextModalEventProperty } from '../context/modalEventProperty';
// import { contextModalEventProperty } from '../context/modalEventProperty';
const
Root
=
({
wsphonedata
,
onSetDnd
,
setWsphonedata
,
callMethod
})
=>
{
const
Root
=
({
wsphonedata
,
onSetDnd
,
setWsphonedata
,
callMethod
})
=>
{
const
boxDialer
=
window
.
BoxDialer
;
const
boxDialer
=
window
.
BoxDialer
;
// // context
// // context
// const { callEvents, setCallEvents } = useContext(contextModalEventProperty);
// const { callEvents, setCallEvents } = useContext(contextModalEventProperty);
const
configHoldMute
=
useConfigHoldMute
((
state
)
=>
state
)
const
configHoldMute
=
useConfigHoldMute
((
state
)
=>
state
)
const
[
phoneModal
,
setPhoneModal
]
=
useState
(
false
);
const
[
phoneModal
,
setPhoneModal
]
=
useState
(
false
);
const
[
dynamicValue
,
setDynamicValue
]
=
useState
(
'
pending
'
);
const
[
dynamicValue
,
setDynamicValue
]
=
useState
(
'
pending
'
);
const
[
modalState
,
setModalState
]
=
useState
(
false
);
const
[
modalState
,
setModalState
]
=
useState
(
false
);
const
[
secondLine
,
setSecondLine
]
=
useState
(
false
);
const
[
secondLine
,
setSecondLine
]
=
useState
(
false
);
const
[
innerTimer
,
setInnerTimer
]
=
useState
(
null
);
const
[
innerTimer
,
setInnerTimer
]
=
useState
(
null
);
const
[
innerCallerModal
,
setInnerCallerModal
]
=
useState
({
const
[
innerCallerModal
,
setInnerCallerModal
]
=
useState
({
bool
:
false
,
bool
:
false
,
type
:
null
,
type
:
null
,
from
:
''
,
from
:
''
,
});
});
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
secondLine
)
{
if
(
secondLine
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
setSecondLine
(
false
);
setSecondLine
(
false
);
},
5000
);
},
5000
);
}
}
},
[
secondLine
]);
},
[
secondLine
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
wsphonedata
&&
wsphonedata
?.
number
)
{
if
(
wsphonedata
&&
wsphonedata
?.
number
)
{
boxDialer
.
setSipStateChangeCallback
(
setDynamicValue
,
'
dynamicValue
'
);
boxDialer
.
setSipStateChangeCallback
(
setDynamicValue
,
'
dynamicValue
'
);
boxDialer
.
setSipStateChangeCallback
(
setModalState
,
'
modalState
'
);
boxDialer
.
setSipStateChangeCallback
(
setModalState
,
'
modalState
'
);
boxDialer
.
setSipStateChangeCallback
(
setSecondLine
,
'
secondLine
'
);
boxDialer
.
setSipStateChangeCallback
(
setSecondLine
,
'
secondLine
'
);
boxDialer
.
setSipStateChangeCallback
(
setPhoneModal
,
'
phoneModal
'
);
boxDialer
.
setSipStateChangeCallback
(
setPhoneModal
,
'
phoneModal
'
);
boxDialer
.
setSipStateChangeCallback
(
setInnerTimer
,
'
innerTimer
'
);
boxDialer
.
setSipStateChangeCallback
(
setInnerTimer
,
'
innerTimer
'
);
// // context
// // context
boxDialer
.
setSipStateChangeCallback
(
configHoldMute
.
setState
,
'
setCallEvents
'
);
boxDialer
.
setSipStateChangeCallback
(
configHoldMute
.
setState
,
'
setCallEvents
'
);
boxDialer
.
setSipStateChangeCallback
(
boxDialer
.
setSipStateChangeCallback
(
setInnerCallerModal
,
setInnerCallerModal
,
'
innerCallerModal
'
,
'
innerCallerModal
'
,
);
);
if
(
boxDialer
.
isUaRunning
())
console
.
log
(
'
UA is running! in other tab
'
);
if
(
boxDialer
.
isUaRunning
())
console
.
log
(
'
UA is running! in other tab
'
);
else
boxDialer
.
sipRegister
(
wsphonedata
);
else
boxDialer
.
sipRegister
(
wsphonedata
);
setTimeout
(
function
waitUaRegisterLost
()
{
setTimeout
(
function
waitUaRegisterLost
()
{
if
(
boxDialer
.
isUaRunning
()
||
boxDialer
.
isRestarting
)
if
(
boxDialer
.
isUaRunning
()
||
boxDialer
.
isRestarting
)
setTimeout
(
waitUaRegisterLost
,
10
);
setTimeout
(
waitUaRegisterLost
,
10
);
else
boxDialer
.
sipRegister
(
wsphonedata
);
else
boxDialer
.
sipRegister
(
wsphonedata
);
},
10
);
},
10
);
}
}
},
[]);
},
[]);
const
hangupButton
=
()
=>
{
const
hangupButton
=
()
=>
{
boxDialer
.
hangupButtonClick
();
boxDialer
.
hangupButtonClick
();
};
};
window
.
setWSData
=
(
result
)
=>
{
window
.
setWSData
=
(
result
)
=>
{
console
.
log
(
'
setWsphonedata
'
,
result
);
console
.
log
(
'
setWsphonedata
'
,
result
);
setWsphonedata
(
result
);
setWsphonedata
(
result
);
};
};
const
reasonSelect
=
async
(
e
)
=>
{
const
reasonSelect
=
async
(
e
)
=>
{
let
result
=
await
onSetDnd
(
e
);
let
result
=
await
onSetDnd
(
e
);
if
(
setWsphonedata
){
if
(
setWsphonedata
)
{
setWsphonedata
(
result
);
setWsphonedata
(
result
);
}
}
console
.
log
(
'
reasonSelect_setWsphonedata
'
,
typeof
setWsphonedata
)
console
.
log
(
'
reasonSelect_setWsphonedata
'
,
typeof
setWsphonedata
)
};
};
const
getTransferers
=
async
(
e
)
=>
{
const
getTransferers
=
async
(
e
)
=>
{
let
result
=
await
callMethod
({
let
result
=
await
callMethod
({
method
:
'
getPeers
'
,
method
:
'
getPeers
'
,
});
});
setWsphonedata
(
result
);
setWsphonedata
(
result
);
};
};
const
selectWidjetType
=
(
type
)
=>
{
const
selectWidjetType
=
(
type
)
=>
{
switch
(
type
)
{
switch
(
type
)
{
case
'
bxmini
'
:
case
'
bxmini
'
:
return
(
return
(
<
BxMiniWidjetUi
<
BxMiniWidjetUi
widjetState=
{
dynamicValue
}
widjetState=
{
dynamicValue
}
phoneNumber=
{
wsphonedata
?.
number
}
phoneNumber=
{
wsphonedata
?.
number
}
reason=
{
wsphonedata
?.
reason
}
reason=
{
wsphonedata
?.
reason
}
widjetVersion=
{
packageJson
?.
version
}
widjetVersion=
{
packageJson
?.
version
}
leftTime=
{
wsphonedata
.
lefttime
}
leftTime=
{
wsphonedata
.
lefttime
}
position=
{
wsphonedata
.
position
||
'
bottomLeft
'
}
position=
{
wsphonedata
.
position
||
'
bottomLeft
'
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
phoneModal
?
setPhoneModal
(
false
)
:
setPhoneModal
(
true
);
phoneModal
?
setPhoneModal
(
false
)
:
setPhoneModal
(
true
);
}
}
}
}
/>
/>
);
);
default
:
default
:
return
(
return
(
<
DefaultWidjetUi
<
DefaultWidjetUi
widjetState=
{
dynamicValue
}
widjetState=
{
dynamicValue
}
phoneNumber=
{
wsphonedata
?.
number
}
phoneNumber=
{
wsphonedata
?.
number
}
reason=
{
wsphonedata
?.
reason
}
reason=
{
wsphonedata
?.
reason
}
widjetVersion=
{
packageJson
?.
version
}
widjetVersion=
{
packageJson
?.
version
}
leftTime=
{
wsphonedata
.
lefttime
}
leftTime=
{
wsphonedata
.
lefttime
}
position=
{
wsphonedata
.
position
||
'
bottomLeft
'
}
position=
{
wsphonedata
.
position
||
'
bottomLeft
'
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
phoneModal
?
setPhoneModal
(
false
)
:
setPhoneModal
(
true
);
phoneModal
?
setPhoneModal
(
false
)
:
setPhoneModal
(
true
);
}
}
}
}
/>
/>
);
);
}
}
};
};
console
.
log
(
console
.
log
(
'
wsphonedata_all_data:
'
,
'
wsphonedata_all_data:
'
,
wsphonedata
?.
position
,
wsphonedata
?.
position
,
wsphonedata
?.
number
,
wsphonedata
?.
number
,
wsphonedata
,
wsphonedata
,
);
);
window
.
onbeforeunload
=
()
=>
{
window
.
onbeforeunload
=
()
=>
{
if
(
typeof
BX
!==
'
undefined
'
)
{
if
(
typeof
BX
!==
'
undefined
'
)
{
boxDialer
.
isRestarting
=
true
;
boxDialer
.
isRestarting
=
true
;
console
.
log
(
'
window_onbeforeunload =============-------------
'
);
console
.
log
(
'
window_onbeforeunload =============-------------
'
);
localStorage
.
removeItem
(
'
mycall
'
);
localStorage
.
removeItem
(
'
mycall
'
);
localStorage
.
removeItem
(
BX
.
bitrix_sessid
()
+
'
_mycall
'
);
localStorage
.
removeItem
(
BX
.
bitrix_sessid
()
+
'
_mycall
'
);
console
.
log
(
console
.
log
(
'
--==== Checking removed Items:
'
,
'
--==== Checking removed Items:
'
,
localStorage
.
getItem
(
'
mycall
'
),
localStorage
.
getItem
(
'
mycall
'
),
localStorage
.
getItem
(
BX
.
bitrix_sessid
()
+
'
_mycall
'
),
localStorage
.
getItem
(
BX
.
bitrix_sessid
()
+
'
_mycall
'
),
);
);
}
}
};
};
if
(
!
wsphonedata
||
!
wsphonedata
?.
number
||
!
wsphonedata
?.
position
)
return
;
// if (!wsphonedata || !wsphonedata?.number || !wsphonedata?.position) return;
return
(
console
.
log
(
'
wsphonedata_variant:
'
,
wsphonedata
.
variant
,
!
wsphonedata
,
!
wsphonedata
?.
number
,
!
wsphonedata
?.
position
)
<>
return
(
{
selectWidjetType
(
wsphonedata
.
variant
)
}
<>
{
selectWidjetType
(
wsphonedata
.
variant
)
}
<
ModalPhoneNumpad
modalState=
{
modalState
}
<
ModalPhoneNumpad
phoneModal=
{
phoneModal
}
modalState=
{
modalState
}
reasons=
{
wsphonedata
?.
reasons
}
phoneModal=
{
phoneModal
}
reason=
{
wsphonedata
?.
reason
}
reasons=
{
wsphonedata
?.
reasons
}
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
reason=
{
wsphonedata
?.
reason
}
dynamicValue=
{
dynamicValue
}
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
onSetDnd=
{
reasonSelect
}
dynamicValue=
{
dynamicValue
}
variant=
{
wsphonedata
.
variant
||
'
defaultWidjet
'
}
onSetDnd=
{
reasonSelect
}
position=
{
wsphonedata
.
position
||
'
bottomLeft
'
}
variant=
{
wsphonedata
.
variant
||
'
defaultWidjet
'
}
extnums=
{
wsphonedata
.
extnums
}
position=
{
wsphonedata
.
position
||
'
bottomLeft
'
}
/>
extnums=
{
wsphonedata
.
extnums
}
/>
<
Modal
className=
'tailwindGlobalCss'
<
Modal
hidden=
{
modalState
.
bool
}
className=
'tailwindGlobalCss'
// hidden={true}
hidden=
{
modalState
.
bool
}
callType=
{
modalState
.
callType
}
// hidden={true}
// callType={'connected'}
callType=
{
modalState
.
callType
}
hangupButton=
{
hangupButton
}
// callType={'connected'}
phoneNumber=
{
hangupButton=
{
hangupButton
}
modalState
.
callType
===
'
outcoming
'
phoneNumber=
{
?
'
inputValue
'
modalState
.
callType
===
'
outcoming
'
:
modalState
.
callFromName
?
'
inputValue
'
}
:
modalState
.
callFromName
/>
}
/>
<
InnerCaller
hidden=
{
innerCallerModal
.
bool
}
<
InnerCaller
// hidden={true}
hidden=
{
innerCallerModal
.
bool
}
type=
{
innerCallerModal
.
type
}
// hidden={true}
// type={'connectingIncoming'}
type=
{
innerCallerModal
.
type
}
from=
{
innerCallerModal
.
from
}
// type={'connectingIncoming'}
innerTimer=
{
innerTimer
}
from=
{
innerCallerModal
.
from
}
/>
innerTimer=
{
innerTimer
}
/>
<
SecondNotifSip
secondLine=
{
secondLine
}
/>
</>
<
SecondNotifSip
secondLine=
{
secondLine
}
/>
);
</>
);
};
};
export
default
Root
;
export
default
Root
;
...
...
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