@tellescope/react-components 1.252.0 → 1.252.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.252.0",
3
+ "version": "1.252.1",
4
4
  "description": "",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -51,13 +51,13 @@
51
51
  "@reduxjs/toolkit": "1.9.0",
52
52
  "@stripe/react-stripe-js": "2.9.0",
53
53
  "@stripe/stripe-js": "1.52.1",
54
- "@tellescope/constants": "1.252.0",
55
- "@tellescope/sdk": "1.252.0",
56
- "@tellescope/types-client": "1.252.0",
57
- "@tellescope/types-models": "1.252.0",
58
- "@tellescope/types-utilities": "1.252.0",
59
- "@tellescope/utilities": "1.252.0",
60
- "@tellescope/validation": "1.252.0",
54
+ "@tellescope/constants": "1.252.1",
55
+ "@tellescope/sdk": "1.252.1",
56
+ "@tellescope/types-client": "1.252.1",
57
+ "@tellescope/types-models": "1.252.1",
58
+ "@tellescope/types-utilities": "1.252.1",
59
+ "@tellescope/utilities": "1.252.1",
60
+ "@tellescope/validation": "1.252.1",
61
61
  "@twilio/video-processors": "3.2.0",
62
62
  "css-to-react-native": "3.0.0",
63
63
  "draft-js": "0.11.7",
@@ -85,7 +85,7 @@
85
85
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
86
86
  "react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
87
87
  },
