@campxdev/shared 1.8.19 → 1.8.21
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 +1 -1
- package/src/components/Input/MultiSelect.tsx +3 -0
- package/src/components/Layout/Header/HeaderActions/FreshChatButton.tsx +51 -0
- package/src/components/Layout/Header/HeaderActions/FreshDeskHelpButton.tsx +9 -47
- package/src/components/Layout/Header/assets/chat_with_us.png +0 -0
- package/src/components/Layout/Header/assets/index.ts +2 -0
- package/src/components/Layout/Helmet.tsx +61 -50
- package/src/contexts/LoginFormProvider.tsx +2 -7
- package/src/contexts/Providers.tsx +3 -1
package/package.json
CHANGED
|
@@ -80,6 +80,7 @@ interface MultiSelectProps {
|
|
|
80
80
|
error?: boolean
|
|
81
81
|
helperText?: string
|
|
82
82
|
multiple?: boolean
|
|
83
|
+
limitTags?: number
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
export default function MultiSelect({
|
|
@@ -93,6 +94,7 @@ export default function MultiSelect({
|
|
|
93
94
|
error,
|
|
94
95
|
helperText,
|
|
95
96
|
multiple = true,
|
|
97
|
+
limitTags = -1,
|
|
96
98
|
...props
|
|
97
99
|
}: MultiSelectProps) {
|
|
98
100
|
return (
|
|
@@ -107,6 +109,7 @@ export default function MultiSelect({
|
|
|
107
109
|
if (!onChange) return
|
|
108
110
|
onChange(value)
|
|
109
111
|
}}
|
|
112
|
+
limitTags={limitTags}
|
|
110
113
|
isOptionEqualToValue={(option: any, value: any) =>
|
|
111
114
|
option?.value === value?.value
|
|
112
115
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import { UserStore } from '../../../../shared-state'
|
|
4
|
+
import { chatWithUs } from '../assets'
|
|
5
|
+
import { Box } from '@mui/material'
|
|
6
|
+
|
|
7
|
+
export default function FreshChatButton() {
|
|
8
|
+
const _window = window as any
|
|
9
|
+
const [show, setShow] = useState(false)
|
|
10
|
+
const { user } = UserStore.useState()
|
|
11
|
+
|
|
12
|
+
var openWidget = function () {
|
|
13
|
+
document.getElementById('fc_frame').style.visibility = 'visible'
|
|
14
|
+
_window.fcWidget.open()
|
|
15
|
+
initEvents()
|
|
16
|
+
}
|
|
17
|
+
var initEvents = function () {
|
|
18
|
+
_window.fcWidget.on('widget:opened', function (resp) {
|
|
19
|
+
document.getElementById('custom_fc_button').style.visibility = 'hidden'
|
|
20
|
+
})
|
|
21
|
+
_window.fcWidget.on('widget:closed', function (resp) {
|
|
22
|
+
document.getElementById('custom_fc_button').style.visibility = 'visible'
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!user) return null
|
|
27
|
+
return (
|
|
28
|
+
<Box
|
|
29
|
+
id="custom_fc_button"
|
|
30
|
+
sx={{
|
|
31
|
+
position: 'fixed',
|
|
32
|
+
right: 0,
|
|
33
|
+
bottom: '18px',
|
|
34
|
+
cursor: 'pointer',
|
|
35
|
+
'@media print': {
|
|
36
|
+
display: 'none',
|
|
37
|
+
},
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
<a id="open_fc_widget" onClick={openWidget} style={{ cursor: 'pointer' }}>
|
|
41
|
+
<img
|
|
42
|
+
style={{
|
|
43
|
+
width: '40px',
|
|
44
|
+
height: 'auto',
|
|
45
|
+
}}
|
|
46
|
+
src={chatWithUs}
|
|
47
|
+
/>
|
|
48
|
+
</a>
|
|
49
|
+
</Box>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { HelpOutline } from '@mui/icons-material'
|
|
2
2
|
import { Button } from '@mui/material'
|
|
3
|
-
import DropDownButton from '../../../DropDownButton/DropDownButton'
|
|
4
3
|
import { UserStore } from '../../../../shared-state'
|
|
5
4
|
|
|
6
5
|
export default function FreshDeskHelpButton() {
|
|
@@ -15,52 +14,15 @@ export default function FreshDeskHelpButton() {
|
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
const handleFreshChat = () => {
|
|
19
|
-
const _window = window as any
|
|
20
|
-
try {
|
|
21
|
-
_window?.fcWidget?.open()
|
|
22
|
-
|
|
23
|
-
_window.fcWidget.on('widget:opened', function (resp) {
|
|
24
|
-
// eslint-disable-next-line no-console
|
|
25
|
-
console.log('Widget Opened', resp)
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
_window.fcWidget.on('widget:closed', function () {
|
|
29
|
-
// eslint-disable-next-line no-console
|
|
30
|
-
console.log('Message Dialog Closed by the User')
|
|
31
|
-
})
|
|
32
|
-
} catch (error) {
|
|
33
|
-
// eslint-disable-next-line no-console
|
|
34
|
-
console.log(error)
|
|
35
|
-
// eslint-disable-next-line no-console
|
|
36
|
-
console.error('Error launching Freshdesk Chat')
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
17
|
return (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
>
|
|
50
|
-
Help
|
|
51
|
-
</Button>
|
|
52
|
-
)}
|
|
53
|
-
menu={[
|
|
54
|
-
{
|
|
55
|
-
label: 'Raise a Ticket',
|
|
56
|
-
onClick: handleOpenFreshDeskWidget,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
label: 'Chat with us',
|
|
60
|
-
onClick: handleFreshChat,
|
|
61
|
-
},
|
|
62
|
-
]}
|
|
63
|
-
/>
|
|
64
|
-
</>
|
|
18
|
+
<Button
|
|
19
|
+
variant="text"
|
|
20
|
+
color="secondary"
|
|
21
|
+
onClick={handleOpenFreshDeskWidget}
|
|
22
|
+
startIcon={<HelpOutline />}
|
|
23
|
+
sx={{ padding: '20px' }}
|
|
24
|
+
>
|
|
25
|
+
Help
|
|
26
|
+
</Button>
|
|
65
27
|
)
|
|
66
28
|
}
|
|
Binary file
|
|
@@ -14,6 +14,7 @@ import commuteSmall from './commutexSmall.svg'
|
|
|
14
14
|
import commutex from './commutex.png'
|
|
15
15
|
import hostelx from './hostelx.png'
|
|
16
16
|
import enrollSmall from './enroll_logo.svg'
|
|
17
|
+
import chatWithUs from './chat_with_us.png'
|
|
17
18
|
|
|
18
19
|
export {
|
|
19
20
|
collegex,
|
|
@@ -32,4 +33,5 @@ export {
|
|
|
32
33
|
commutex,
|
|
33
34
|
commuteSmall,
|
|
34
35
|
enrollSmall,
|
|
36
|
+
chatWithUs,
|
|
35
37
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react'
|
|
1
2
|
import { Helmet as ReactHelmet } from 'react-helmet'
|
|
2
3
|
|
|
3
|
-
type MetaProps = JSX.IntrinsicElements['meta']
|
|
4
|
-
type LinkProps = JSX.IntrinsicElements['link']
|
|
4
|
+
// type MetaProps = JSX.IntrinsicElements['meta']
|
|
5
|
+
// type LinkProps = JSX.IntrinsicElements['link']
|
|
5
6
|
|
|
6
7
|
const getInnerHtml = (user: any) => {
|
|
7
8
|
const fcWidgetMessengerConfig = {
|
|
@@ -18,12 +19,8 @@ const getInnerHtml = (user: any) => {
|
|
|
18
19
|
window.fcWidgetMessengerConfig = ${JSON.stringify(fcWidgetMessengerConfig)}
|
|
19
20
|
window.fcSettings = {
|
|
20
21
|
onInit: function() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, function() {
|
|
24
|
-
console.log("User Not cleared");
|
|
25
|
-
});
|
|
26
|
-
window.fcWidget.setExternalId('${phone}')
|
|
22
|
+
console.log('Fresh Chat Init')
|
|
23
|
+
window.fcWidget.setExternalId('${user?.email}')
|
|
27
24
|
window.fcWidget.user.setFirstName('${user?.fullName}')
|
|
28
25
|
window.fcWidget.user.setEmail('${user?.email}')
|
|
29
26
|
window.fcWidget.user.setPhone('${phone}')
|
|
@@ -34,61 +31,75 @@ const getInnerHtml = (user: any) => {
|
|
|
34
31
|
}
|
|
35
32
|
// window.fcWidget.user.setPhone('${user?.mobile}')
|
|
36
33
|
|
|
34
|
+
// window.fcWidget.user.clear().then(function() {
|
|
35
|
+
// console.log('User cleared');
|
|
36
|
+
// }, function() {
|
|
37
|
+
// console.log("User Not cleared");
|
|
38
|
+
// });
|
|
39
|
+
|
|
37
40
|
interface IHelmetProps {
|
|
38
41
|
appTitle: string
|
|
39
42
|
favicon: string
|
|
40
43
|
description?: string
|
|
41
|
-
meta?: MetaProps[] | undefined
|
|
42
|
-
link?: LinkProps[] | undefined
|
|
43
44
|
user: any
|
|
45
|
+
extraMetaTags?: ReactNode
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
export default function Helmet({
|
|
47
49
|
appTitle,
|
|
48
50
|
favicon,
|
|
49
51
|
description,
|
|
50
|
-
meta = [],
|
|
51
|
-
link = [],
|
|
52
52
|
user,
|
|
53
|
+
extraMetaTags,
|
|
53
54
|
}: IHelmetProps) {
|
|
54
55
|
return (
|
|
55
|
-
<ReactHelmet
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
meta={
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
56
|
+
<ReactHelmet htmlAttributes={{ lang: 'en' }}>
|
|
57
|
+
<title>{appTitle}</title>
|
|
58
|
+
<meta charSet="utf-8" />
|
|
59
|
+
<meta name="description" content={description} />
|
|
60
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
61
|
+
{extraMetaTags}
|
|
62
|
+
<link rel="icon" href={favicon} />
|
|
63
|
+
<link rel="apple-touch-icon" href={favicon} />
|
|
64
|
+
<script
|
|
65
|
+
type="text/javascript"
|
|
66
|
+
src="//in.fw-cdn.com/30814322/430238.js"
|
|
67
|
+
defer
|
|
68
|
+
/>
|
|
69
|
+
<script defer>{getInnerHtml(user)}</script>
|
|
70
|
+
|
|
71
|
+
<script async defer>
|
|
72
|
+
{`
|
|
73
|
+
window.fwSettings = {
|
|
74
|
+
widget_id: 85000000149,
|
|
75
|
+
}
|
|
76
|
+
!(function () {
|
|
77
|
+
window.openFreshDeskWidget = function openFreshDeskWidget() {
|
|
78
|
+
FreshworksWidget('open', 'ticketForm')
|
|
79
|
+
}
|
|
80
|
+
if ('function' != typeof window.FreshworksWidget) {
|
|
81
|
+
var n = function () {
|
|
82
|
+
n.q.push(arguments)
|
|
83
|
+
}
|
|
84
|
+
;(n.q = []), (window.FreshworksWidget = n)
|
|
85
|
+
}
|
|
86
|
+
FreshworksWidget('hide', 'launcher')
|
|
87
|
+
})()
|
|
88
|
+
`}
|
|
89
|
+
</script>
|
|
90
|
+
<script
|
|
91
|
+
type="text/javascript"
|
|
92
|
+
src="https://ind-widget.freshworks.com/widgets/85000000149.js"
|
|
93
|
+
defer
|
|
94
|
+
></script>
|
|
95
|
+
<style type="text/css">
|
|
96
|
+
{`
|
|
97
|
+
#fc_frame {
|
|
98
|
+
bottom: 0 !important;
|
|
99
|
+
right: 0 !important;
|
|
100
|
+
}
|
|
101
|
+
`}
|
|
102
|
+
</style>
|
|
103
|
+
</ReactHelmet>
|
|
93
104
|
)
|
|
94
105
|
}
|
|
@@ -8,19 +8,14 @@ const LoginContext = createContext<{
|
|
|
8
8
|
openLoginForm: (loginUrl: string) => {},
|
|
9
9
|
})
|
|
10
10
|
|
|
11
|
-
export default function LoginFormProvider({ children
|
|
11
|
+
export default function LoginFormProvider({ children }) {
|
|
12
12
|
const modal = useModal()
|
|
13
13
|
|
|
14
14
|
const onLogin = (loginUrl: string) => {
|
|
15
15
|
modal({
|
|
16
16
|
title: 'Developer Login',
|
|
17
17
|
content({ close }) {
|
|
18
|
-
return
|
|
19
|
-
<LoginForm
|
|
20
|
-
loginUrl={loginUrl}
|
|
21
|
-
showSuperAdminForm={showSuperAdminForm}
|
|
22
|
-
/>
|
|
23
|
-
)
|
|
18
|
+
return <LoginForm loginUrl={loginUrl} />
|
|
24
19
|
},
|
|
25
20
|
})
|
|
26
21
|
}
|
|
@@ -9,6 +9,7 @@ import { ToastContainer } from '../components'
|
|
|
9
9
|
import DialogProvider from '../components/DrawerWrapper/DrawerWrapper'
|
|
10
10
|
import GlobalNetworkLoadingIndicator from '../components/ErrorBoundary/GlobalNetworkLoadingIndicator'
|
|
11
11
|
import LoginFormProvider from './LoginFormProvider'
|
|
12
|
+
import FreshChatButton from '../components/Layout/Header/HeaderActions/FreshChatButton'
|
|
12
13
|
|
|
13
14
|
export const campxTenantKey = Cookies.get('campx_tenant')
|
|
14
15
|
export const urlTenantKey = window.location.pathname.split('/')[1]
|
|
@@ -36,9 +37,10 @@ export default function Providers({
|
|
|
36
37
|
<MuiThemeProvider>
|
|
37
38
|
<ConfirmContextProvider>
|
|
38
39
|
<DialogProvider>
|
|
39
|
-
<LoginFormProvider
|
|
40
|
+
<LoginFormProvider>
|
|
40
41
|
{children}
|
|
41
42
|
<GlobalNetworkLoadingIndicator />
|
|
43
|
+
<FreshChatButton />
|
|
42
44
|
</LoginFormProvider>
|
|
43
45
|
<ToastContainer />
|
|
44
46
|
</DialogProvider>
|