@campxdev/shared 1.8.21 → 1.8.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2,24 +2,31 @@
|
|
|
2
2
|
import { useState } from 'react'
|
|
3
3
|
import { UserStore } from '../../../../shared-state'
|
|
4
4
|
import { chatWithUs } from '../assets'
|
|
5
|
-
import { Box } from '@mui/material'
|
|
5
|
+
import { Box, styled } from '@mui/material'
|
|
6
6
|
|
|
7
7
|
export default function FreshChatButton() {
|
|
8
8
|
const _window = window as any
|
|
9
|
-
const [show, setShow] = useState(false)
|
|
10
9
|
const { user } = UserStore.useState()
|
|
11
10
|
|
|
12
11
|
var openWidget = function () {
|
|
13
|
-
document.getElementById('fc_frame')
|
|
12
|
+
const el = document.getElementById('fc_frame')
|
|
13
|
+
if (el) {
|
|
14
|
+
el.style.visibility = 'visible'
|
|
15
|
+
}
|
|
14
16
|
_window.fcWidget.open()
|
|
15
17
|
initEvents()
|
|
16
18
|
}
|
|
17
19
|
var initEvents = function () {
|
|
20
|
+
const el = document.getElementById('custom_fc_button')
|
|
18
21
|
_window.fcWidget.on('widget:opened', function (resp) {
|
|
19
|
-
|
|
22
|
+
if (el) {
|
|
23
|
+
el.style.visibility = 'hidden'
|
|
24
|
+
}
|
|
20
25
|
})
|
|
21
26
|
_window.fcWidget.on('widget:closed', function (resp) {
|
|
22
|
-
|
|
27
|
+
if (el) {
|
|
28
|
+
el.style.visibility = 'visible'
|
|
29
|
+
}
|
|
23
30
|
})
|
|
24
31
|
}
|
|
25
32
|
|
|
@@ -38,14 +45,17 @@ export default function FreshChatButton() {
|
|
|
38
45
|
}}
|
|
39
46
|
>
|
|
40
47
|
<a id="open_fc_widget" onClick={openWidget} style={{ cursor: 'pointer' }}>
|
|
41
|
-
<
|
|
42
|
-
style={{
|
|
43
|
-
width: '40px',
|
|
44
|
-
height: 'auto',
|
|
45
|
-
}}
|
|
46
|
-
src={chatWithUs}
|
|
47
|
-
/>
|
|
48
|
+
<StyledImg src={chatWithUs} />
|
|
48
49
|
</a>
|
|
49
50
|
</Box>
|
|
50
51
|
)
|
|
51
52
|
}
|
|
53
|
+
|
|
54
|
+
const StyledImg = styled('img')(({ theme }) => ({
|
|
55
|
+
width: '35px',
|
|
56
|
+
height: 'auto',
|
|
57
|
+
'&:hover': {
|
|
58
|
+
width: '50px',
|
|
59
|
+
},
|
|
60
|
+
transition: 'width 0.3s',
|
|
61
|
+
}))
|