88
- "gitHead": "00b42c82462699491547e2bded4aad41a5d57daa",
88
+ "gitHead": "f5dc3564f0f61a9dc910ada9a55a68fad2217bec",
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  }
@@ -253,9 +253,10 @@ export const ArticleViewer = ({
253
253
  : block.type === 'youtube' ? (
254
254
  <iframe width={rootWidth} height={rootWidth * 315 / 560}
255
255
  title={`YouTube video player ${i}`} allowFullScreen
256
+ referrerPolicy="strict-origin-when-cross-origin"
256
257
  src={correct_youtube_link_for_embed(block.info.link)}
257
258
  >
258
- </iframe>
259
+ </iframe>
259
260
  )
260
261
  : block.type === 'iframe' ? (
261
262
  <iframe width={rootWidth}
@@ -318,10 +319,11 @@ export const html_for_article = (article: ManagedContentRecord, options?: { root
318
319
  </div>`
319
320
  )
320
321
  : block.type === 'youtube' ? (
321
- `<iframe width="${rootWidth}"
322
+ `<iframe width="${rootWidth}"
322
323
  height="${rootWidth * 315 / 560}"
323
324
  title="${`YouTube video player ${i}`}"
324
325
  allowFullScreen
326
+ referrerpolicy="strict-origin-when-cross-origin"
325
327
  src="${correct_youtube_link_for_embed(block.info.link)}"
326
328
  style="margin-top: 12; margin-bottom: 12"
327
329
  >
@@ -3,7 +3,7 @@ import { Button, CircularProgress, FileBlob, FileUploadHandler, Flex, LinearProg
3
3
  import { useListForFormFields, useOrganizationTheme, useTellescopeForm, WithOrganizationTheme, Response, FileResponse, NextFieldLogicOptions } from "./hooks"
4
4
  import { ChangeHandler, FormInputs } from "./types"
5
5
  import { AddToDatabaseProps, AddressInput, AllergiesInput, AppointmentBookingInput, BelugaPatientPreferenceInput, BridgeEligibilityInput, CandidEligibilityInput, ChargeebeeInput, ConditionsInput, DatabaseSelectInput, DateInput, DateStringInput, DropdownInput, EmailInput, EmotiiInput, FileInput, FilesInput, HeightInput, HiddenValueInput, InsuranceInput, LanguageSelect, MedicationsInput, MultipleChoiceInput, NumberInput, PharmacySearchInput, PhoneInput, Progress, RankingInput, RatingInput, RedirectInput, RelatedContactsInput, RichTextInput, SignatureInput, StringInput, StringLongInput, StripeInput, TableInput, TimeInput, TimezoneInput, defaultButtonStyles } from "./inputs"
6
- import { PRIMARY_HEX } from "@tellescope/constants"
6
+ import { PRIMARY_HEX, DEFAULT_HISTORICAL_DATA_SOURCE_LIMIT } from "@tellescope/constants"
7
7
  import { FormResponse, FormField, Form, Enduser } from "@tellescope/types-client"
8
8
  import { FormResponseAnswerFileValue, OrganizationTheme, HistoricalDataSource } from "@tellescope/types-models"
9
9
  import { calculate_form_scoring, field_can_autosubmit, form_response_value_to_string, formatted_date, object_is_empty, objects_equivalent, read_local_storage, sanitize_user_html, responses_satisfy_conditions, truncate_string } from "@tellescope/utilities"
@@ -1037,7 +1037,7 @@ export const UpdateResponse = ({
1037
1037
  )
1038
1038
  }
1039
1039
 
1040
- const HistoricalDataSection = ({ sources, enduserId, onDataLoaded } : { sources: HistoricalDataSource[], enduserId: string, onDataLoaded?: (json: string) => void }) => {
1040
+ export const HistoricalDataSection = ({ sources, enduserId, onDataLoaded, hideHeaders } : { sources: HistoricalDataSource[], enduserId: string, onDataLoaded?: (json: string) => void, hideHeaders?: boolean }) => {
1041
1041
  const session = useSession({ throwIfMissingContext: false })
1042
1042
  const [observations, setObservations] = useState<any[]>([])
1043
1043
  const [medications, setMedications] = useState<any[]>([])
@@ -1067,7 +1067,7 @@ const HistoricalDataSection = ({ sources, enduserId, onDataLoaded } : { sources:
1067
1067
  promises.push(
1068
1068
  session.api.enduser_observations.getSome({
1069
1069
  filter: { enduserId, ...source.filter },
1070
- limit: source.limit,
1070
+ limit: source.limit ?? DEFAULT_HISTORICAL_DATA_SOURCE_LIMIT,
1071
1071
  sortBy: 'timestamp',
1072
1072
  sort: 'newFirst',
1073
1073
  })
@@ -1077,7 +1077,7 @@ const HistoricalDataSection = ({ sources, enduserId, onDataLoaded } : { sources:
1077
1077
  promises.push(
1078
1078
  session.api.enduser_medications.getSome({
1079
1079
  filter: { enduserId, status: { _ne: 'draft' }, ...source.filter },
1080
- limit: source.limit,
1080
+ limit: source.limit ?? DEFAULT_HISTORICAL_DATA_SOURCE_LIMIT,
1081
1081
  })
1082
1082
  .then((meds: any[]) => { loadedMedications = meds; setMedications(meds) })
1083
1083
  )
@@ -1143,7 +1143,7 @@ const HistoricalDataSection = ({ sources, enduserId, onDataLoaded } : { sources:
1143
1143
  <div style={{ marginTop: 10 }}>
1144
1144
  {hasObservations && (
1145
1145
  <div style={{ marginBottom: 15 }}>
1146
- <Typography style={{ fontWeight: 'bold', marginBottom: 5 }}>Observations</Typography>
1146
+ {!hideHeaders && <Typography style={{ fontWeight: 'bold', marginBottom: 5 }}>Observations</Typography>}
1147
1147
  {observations.length === 0 ? (
1148
1148
  <Typography style={{ fontStyle: 'italic', color: '#888' }}>No observations found</Typography>
1149
1149
  ) : (
@@ -1177,7 +1177,7 @@ const HistoricalDataSection = ({ sources, enduserId, onDataLoaded } : { sources:
1177
1177
 
1178
1178
  {hasMedications && (
1179
1179
  <div style={{ marginBottom: 15 }}>
1180
- <Typography style={{ fontWeight: 'bold', marginBottom: 5 }}>Medications</Typography>
1180
+ {!hideHeaders && <Typography style={{ fontWeight: 'bold', marginBottom: 5 }}>Medications</Typography>}
1181
1181
  {medications.length === 0 ? (
1182
1182
  <Typography style={{ fontStyle: 'italic', color: '#888' }}>No medications found</Typography>
1183
1183
  ) : (
package/src/hooks.ts CHANGED
@@ -31,8 +31,9 @@ export const useLoadedState = <T, D={}>(fetch?: (d: Partial<D>) => Promise<T | v
31
31
  export interface SearchAPIProps <T> {
32
32
  searchAPI?: (args: { search: { query: string } }) => Promise<T[]>,
33
33
  onLoad?: (results: T[]) => void,
34
+ debounceMS?: number,
34
35
  }
35
- export const useSearchAPI = <T,>({ query, onLoad, searchAPI } : { query: string } & SearchAPIProps<T>) => {
36
+ export const useSearchAPI = <T,>({ query, onLoad, searchAPI, debounceMS = 300 } : { query: string } & SearchAPIProps<T>) => {
36
37
  const searchedRef = useRef('')
37
38
 
38
39
  useEffect(() => {
@@ -56,10 +57,10 @@ export const useSearchAPI = <T,>({ query, onLoad, searchAPI } : { query: string
56
57
  onLoad?.(results)
57
58
  })
58
59
  .catch(console.error)
59
- }, 150)
60
+ }, debounceMS)
60
61
 
61
62
  return () => { clearTimeout(t) }
62
- }, [query, searchAPI, onLoad, searchedRef])
63
+ }, [query, searchAPI, onLoad, searchedRef, debounceMS])
63
64
  }
64
65
 
65
66
  export const useAddGTMTag = (gtmTag?: string) => {