@tellescope/react-components 1.155.0 → 1.157.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.155.0",
3
+ "version": "1.157.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.9.0",
49
49
  "@stripe/stripe-js": "^1.52.1",
50
- "@tellescope/constants": "^1.155.0",
51
- "@tellescope/sdk": "^1.155.0",
52
- "@tellescope/types-client": "^1.155.0",
53
- "@tellescope/types-models": "^1.155.0",
54
- "@tellescope/types-utilities": "^1.155.0",
55
- "@tellescope/utilities": "^1.155.0",
56
- "@tellescope/validation": "^1.155.0",
50
+ "@tellescope/constants": "^1.157.1",
51
+ "@tellescope/sdk": "^1.157.1",
52
+ "@tellescope/types-client": "^1.157.1",
53
+ "@tellescope/types-models": "^1.157.1",
54
+ "@tellescope/types-utilities": "^1.157.1",
55
+ "@tellescope/utilities": "^1.157.1",
56
+ "@tellescope/validation": "^1.157.1",
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": "be943fbead3f47347ebff8ddc8f3e21c789490a4",
83
+ "gitHead": "5019608eaa05afae077c4bf4551306a31f60cb73",
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  }
@@ -1459,12 +1459,12 @@ export const StripeInput = ({ field, value, onChange, setCustomerId }: FormInput
1459
1459
 
1460
1460
  session.api.form_responses.stripe_details({ fieldId: field.id })
1461
1461
  .then(({ clientSecret, publishableKey, stripeAccount, businessName, customerId, isCheckout, answerText }) => {
1462
+ setAnswertext(answerText || '')
1462
1463
  setIsCheckout(!!isCheckout)
1463
1464
  setClientSecret(clientSecret)
1464
1465
  setStripePromise(loadStripe(publishableKey, { stripeAccount }))
1465
1466
  setBusinessName(businessName)
1466
1467
  setCustomerId(customerId)
1467
- setAnswertext(answerText || '')
1468
1468
  })
1469
1469
  .catch(console.error)
1470
1470
  }, [session, value, field.id])
@@ -1758,7 +1758,6 @@ export const DatabaseSelectInput = ({ field, value: _value, onChange, onDatabase
1758
1758
  otherAnswers: get_other_answers(_value, field?.options?.other ? typing : undefined),
1759
1759
  })
1760
1760
 
