@tellescope/react-components 1.187.0 → 1.189.0

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.
Files changed (49) hide show
  1. package/lib/cjs/CMS/ContentViewer.d.ts +19 -0
  2. package/lib/cjs/CMS/ContentViewer.d.ts.map +1 -1
  3. package/lib/cjs/CMS/ContentViewer.js +57 -1
  4. package/lib/cjs/CMS/ContentViewer.js.map +1 -1
  5. package/lib/cjs/Forms/forms.js +1 -1
  6. package/lib/cjs/Forms/forms.js.map +1 -1
  7. package/lib/cjs/Forms/inputs.d.ts +1 -1
  8. package/lib/cjs/Forms/inputs.d.ts.map +1 -1
  9. package/lib/cjs/Forms/inputs.js +2 -2
  10. package/lib/cjs/Forms/inputs.js.map +1 -1
  11. package/lib/cjs/inputs_shared.d.ts +1 -0
  12. package/lib/cjs/inputs_shared.d.ts.map +1 -1
  13. package/lib/cjs/inputs_shared.js +11 -4
  14. package/lib/cjs/inputs_shared.js.map +1 -1
  15. package/lib/cjs/state.js +1 -1
  16. package/lib/esm/CMS/ContentViewer.d.ts +19 -0
  17. package/lib/esm/CMS/ContentViewer.d.ts.map +1 -1
  18. package/lib/esm/CMS/ContentViewer.js +55 -0
  19. package/lib/esm/CMS/ContentViewer.js.map +1 -1
  20. package/lib/esm/CMS/components.d.ts +1 -0
  21. package/lib/esm/CMS/components.d.ts.map +1 -1
  22. package/lib/esm/Forms/form_responses.d.ts +1 -0
  23. package/lib/esm/Forms/form_responses.d.ts.map +1 -1
  24. package/lib/esm/Forms/forms.d.ts +3 -3
  25. package/lib/esm/Forms/forms.js +1 -1
  26. package/lib/esm/Forms/forms.js.map +1 -1
  27. package/lib/esm/Forms/hooks.d.ts +1 -0
  28. package/lib/esm/Forms/hooks.d.ts.map +1 -1
  29. package/lib/esm/Forms/inputs.d.ts +2 -2
  30. package/lib/esm/Forms/inputs.d.ts.map +1 -1
  31. package/lib/esm/Forms/inputs.js +2 -2
  32. package/lib/esm/Forms/inputs.js.map +1 -1
  33. package/lib/esm/controls.d.ts +2 -2
  34. package/lib/esm/inputs.d.ts +1 -1
  35. package/lib/esm/inputs.native.d.ts +1 -0
  36. package/lib/esm/inputs.native.d.ts.map +1 -1
  37. package/lib/esm/inputs_shared.d.ts +2 -1
  38. package/lib/esm/inputs_shared.d.ts.map +1 -1
  39. package/lib/esm/inputs_shared.js +12 -5
  40. package/lib/esm/inputs_shared.js.map +1 -1
  41. package/lib/esm/state.d.ts +284 -284
  42. package/lib/esm/state.js +1 -1
  43. package/lib/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +9 -9
  45. package/src/CMS/ContentViewer.tsx +84 -0
  46. package/src/Forms/forms.tsx +1 -1
  47. package/src/Forms/inputs.tsx +2 -1
  48. package/src/inputs_shared.tsx +23 -6
  49. package/src/state.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/react-components",
3
- "version": "1.187.0",
3
+ "version": "1.189.0",
4
4
  "description": "",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -47,13 +47,13 @@
47
47
  "@reduxjs/toolkit": "^1.6.2",
48
48
  "@stripe/react-stripe-js": "^2.9.0",
49
49
  "@stripe/stripe-js": "^1.52.1",
