@campxdev/shared 1.8.18 → 1.8.20

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.18",
3
+ "version": "1.8.20",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -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
  }
@@ -2,7 +2,6 @@ import { HelpOutline } from '@mui/icons-material'
2
2
  import { Button } from '@mui/material'
3
3
  import DropDownButton from '../../../DropDownButton/DropDownButton'
4
4
  import { UserStore } from '../../../../shared-state'
5
- import { toast } from 'react-toastify'
6
5
 
7
6
  export default function FreshDeskHelpButton() {
8
7
  const { user } = UserStore.useState()
@@ -17,10 +16,20 @@ export default function FreshDeskHelpButton() {
17
16
  }
18
17
 
19
18
  const handleFreshChat = () => {
19
+ const _window = window as any
20
20
  try {
21
- ;(window as any)?.fcWidget?.open()
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
+ })
22
32
  } catch (error) {
23
- toast.error('Error launching Freshdesk Chat')
24
33
  // eslint-disable-next-line no-console
25
34
  console.log(error)
26
35
  // eslint-disable-next-line no-console
@@ -12,18 +12,27 @@ const getInnerHtml = (user: any) => {
12
12
  },
13
13
  }
14
14
 
15
+ const phone = user?.mobile?.substring(user?.mobile?.length - 10)
16
+
15
17
  return `
16
18
  window.fcWidgetMessengerConfig = ${JSON.stringify(fcWidgetMessengerConfig)}
17
19
  window.fcSettings = {
18
- onInit: function() {
19
- window.fcWidget.setExternalId('${user?.email}')
20
- window.fcWidget.user.setFirstName('${user?.fullName}')
21
- window.fcWidget.user.setEmail('${user?.email}')
22
- window.fcWidget.user.setPhone('${user?.mobile}')
20
+ onInit: function() {
21
+ window.fcWidget.user.clear().then(function() {
22
+ console.log('User cleared');
23
+ }, function() {
24
+ console.log("User Not cleared");
25
+ });
26
+ window.fcWidget.setExternalId('${phone}')
27
+ window.fcWidget.user.setFirstName('${user?.fullName}')
28
+ window.fcWidget.user.setEmail('${user?.email}')
29
+ window.fcWidget.user.setPhone('${phone}')
30
+ }
23
31
  }
24
- }
25
- `
32
+
33
+ `
26
34
  }
35
+ // window.fcWidget.user.setPhone('${user?.mobile}')
27
36
 
28
37
  interface IHelmetProps {
29
38
  appTitle: string