@tellescope/react-components 1.147.0 → 1.148.1

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": "@tellescope/react-components",
3
- "version": "1.147.0",
3
+ "version": "1.148.1",
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.1.0",
49
49
  "@stripe/stripe-js": "^1.52.1",
50
- "@tellescope/constants": "^1.147.0",
51
- "@tellescope/sdk": "^1.147.0",
52
- "@tellescope/types-client": "^1.147.0",
53
- "@tellescope/types-models": "^1.147.0",
54
- "@tellescope/types-utilities": "^1.147.0",
55
- "@tellescope/utilities": "^1.147.0",
56
- "@tellescope/validation": "^1.147.0",
50
+ "@tellescope/constants": "^1.148.0",
51
+ "@tellescope/sdk": "^1.148.1",
52
+ "@tellescope/types-client": "^1.148.0",
53
+ "@tellescope/types-models": "^1.148.0",
54
+ "@tellescope/types-utilities": "^1.148.0",
55
+ "@tellescope/utilities": "^1.148.0",
56
+ "@tellescope/validation": "^1.148.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",
@@ -80,7 +80,7 @@
80
80
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
81
81
  "react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
82
82
  },
83
- "gitHead": "4d70bc3ec1dc5e0856d17717ef2452f961b46059",
83
+ "gitHead": "e557342a6982e69ee08124c95003163cb5f9a4ba",
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  }
@@ -5,8 +5,8 @@ import { LoadFunction, LoadFunctionArguments } from "@tellescope/sdk"
5
5
  import { ALL_ACCESS, UNSEARCHABLE_FIELDS } from "@tellescope/constants"
6
6
  import { SearchAPIProps, useSearchAPI } from "./hooks"
7
7
  import { TextFieldProps } from "./mui"
8
- import { AppointmentBookingPage, AppointmentLocation, AutomationTrigger, CalendarEventTemplate, CallHoldQueue, ChatRoom, Database, DatabaseRecord, Enduser, FaxLog, File, Form, FormGroup, Forum, Journey, ManagedContentRecord, MessageTemplateSnippet, Organization, PrescriptionRoute, SuggestedContact, Template, Ticket, TicketQueue, User, UserNotification } from "@tellescope/types-client"
9
- import { Button, Checkbox, Flex, HoverPaper, LoadingButton, LoadingData, LoadingLinear, ScrollingList, SearchTextInput, Typography, useAppointmentBookingPages, useAppointmentLocations, useAutomationTriggers, useCalendarEventTemplates, useCallHoldQueues, useChatRooms, useDatabaseRecords, useDatabases, useEndusers, useFaxLogs, useFiles, useFormGroups, useForms, useForums, useJourneys, useManagedContentRecords, useMessageTemplateSnippets, useNotifications, useOrganization, useOrganizations, usePrescriptionRoutes, useResolvedSession, useSession, useSuggestedContacts, useTemplates, useTicketQueues, useTickets, useUsers, value_is_loaded } from "."
8
+ import { AppointmentBookingPage, AppointmentLocation, AutomationTrigger, CalendarEventTemplate, CallHoldQueue, ChatRoom, Database, DatabaseRecord, Enduser, EnduserOrder, FaxLog, File, Form, FormGroup, Forum, Journey, ManagedContentRecord, MessageTemplateSnippet, Organization, PrescriptionRoute, SuggestedContact, Template, Ticket, TicketQueue, User, UserNotification } from "@tellescope/types-client"
9
+ import { Button, Checkbox, Flex, HoverPaper, LoadingButton, LoadingData, LoadingLinear, ScrollingList, SearchTextInput, Typography, useAppointmentBookingPages, useAppointmentLocations, useAutomationTriggers, useCalendarEventTemplates, useCallHoldQueues, useChatRooms, useDatabaseRecords, useDatabases, useEnduserOrders, useEndusers, useFaxLogs, useFiles, useFormGroups, useForms, useForums, useJourneys, useManagedContentRecords, useMessageTemplateSnippets, useNotifications, useOrganization, useOrganizations, usePrescriptionRoutes, useResolvedSession, useSession, useSuggestedContacts, useTemplates, useTicketQueues, useTickets, useUsers, value_is_loaded } from "."
10
10
  import { SxProps } from "@mui/material"
11
11
  import { AccessPermissions } from "@tellescope/types-models"
12
12
 
@@ -512,6 +512,39 @@ export const TicketSearch = (props: Omit<GenericSearchProps<Ticket>, 'filterKey'
512
512
  )
513
513
  }
514
514
 
515
+ export const ENDUSER_ORDERS_SEARCH_FILTER_KEY = 'ticket-search'
516
+ export const EnduserOrdersSearch = (props: Omit<GenericSearchProps<EnduserOrder>, 'filterKey'> & { filterKey?: string }) => {
517
+ const session = useResolvedSession()
518
+ const [, { addLocalElements }] = useEnduserOrders()
519
+ const [endusersLoading, { findById: findEnduser }] = useEndusers()
520
+
521
+ // wait for users/endusers to load, so that a saved query is able to match attachSearchableFields
522
+ if (!value_is_loaded(endusersLoading)) return null
523
+ return (
524
+ <ModelSearchInput filterKey={ENDUSER_ORDERS_SEARCH_FILTER_KEY} {...props}
525
+ searchAPI={session.api.enduser_orders.getSome}
526
+ onLoad={addLocalElements}
527
+ attachSearchableFields={t => {
528
+ const enduser = findEnduser(t.enduserId ?? '', { batch: true })
529
+ if (!enduser) return undefined
530
+
531
+ const fields = {} as Record<string, string>
532
+ if (enduser) {
533
+ fields.enduser_fname = enduser.fname || '';
534
+ fields.enduser_lname = enduser.lname || '';
535
+ fields.enduser_fullname = `${enduser.fname} ${enduser.lname}`;
536
+ fields.enduser_email = enduser.email || '';
537
+ if (enduser.tags?.length) {
538
+ fields.tags = enduser.tags.join(',')
539
+ }
540
+ }
541
+
542
+ return fields
543
+ }}
544
+ />
545
+ )
546
+ }
547
+
515
548
  export const PrescriptionRoutesSearch = (props: Omit<GenericSearchProps<PrescriptionRoute>, 'filterKey'> & { filterKey?: string }) => {
516
549
  const session = useSession()
517
550
  const [, { addLocalElements }] = usePrescriptionRoutes()