50
- "@tellescope/constants": "^1.187.0",
51
- "@tellescope/sdk": "^1.187.0",
52
- "@tellescope/types-client": "^1.187.0",
53
- "@tellescope/types-models": "^1.187.0",
54
- "@tellescope/types-utilities": "^1.187.0",
55
- "@tellescope/utilities": "^1.187.0",
56
- "@tellescope/validation": "^1.187.0",
50
+ "@tellescope/constants": "^1.189.0",
51
+ "@tellescope/sdk": "^1.189.0",
52
+ "@tellescope/types-client": "^1.189.0",
53
+ "@tellescope/types-models": "^1.189.0",
54
+ "@tellescope/types-utilities": "^1.189.0",
55
+ "@tellescope/utilities": "^1.189.0",
56
+ "@tellescope/validation": "^1.189.0",
57
57
  "@typescript-eslint/eslint-plugin": "^4.33.0",
58
58
  "@typescript-eslint/parser": "^4.33.0",
59
59
  "css-to-react-native": "^3.0.0",
@@ -84,7 +84,7 @@
84
84
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
85
85
  "react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
86
86
  },
87
- "gitHead": "fbb905922b74dd70b690751a272ede269ef9fcb1",
87
+ "gitHead": "f7e7f3107237f5c850d62a6ec78b0d557ba2e71f",
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  }
@@ -6,6 +6,90 @@ import { PDFBlockUI } from "./components"
6
6
  import { css } from "@emotion/css"
7
7
  import { useManagedContentRecords } from "../state"
8
8
 
9
+ interface UseContentHeightOptions {
10
+ /**
11
+ * Debounce time in milliseconds for resize observation
12
+ * @default 100
13
+ */
14
+ debounceTime?: number;
15
+
16
+ /**
17
+ * CSS selector for the element to observe
18
+ * @default 'body'
19
+ */
20
+ targetSelector?: string;
21
+ }
22
+
23
+ /**
24
+ * A hook that tracks the height of page content and updates when content changes.
25
+ * @param options - Configuration options
26
+ * @returns Current content height in pixels
27
+ */
28
+ export const usePageContentHeight = (options: UseContentHeightOptions = {}): number => {
29
+ const {
30
+ debounceTime = 100,
31
+ targetSelector = 'body'
32
+ } = options;
33
+
34
+ const [contentHeight, setContentHeight] = useState<number>(0);
35
+ const debounceTimerRef = useRef<NodeJS.Timeout | null>(null);
36
+ const observerRef = useRef<MutationObserver | null>(null);
37
+
38
+ useEffect(() => {
39
+ // Function to measure content height
40
+ const updateContentHeight = (): void => {
41
+ const targetElement = document.querySelector(targetSelector);
42
+
43
+ if (targetElement) {
44
+ // Use scrollHeight to get the total height including overflow content
45
+ const height = targetElement.scrollHeight;
46
+ setContentHeight(height);
47
+ }
48
+ };
49
+
50
+ // Debounced update function
51
+ const debouncedUpdate = (): void => {
52
+ if (debounceTimerRef.current) {
53
+ clearTimeout(debounceTimerRef.current);
54
+ }
55
+
56
+ debounceTimerRef.current = setTimeout(() => {
57
+ updateContentHeight();
58
+ }, debounceTime);
59
+ };
60
+
61
+ // Initial measurement
62
+ updateContentHeight();
63
+
64
+ // Set up mutation observer to detect content changes
65
+ observerRef.current = new MutationObserver(debouncedUpdate);
66
+
67
+ const targetElement = document.querySelector(targetSelector);
68
+ if (targetElement) {
69
+ observerRef.current.observe(targetElement, {
70
+ childList: true, // Watch for changes in direct children
71
+ subtree: true, // Watch for changes in the entire subtree
72
+ characterData: true, // Watch for changes in text content
73
+ attributes: true // Watch for changes in attributes (may affect layout)
74
+ });
75
+ }
76
+
77
+ // Cleanup
78
+ return () => {
79
+ if (observerRef.current) {
80
+ observerRef.current.disconnect();
81
+ }
82
+
83
+ if (debounceTimerRef.current) {
84
+ clearTimeout(debounceTimerRef.current);
85
+ }
86
+ };
87
+ }, [debounceTime, targetSelector]);
88
+
89
+ return contentHeight;
90
+ }
91
+
92
+
9
93
  export const usePageHeight = () => {
10
94
  const [height, setHeight] = useState(window.innerHeight)
11
95
 
@@ -322,7 +322,7 @@ export const QuestionForField = ({
322
322
  <Dropdown field={field} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<'Dropdown'>} form={form}/>
323
323
  )
324
324
  : field.type === 'Database Select' ? (
325
- <DatabaseSelect field={field} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<'Database Select'>}
325
+ <DatabaseSelect field={field} disabled={value.disabled} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<'Database Select'>}
326
326
  onDatabaseSelect={handleDatabaseSelect}
