@tellescope/react-components 1.127.0 → 1.129.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/react-components",
3
- "version": "1.127.0",
3
+ "version": "1.129.0",
4
4
  "description": "",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -47,12 +47,12 @@
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.127.0",
51
- "@tellescope/sdk": "^1.127.0",
52
- "@tellescope/types-client": "^1.127.0",
53
- "@tellescope/types-models": "^1.127.0",
50
+ "@tellescope/constants": "^1.129.0",
51
+ "@tellescope/sdk": "^1.129.0",
52
+ "@tellescope/types-client": "^1.129.0",
53
+ "@tellescope/types-models": "^1.129.0",
54
54
  "@tellescope/types-utilities": "^1.69.3",
55
- "@tellescope/utilities": "^1.127.0",
55
+ "@tellescope/utilities": "^1.129.0",
56
56
  "@typescript-eslint/eslint-plugin": "^4.33.0",
57
57
  "@typescript-eslint/parser": "^4.33.0",
58
58
  "css-to-react-native": "^3.0.0",
@@ -79,7 +79,7 @@
79
79
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
80
80
  "react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
81
81
  },
82
- "gitHead": "1393e45b767e134b53ec044a6206254094e1b76d",
82
+ "gitHead": "1ed0a4f0df3a89a1f75a1e5ee8900e470de8a69b",
83
83
  "publishConfig": {
84
84
  "access": "public"
85
85
  }