1761
- console.log(choices, _value)
1762
1761
  const value = React.useMemo(() => {
1763
1762
  try {
1764
1763
  // if the value is a string (some single answer that was save), make sure we coerce to array
@@ -1794,13 +1793,15 @@ export const DatabaseSelectInput = ({ field, value: _value, onChange, onDatabase
1794
1793
  const v = c.values.find(_v => _v.label === field.options?.databaseFilter?.databaseLabel)?.value
1795
1794
  if (!v) return true
1796
1795
 
1796
+ // use .text on r values to handle Database Select types as filter source (in addition to basic text and list of text)
1797
+
1797
1798
  if (typeof v === 'object') {
1798
1799
  return !!(
1799
1800
  Object.values(v).find(oVal => (
1800
1801
  typeof oVal === 'string' || typeof oVal === 'number'
1801
1802
  ? (
1802
1803
  Array.isArray(filterResponse)
1803
- ? (filterResponse as any[]).find(r => r === oVal.toString())
1804
+ ? (filterResponse as any[]).find(r => r === oVal.toString() || (typeof r === 'object' && r.text === oVal))
1804
1805
  : (typeof filterResponse === 'string' || typeof filterResponse === 'number')
1805
1806
  ? filterResponse.toString() === oVal.toString()
1806
1807
  : false
@@ -1813,7 +1814,7 @@ export const DatabaseSelectInput = ({ field, value: _value, onChange, onDatabase
1813
1814
  if (typeof v === 'string' || typeof v === 'number') {
1814
1815
  return !!(
1815
1816
  Array.isArray(filterResponse)
1816
- ? (filterResponse as any[]).find(r => r === v.toString())
1817
+ ? (filterResponse as any[]).find(r => r === v.toString() || (typeof r === 'object' && r.text === v))
1817
1818
  : (typeof filterResponse === 'string' || typeof filterResponse === 'number')
1818
1819
  ? filterResponse.toString() === v.toString()
1819
1820
  : false
package/src/errors.tsx CHANGED
@@ -30,7 +30,14 @@ export class ErrorBoundary extends React.Component<{ errorMessage?: string }, {
30
30
  }
31
31
  }
32
32
 
33
- export const stringForError = (err: any) => (err as APIError)?.message ?? err?.toString() ?? 'An unexpected error occurred'
33
+ export const stringForError = (err: any) => {
34
+ const toReturn = (err as APIError)?.message ?? err?.toString() ?? 'An unexpected error occurred'
35
+
36
+ // if ?.message isn't a string (by mistake), handle gracefully
37
+ if (typeof toReturn === 'object') { return JSON.stringify(toReturn, null, 2)}
38
+
39
+ return toReturn
40
+ }
34
41
 
35
42
  export const parseUniquenessError = (err: any, uniquenessMessage: string) => {
36
43
  const message = stringForError(err)
package/src/state.tsx CHANGED
@@ -95,6 +95,7 @@ import {
95
95
  SuggestedContact,
96
96
  DiagnosisCode,
97
97
  AllergyCode,
98
+ IntegrationLog,
98
99
  } from "@tellescope/types-client"
99
100
 
100
101
  import {
@@ -357,6 +358,7 @@ const faxLogsSlice = createSliceForList<FaxLog, 'fax_logs'>('fax_logs')
357
358
  const suggestedContactsSlice = createSliceForList<SuggestedContact, 'suggested_contacts'>('suggested_contacts')
358
359
  const diagnosisCodesSlice = createSliceForList<DiagnosisCode, 'diagnosis_codes'>('diagnosis_codes')
359
360
  const allergyCodesSlice = createSliceForList<AllergyCode, 'allergy_codes'>('allergy_codes')
361
+ const integrationLogsSlice = createSliceForList<IntegrationLog, 'integration_logs'>('integration_logs')
360
362
 
361
363
  const roleBasedAccessPermissionsSlice = createSliceForList<RoleBasedAccessPermission, 'role_based_access_permissions'>('role_based_access_permissions')
362
364
 
@@ -365,6 +367,7 @@ const userLogsSlice = createSliceForList<UserLog, 'user_logs'>('user_logs')
365
367
 
366
368
  export const sharedConfig = {
367
369
  reducer: {
370
+ integration_logs: integrationLogsSlice.reducer,
368
371
  ticket_queues: ticketQueuesSlice.reducer,
369
372
  automation_triggers: automationTriggersSlice.reducer,
370
373
  automated_actions: automatedActionsSlice.reducer,
@@ -1350,6 +1353,22 @@ export const useEnduserOrders = (options={} as HookOptions<EnduserOrder>) => {
1350
1353
  {...options}
1351
1354
  )
1352
1355
  }
1356
+ export const useIntegrationLogs = (options={} as HookOptions<IntegrationLog>) => {
1357
+ const session = useSession()
1358
+ return useListStateHook(
1359
+ 'integration_logs', useTypedSelector(s => s.integration_logs), session, integrationLogsSlice,
1360
+ {
1361
+ loadQuery: session.api.integration_logs.getSome,
1362
+ findOne: session.api.integration_logs.getOne,
1363
+ findByIds: session.api.integration_logs.getByIds,
1364
+ addOne: session.api.integration_logs.createOne,
1365
+ addSome: session.api.integration_logs.createSome,
1366
+ deleteOne: session.api.integration_logs.deleteOne,
1367
+ updateOne: session.api.integration_logs.updateOne,
1368
+ },
1369
+ {...options}
1370
+ )
1371
+ }
1353
1372
  export const useWebhookLogs = (options={} as HookOptions<WebhookLog>) => {
1354
1373
  const session = useSession()
1355
1374
  return useListStateHook(
package/src/table.tsx CHANGED
@@ -146,6 +146,7 @@ export interface TableHeaderProps<T extends Item> extends Styled, HorizontalPadd
146
146
  localFilters: LocalFilter[],
147
147
  setLocalFilters: React.Dispatch<React.SetStateAction<LocalFilter[]>>,
148
148
  filterSuggestions: Record<string, string[]>,
149
+ minColumnWidth?: number,
149
150
  }
150
151
  export const TableHeader = <T extends Item>({
151
152
  fields,
@@ -165,6 +166,7 @@ export const TableHeader = <T extends Item>({
165
166
  localFilters,
166
167
  setLocalFilters,
167
168
  filterSuggestions,
169
+ minColumnWidth=75,
168
170
  } : TableHeaderProps<T>) => {
169
171
  const [openFilter, setOpenFilter] = useState(-1)
170
172
  const [startX, setStartX] = useState(0)
@@ -249,7 +251,7 @@ export const TableHeader = <T extends Item>({
249
251
  justifyContent: textAlign === 'right' ? 'flex-end' : 'flex-start',
250
252
  width: (
251
253
  typeof width === 'number'
252
- ? Math.max(75, width + (widthOffsets[key] || 0))
254
+ ? Math.max(minColumnWidth, width + (widthOffsets[key] || 0))
253
255
  : (width ?? defaultWidthForFields(fields.length))
254
256
  ),
255
257
  alignItems: 'center',
@@ -384,6 +386,7 @@ export interface TableRowProps<T extends Item> extends Styled, HorizontalPadded,
384
386
  fontSize?: CSSProperties['fontSize']
385
387
  textStyle?: CSSProperties,
386
388
  widthOffsets: Record<string, number>,
389
+ minColumnWidth?: number,
387
390
  }
388
391
  export const TableRow = <T extends Item>({
389
392
  item, indices, fields, onClick, onPress, hover,
@@ -400,6 +403,7 @@ export const TableRow = <T extends Item>({
400
403
  widthOffsets,
401
404
  allowUnselectItemsAfterSelectAll,
402
405
  setAllSelected,
406
+ minColumnWidth=75,
403
407
  } : TableRowProps<T>) => (
404
408
  <WithHover hoveredColor={hoveredColor ?? GRAY} notHoveredColor={notHoveredColor} disabled={!hover} flex>
405
409
  <Flex flex={1} alignItems="center"
@@ -442,7 +446,7 @@ export const TableRow = <T extends Item>({
442
446
  textAlign, fontSize,
443
447
  width: (
444
448
  typeof width === 'number'
445
- ? Math.max(75, width + (widthOffsets[key] || 0))
449
+ ? Math.max(minColumnWidth, width + (widthOffsets[key] || 0))
446
450
  : (width ?? defaultWidthForFields(fields.length))
447
451
  ),
448
452
  // display: flex ? 'flex' : undefined,
@@ -453,7 +457,7 @@ export const TableRow = <T extends Item>({
453
457
  {get_display_value(item, key, indices, render, {
454
458
  adjustedWidth: (
455
459
  typeof width === 'number'
456
- ? Math.max(75, width + (widthOffsets[key] || 0))
460
+ ? Math.max(minColumnWidth, width + (widthOffsets[key] || 0))
457
461
  : undefined
458
462
  )
459
463
  })}
@@ -720,6 +724,7 @@ export interface TableProps<T extends Item> extends WithTitle, WithHeader<T>, Wi
720
724
  sort?: SortingField[],
721
725
  loadMoreOptions?: LoadMoreOptions<T>,
722
726
  refreshFilterSuggestionsKey?: number,
727
+ minColumnWidth?: number,
723
728
  }
724
729
  export const Table = <T extends Item>({
725
730
  items,
@@ -773,6 +778,7 @@ export const Table = <T extends Item>({
773
778
 
774
779
  sort,
775
780
  refreshFilterSuggestionsKey,
781
+ minColumnWidth,
776
782
  }: TableProps<T> & Styled) => {
777
783
  const sortingStorageKey = (memoryId ?? '') + 'sorting'
778
784
  const cachedSortString = read_local_storage(sortingStorageKey)
@@ -1038,6 +1044,7 @@ export const Table = <T extends Item>({
1038
1044
  }
1039
1045
  : undefined
1040
1046
  }
1047
+ minColumnWidth={minColumnWidth}
1041
1048
  />
1042
1049
  )}
1043
1050
 
@@ -1078,6 +1085,7 @@ export const Table = <T extends Item>({
1078
1085
  : undefined,
1079
1086
  }}
1080
1087
  onClick={onClick} onPress={onPress}
1088
+ minColumnWidth={minColumnWidth}
1081
1089
  />
1082
1090
  )
1083
1091
  } />