@campxdev/shared 1.8.16 → 1.8.17

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/shared",
3
- "version": "1.8.16",
3
+ "version": "1.8.17",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -1,5 +1,6 @@
1
1
  import { HelpOutline } from '@mui/icons-material'
2
2
  import { Button } from '@mui/material'
3
+ import DropDownButton from '../../../DropDownButton/DropDownButton'
3
4
 
4
5
  export default function FreshDeskHelpButton() {
5
6
  const handleOpenFreshDeskWidget = () => {
@@ -10,15 +11,40 @@ export default function FreshDeskHelpButton() {
10
11
  console.error('Error launching Freshdesk')
11
12
  }
12
13
  }
14
+
15
+ const handleFreshChat = () => {
16
+ try {
17
+ ;(window as any)?.fcWidget?.open()
18
+ } catch (error) {
19
+ // eslint-disable-next-line no-console
20
+ console.error('Error launching Freshdesk Chat')
21
+ }
22
+ }
13
23
  return (
14
- <Button
15
- variant="text"
16
- color="secondary"
17
- startIcon={<HelpOutline />}
18
- onClick={handleOpenFreshDeskWidget}
19
- sx={{ padding: '20px' }}
20
- >
21
- Help
22
- </Button>
24
+ <>
25
+ <DropDownButton
26
+ anchor={({ open }) => (
27
+ <Button
28
+ variant="text"
29
+ color="secondary"
30
+ onClick={open}
31
+ startIcon={<HelpOutline />}
32
+ sx={{ padding: '20px' }}
33
+ >
34
+ Help
35
+ </Button>
36
+ )}
37
+ menu={[
38
+ {
39
+ label: 'Raise a Ticket',
40
+ onClick: handleOpenFreshDeskWidget,
41
+ },
42
+ {
43
+ label: 'Chat with us',
44
+ onClick: handleFreshChat,
45
+ },
46
+ ]}
47
+ />
48
+ </>
23
49
  )
24
50
  }
@@ -44,6 +44,19 @@ export default function Helmet({
44
44
  },
45
45
  ...link,
46
46
  ]}
47
+ script={[
48
+ {
49
+ type: 'text/javascript',
50
+ innerHTML:
51
+ 'window.fcWidgetMessengerConfig = {config: {headerProperty: {hideChatButton: true}}}',
52
+ defer: true,
53
+ },
54
+ {
55
+ type: 'text/javascript',
56
+ src: '//in.fw-cdn.com/30814322/430238.js',
57
+ defer: true,
58
+ },
59
+ ]}
47
60
  />
48
61
  )
49
62
  }