@@ -2596,11 +2596,13 @@ export const AppointmentBookingInput = ({ formResponseId, field, value, onChange
2596
2596
  .join(',')
2597
2597
  }`
2598
2598
  }
2599
- if (field.options?.holdAppointmentMinutes && formResponseId) {
2600
- bookingURL += `&formResponseId=${formResponseId}`
2599
+ // need to use form?.id for internally-submitted forms because formResponseId isn't generated until initial submission or saved draft
2600
+ if (field.options?.holdAppointmentMinutes && (formResponseId || field?.id)) {
2601
+ bookingURL += `&formResponseId=${formResponseId || field?.id}`
2601
2602
  bookingURL += `&holdAppointmentMinutes=${field.options.holdAppointmentMinutes}`
2602
2603
  }
2603
2604
 
2605
+ console.log(bookingURL, formResponseId, field?.id, field.options?.holdAppointmentMinutes)
2604
2606
  return (
2605
2607
  <Grid container direction="column" spacing={1} sx={{ mt: 1 }}>
2606
2608
  {/* When skipping user selection, include a back button at the top for clearer navigation on mobile */}
@@ -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, AutomationTrigger, CalendarEventTemplate, ChatRoom, Database, DatabaseRecord, Enduser, File, Form, FormGroup, Forum, Journey, ManagedContentRecord, Organization, PrescriptionRoute, Template, Ticket, User, UserNotification } from "@tellescope/types-client"
9
- import { Button, Checkbox, Flex, HoverPaper, LoadingButton, LoadingData, LoadingLinear, ScrollingList, SearchTextInput, Typography, useAppointmentBookingPages, useAutomationTriggers, useCalendarEventTemplates, useChatRooms, useDatabaseRecords, useDatabases, useEndusers, useFiles, useFormGroups, useForms, useForums, useJourneys, useManagedContentRecords, useNotifications, useOrganization, useOrganizations, usePrescriptionRoutes, useResolvedSession, useSession, useTemplates, useTickets, useUsers, value_is_loaded } from "."
8
+ import { AppointmentBookingPage, AppointmentLocation, AutomationTrigger, CalendarEventTemplate, ChatRoom, Database, DatabaseRecord, Enduser, File, Form, FormGroup, Forum, Journey, ManagedContentRecord, MessageTemplateSnippet, Organization, PrescriptionRoute, Template, Ticket, User, UserNotification } from "@tellescope/types-client"
9
+ import { Button, Checkbox, Flex, HoverPaper, LoadingButton, LoadingData, LoadingLinear, ScrollingList, SearchTextInput, Typography, useAppointmentBookingPages, useAppointmentLocations, useAutomationTriggers, useCalendarEventTemplates, useChatRooms, useDatabaseRecords, useDatabases, useEndusers, useFiles, useFormGroups, useForms, useForums, useJourneys, useManagedContentRecords, useMessageTemplateSnippets, useNotifications, useOrganization, useOrganizations, usePrescriptionRoutes, useResolvedSession, useSession, useTemplates, useTickets, useUsers, value_is_loaded } from "."
10
10
  import { SxProps } from "@mui/material"
11
11
  import { AccessPermissions } from "@tellescope/types-models"
12
12
 
@@ -661,6 +661,17 @@ export const EnduserOrUserSearch = (props: Omit<GenericSearchProps<Enduser | Use
661
661
  )
662
662
  }
663
663
 
664
+ export const MessageTemplateSnippetSearch = ({ dontFetch, ...props }: Omit<GenericSearchProps<MessageTemplateSnippet>, 'filterKey'> & { filterKey?: string }) => {
665
+ const session = useSession()
666
+ const [, { addLocalElements }] = useMessageTemplateSnippets({ dontFetch })
667
+ return (
668
+ <ModelSearchInput filterKey="message_template_snippets" {...props}
669
+ searchAPI={session.api.message_template_snippets.getSome}
670
+ onLoad={addLocalElements}
671
+ />
672
+ )
673
+ }
674
+
664
675
  export const ContentSearch = ({ dontFetch, ...props }: Omit<GenericSearchProps<ManagedContentRecord>, 'filterKey'> & { filterKey?: string }) => {
665
676
  const session = useResolvedSession()
666
677
  const [, { addLocalElements }] = useManagedContentRecords({ dontFetch })
@@ -683,6 +694,17 @@ export const CalendarEventTemplatesSearch = (props: Omit<GenericSearchProps<Cale
683
694
  )
684
695
  }
685
696
 
697
+ export const AppointmentLocationSearch = (props: Omit<GenericSearchProps<AppointmentLocation>, 'filterKey'> & { filterKey?: string }) => {
698
+ const session = useSession()
699
+ const [, { addLocalElements }] = useAppointmentLocations()
700
+ return (
701
+ <ModelSearchInput filterKey="appointment_locations" {...props}
702
+ searchAPI={session.api.appointment_locations.getSome}
703
+ onLoad={addLocalElements}
704
+ />
705
+ )
706
+ }
707
+
686
708
  export const AppointmentBookingPagesSearch = (props: Omit<GenericSearchProps<AppointmentBookingPage>, 'filterKey'> & { filterKey?: string }) => {
687
709
  const session = useSession()
688
710
  const [, { addLocalElements }] = useAppointmentBookingPages()
package/src/state.tsx CHANGED
@@ -89,6 +89,7 @@ import {
89
89
  WebhookLog,
90
90
  FormGroup,
91
91
  PortalBranding,
92
+ MessageTemplateSnippet,
92
93
  } from "@tellescope/types-client"
93
94
 
94
95
  import {
@@ -103,7 +104,7 @@ import {
103
104
  } from '@tellescope/sdk'
104
105
  import { value_is_loaded } from './loading'
105
106
  import { matches_organization, object_is_empty, objects_equivalent } from '@tellescope/utilities'
106
- import { Model, ModelName, ReadFilter, SortBy } from '@tellescope/types-models'
107
+ import { ModelName, ReadFilter, SortBy } from '@tellescope/types-models'
107
108
 
108
109
  const RESET_CACHE_TYPE = "cache/reset" as const
109
110
  export const resetStateAction = createAction(RESET_CACHE_TYPE)
@@ -345,6 +346,7 @@ const flowchartNotesSlice = createSliceForList<FlowchartNote, 'flowchart_notes'>
345
346
  const webhookLogsSlice = createSliceForList<WebhookLog, 'webhook_logs'>('webhook_logs')
346
347
  const formGroupsSlice = createSliceForList<FormGroup, 'form_groups'>('form_groups')
347
348
  const portalBrandingsSlice = createSliceForList<PortalBranding, 'portal_brandings'>('portal_brandings')
349
+ const messageTemplateSnippetsSlice = createSliceForList<MessageTemplateSnippet, 'message_template_snippets'>('message_template_snippets')
348
350
 
349
351
  const roleBasedAccessPermissionsSlice = createSliceForList<RoleBasedAccessPermission, 'role_based_access_permissions'>('role_based_access_permissions')
350
352
 
@@ -428,6 +430,7 @@ export const sharedConfig = {
428
430
  webhook_logs: webhookLogsSlice.reducer,
429
431
  form_groups: formGroupsSlice.reducer,
430
432
  portal_brandings: portalBrandingsSlice.reducer,
433
+ message_template_snippets: messageTemplateSnippetsSlice.reducer,
431
434
  },
432
435
  }
433
436
 
@@ -1171,6 +1174,24 @@ export const useUserAndEnduserDisplayInfo = () => {
1171
1174
  return displayInfo
1172
1175
  }
1173
1176
 
1177
+ export const useMessageTemplateSnippets = (options={} as HookOptions<MessageTemplateSnippet>) => {
1178
+ const session = useSession()
1179
+
1180
+ return useListStateHook('message_template_snippets', useTypedSelector(s => s.message_template_snippets), session, messageTemplateSnippetsSlice,
1181
+ {
1182
+ loadQuery: session.api.message_template_snippets.getSome,
1183
+ findOne: session.api.message_template_snippets.getOne,
1184
+ findByIds: session.api.message_template_snippets.getByIds,
1185
+ addOne: session.api.message_template_snippets.createOne,
1186
+ addSome: session.api.message_template_snippets.createSome,
1187
+ deleteOne: session.api.message_template_snippets.deleteOne,
1188
+ updateOne: session.api.message_template_snippets.updateOne,
1189
+ },
1190
+ {
1191
+ ...options,
1192
+ },
1193
+ )
1194
+ }
1174
1195
  export const usePortalBrandings = (options={} as HookOptions<PortalBranding>) => {
1175
1196
  const session = useSession()
1176
1197
 
package/src/table.tsx CHANGED
@@ -1029,8 +1029,8 @@ export const Table = <T extends Item>({
1029
1029
  onExport={
1030
1030
  onExport ? () => {
1031
1031
  onExport({
1032
- // use items, not sorted, as sorted only includes first page
1033
- data: items.map(s => fields.map(f => f.getExportData?.(s) || '')),
1032
+ // use items, not sorted, as sorted only includes first page when paginated
1033
+ data: (paginated ? items : sorted).map(s => fields.map(f => f.getExportData?.(s) || '')),
1034
1034
  labels: fields.map(f => f.label)
1035
1035
  })
1036
1036
  }