327
327
  responses={responses} form={form}
328
328
  />
@@ -1899,7 +1899,7 @@ const get_other_answers = (_value?: DatabaseSelectResponse[], typing?: string) =
1899
1899
  return []
1900
1900
  }
1901
1901
 
1902
- export const DatabaseSelectInput = ({ field, value: _value, onChange, onDatabaseSelect, responses, size }: FormInputProps<'Database Select'> & {
1902
+ export const DatabaseSelectInput = ({ field, value: _value, onChange, onDatabaseSelect, responses, size, disabled }: FormInputProps<'Database Select'> & {
1903
1903
  responses: FormResponseValue[],
1904
1904
  }) => {
1905
1905
  const [typing, setTyping] = useState('')
@@ -2003,6 +2003,7 @@ export const DatabaseSelectInput = ({ field, value: _value, onChange, onDatabase
2003
2003
  : label_for_database_record(field, o)
2004
2004
  )}
2005
2005
  value={value}
2006
+ disabled={disabled}
2006
2007
  onChange={(_, v) => {
2007
2008
  if (v.length && onDatabaseSelect) {
2008
2009
  onDatabaseSelect(v)
@@ -6,7 +6,7 @@ import { ALL_ACCESS, HEALTHIE_TITLE, UNSEARCHABLE_FIELDS } from "@tellescope/con
6
6
  import { SearchAPIProps, useSearchAPI } from "./hooks"
7
7
  import { TextFieldProps } from "./mui"
8
8
  import { AgentRecord, AllergyCode, AppointmentBookingPage, AppointmentLocation, AutomationTrigger, CalendarEventTemplate, CallHoldQueue, ChatRoom, Database, DatabaseRecord, DiagnosisCode, Enduser, EnduserOrder, FaxLog, File, Form, FormGroup, Forum, Journey, ManagedContentRecord, MessageTemplateSnippet, Organization, PrescriptionRoute, SuggestedContact, Template, Ticket, TicketQueue, User, UserNotification, Waitlist } from "@tellescope/types-client"
9
- import { Button, Checkbox, Flex, HoverPaper, LoadingButton, LoadingData, ScrollingList, SearchTextInput, Typography, useAgentRecords, useAllergyCodes, useAppointmentBookingPages, useAppointmentLocations, useAutomationTriggers, useCalendarEventTemplates, useCallHoldQueues, useChatRooms, useDatabaseRecords, useDatabases, useDiagnosisCodes, useEnduserOrders, useEndusers, useFaxLogs, useFiles, useFormGroups, useForms, useForums, useJourneys, useManagedContentRecords, useMessageTemplateSnippets, useNotifications, useOrganization, useOrganizations, usePrescriptionRoutes, useResolvedSession, useSession, useSuggestedContacts, useTemplates, useTicketQueues, useTickets, useUsers, useWaitlists, value_is_loaded } from "."
9
+ import { Button, Checkbox, Flex, HoverPaper, LoadingButton, LoadingData, ScrollingList, SearchTextInput, Typography, useAgentRecords, useAllergyCodes, useAppointmentBookingPages, useAppointmentLocations, useAutomationTriggers, useCalendarEventTemplates, useCallHoldQueues, useChatRooms, useDatabaseRecords, useDatabases, useDiagnosisCodes, useEnduserCustomTypes, useEnduserOrders, useEndusers, useFaxLogs, useFiles, useFormGroups, useForms, useForums, useJourneys, useManagedContentRecords, useMessageTemplateSnippets, useNotifications, useOrganization, useOrganizations, usePrescriptionRoutes, useResolvedSession, useSession, useSuggestedContacts, useTemplates, useTicketQueues, useTickets, useUsers, useWaitlists, value_is_loaded } from "."
10
10
  import { SxProps } from "@mui/material"
11
11
  import { AccessPermissions, ListOfStringsWithQualifier } from "@tellescope/types-models"
12
12
 
@@ -1374,6 +1374,7 @@ export interface UserAndEnduserSelectorProps {
1374
1374
  limitToUsers?: User[],
1375
1375
  dontIncludeSelf: boolean,
1376
1376
  virtualizationHeight?: number,
1377
+ showEntityType?: boolean,
1377
1378
  }
1378
1379
  export const UserAndEnduserSelector: React.JSXElementConstructor<UserAndEnduserSelectorProps> = ({
1379
1380
  titleInput,
@@ -1394,12 +1395,17 @@ export const UserAndEnduserSelector: React.JSXElementConstructor<UserAndEnduserS
1394
1395
  limitToUsers,
1395
1396
  dontIncludeSelf,
1396
1397
  virtualizationHeight,
1398
+ showEntityType,
1397
1399
  }) => {
1398
1400
  const session = useResolvedSession()
1399
1401
  const [endusersLoading, { loadMore: loadMoreEndusers, doneLoading: doneLoadingEndusers }] = useEndusers()
1400
1402
  const [usersLoading, { loadMore: loadMoreUsers, doneLoading: doneLoadingUsers }] = useUsers({
1401
1403
  dontFetch: !!limitToUsers
1402
1404
  })
1405
+ const [typesLoading] = useEnduserCustomTypes({ dontFetch: !showEntityType })
1406
+ const entityTypes = useMemo(() => (
1407
+ value_is_loaded(typesLoading) ? typesLoading.value : []
1408
+ ),[typesLoading])
1403
1409
 
1404
1410
  const doneLoading = useCallback(() =>
1405
1411
  (excludeUsers || doneLoadingUsers()) && (excludeEndusers || doneLoadingEndusers()),
@@ -1534,11 +1540,22 @@ export const UserAndEnduserSelector: React.JSXElementConstructor<UserAndEnduserS
1534
1540
  >
1535
1541
  <Checkbox checked={selected.includes(user.id)} />
1536
1542
 
1537
- <Typography style={{
1538
- fontWeight: selected.includes(user.id) ? 'bold' : undefined,
1539
- }}>
1540
- {user_display_name(user)}
1541
- </Typography>
1543
+ <Flex flex={1} column alignItems="flex-end" justifyContent="center">
1544
+ <Typography style={{
1545
+ fontWeight: selected.includes(user.id) ? 'bold' : undefined,
1546
+ }}>
1547
+ {user_display_name(user)}
1548
+ </Typography>
1549
+
1550
+ {showEntityType && (user as Enduser).customTypeId &&
1551
+ <Typography style={{
1552
+ fontWeight: selected.includes(user.id) ? 'bold' : undefined,
1553
+ fontSize: 12.5,
1554
+ }}>
1555
+ {entityTypes.find(t => t.id === (user as Enduser).customTypeId)?.title}
1556
+ </Typography>
1557
+ }
1558
+ </Flex>
1542
1559
  </Flex>
1543
1560
  </HoverPaper>
1544
1561
  )}
package/src/state.tsx CHANGED
@@ -597,7 +597,7 @@ export const useDataSync____internal = () => {
597
597
  }
598
598
 
599
599
  // ensure we don't miss updates due to latency
600
- const from = new Date(lastFetch.current.getTime() - 1000) // large leeway could result in same data being fetched twice, but helps ensure nothing is dropped
600
+ const from = new Date(lastFetch.current.getTime() - 3000) // large leeway could result in same data being fetched twice, but helps ensure nothing is dropped
601
601
  lastFetch.current = new Date() // update before syncing, not after it returns
602
602
 
603
603
  session