@tellescope/react-components 1.153.1 → 1.155.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/lib/cjs/CMS/components.d.ts +0 -1
- package/lib/cjs/CMS/components.d.ts.map +1 -1
- package/lib/cjs/Forms/form_responses.d.ts +0 -1
- package/lib/cjs/Forms/form_responses.d.ts.map +1 -1
- package/lib/cjs/Forms/forms.d.ts +6 -0
- package/lib/cjs/Forms/forms.d.ts.map +1 -1
- package/lib/cjs/Forms/forms.js +6 -5
- package/lib/cjs/Forms/forms.js.map +1 -1
- package/lib/cjs/Forms/hooks.d.ts +0 -1
- package/lib/cjs/Forms/hooks.d.ts.map +1 -1
- package/lib/cjs/Forms/hooks.js +3 -0
- package/lib/cjs/Forms/hooks.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts +1 -1
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +103 -38
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/controls.d.ts +2 -2
- package/lib/cjs/inputs.native.d.ts +0 -1
- package/lib/cjs/inputs.native.d.ts.map +1 -1
- package/lib/cjs/inputs_shared.d.ts +4 -1
- package/lib/cjs/inputs_shared.d.ts.map +1 -1
- package/lib/cjs/inputs_shared.js +7 -1
- package/lib/cjs/inputs_shared.js.map +1 -1
- package/lib/cjs/state.d.ts +36 -0
- package/lib/cjs/state.d.ts.map +1 -1
- package/lib/cjs/state.js +19 -3
- package/lib/cjs/state.js.map +1 -1
- package/lib/esm/CMS/components.d.ts +0 -1
- package/lib/esm/CMS/components.d.ts.map +1 -1
- package/lib/esm/Forms/form_responses.d.ts +0 -1
- package/lib/esm/Forms/form_responses.d.ts.map +1 -1
- package/lib/esm/Forms/forms.d.ts +6 -0
- package/lib/esm/Forms/forms.d.ts.map +1 -1
- package/lib/esm/Forms/forms.js +2 -2
- package/lib/esm/Forms/forms.js.map +1 -1
- package/lib/esm/Forms/hooks.d.ts +0 -1
- package/lib/esm/Forms/hooks.d.ts.map +1 -1
- package/lib/esm/Forms/hooks.js +3 -0
- package/lib/esm/Forms/hooks.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts +1 -1
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +104 -39
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/controls.d.ts +2 -2
- package/lib/esm/inputs.native.d.ts +0 -1
- package/lib/esm/inputs.native.d.ts.map +1 -1
- package/lib/esm/inputs_shared.d.ts +4 -1
- package/lib/esm/inputs_shared.d.ts.map +1 -1
- package/lib/esm/inputs_shared.js +6 -1
- package/lib/esm/inputs_shared.js.map +1 -1
- package/lib/esm/state.d.ts +36 -0
- package/lib/esm/state.d.ts.map +1 -1
- package/lib/esm/state.js +15 -0
- package/lib/esm/state.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/forms.tsx +2 -2
- package/src/Forms/hooks.tsx +3 -0
- package/src/Forms/inputs.tsx +127 -32
- package/src/inputs_shared.tsx +13 -2
- package/src/state.tsx +21 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.155.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.
|
|
51
|
-
"@tellescope/sdk": "^1.
|
|
52
|
-
"@tellescope/types-client": "^1.
|
|
53
|
-
"@tellescope/types-models": "^1.
|
|
54
|
-
"@tellescope/types-utilities": "^1.
|
|
55
|
-
"@tellescope/utilities": "^1.
|
|
56
|
-
"@tellescope/validation": "^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",
|
|
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": "
|
|
83
|
+
"gitHead": "be943fbead3f47347ebff8ddc8f3e21c789490a4",
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
86
86
|
}
|
package/src/Forms/forms.tsx
CHANGED
|
@@ -254,7 +254,7 @@ export const QuestionForField = ({
|
|
|
254
254
|
<Height field={field} disabled={value.disabled} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<any>} form={form} />
|
|
255
255
|
)
|
|
256
256
|
: field.type === 'Redirect' ? (
|
|
257
|
-
<Redirect groupId={groupId} groupInsance={groupInstance} submit={submit} field={field} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<any>} form={form} />
|
|
257
|
+
<Redirect responses={responses} enduser={enduser} groupId={groupId} groupInsance={groupInstance} submit={submit} field={field} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<any>} form={form} />
|
|
258
258
|
)
|
|
259
259
|
: field.type === 'Related Contacts' ? (
|
|
260
260
|
<RelatedContacts field={field} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<any>} form={form} />
|
|
@@ -601,7 +601,7 @@ export const TellescopeSingleQuestionFlow: typeof TellescopeForm = ({
|
|
|
601
601
|
}
|
|
602
602
|
|
|
603
603
|
export const DEFAULT_THANKS_MESSAGE = "Your response was successfully recorded";
|
|
604
|
-
const ThanksMessage = ({
|
|
604
|
+
export const ThanksMessage = ({
|
|
605
605
|
thanksMessage,
|
|
606
606
|
htmlThanksMessage,
|
|
607
607
|
showRestartAtEnd,
|
package/src/Forms/hooks.tsx
CHANGED
|
@@ -99,6 +99,9 @@ export const default_label_for_compound_logic = (f: CompoundFilter<string>): str
|
|
|
99
99
|
const value = f.condition[key]
|
|
100
100
|
if (value && typeof value === 'object') {
|
|
101
101
|
const objectKey = Object.keys(value)[0]
|
|
102
|
+
if (objectKey === '$ne') {
|
|
103
|
+
return `${key} Does Not Equal ${value[objectKey as keyof typeof value]}`
|
|
104
|
+
}
|
|
102
105
|
if (objectKey === '$gt') {
|
|
103
106
|
return `${key} Greater Than ${value[objectKey as keyof typeof value]}`
|
|
104
107
|
}
|
package/src/Forms/inputs.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react"
|
|
2
2
|
import axios from "axios"
|
|
3
|
-
import { Autocomplete, Box, Button, Checkbox, Divider, FormControl, FormControlLabel, FormLabel, Grid, InputLabel, MenuItem, Radio, RadioGroup, Select, SxProps, TextField, TextFieldProps, Typography } from "@mui/material"
|
|
3
|
+
import { Autocomplete, Box, Button, Checkbox, Chip, Divider, FormControl, FormControlLabel, FormLabel, Grid, InputLabel, MenuItem, Radio, RadioGroup, Select, SxProps, TextField, TextFieldProps, Typography } from "@mui/material"
|
|
4
4
|
import { FormInputProps } from "./types"
|
|
5
5
|
import { useDropzone } from "react-dropzone"
|
|
6
6
|
import { CANVAS_TITLE, EMOTII_TITLE, INSURANCE_RELATIONSHIPS, INSURANCE_RELATIONSHIPS_CANVAS, PRIMARY_HEX, RELATIONSHIP_TYPES, TELLESCOPE_GENDERS } from "@tellescope/constants"
|
|
@@ -1447,6 +1447,7 @@ export const StripeInput = ({ field, value, onChange, setCustomerId }: FormInput
|
|
|
1447
1447
|
const [isCheckout, setIsCheckout] = useState(false)
|
|
1448
1448
|
const [stripePromise, setStripePromise] = useState<ReturnType<typeof loadStripe>>()
|
|
1449
1449
|
const [, { findById: findProduct }] = useProducts({ dontFetch: true })
|
|
1450
|
+
const [answertext, setAnswertext] = useState('')
|
|
1450
1451
|
|
|
1451
1452
|
const fetchRef = useRef(false)
|
|
1452
1453
|
useEffect(() => {
|
|
@@ -1457,12 +1458,13 @@ export const StripeInput = ({ field, value, onChange, setCustomerId }: FormInput
|
|
|
1457
1458
|
fetchRef.current = true
|
|
1458
1459
|
|
|
1459
1460
|
session.api.form_responses.stripe_details({ fieldId: field.id })
|
|
1460
|
-
.then(({ clientSecret, publishableKey, stripeAccount, businessName, customerId, isCheckout }) => {
|
|
1461
|
+
.then(({ clientSecret, publishableKey, stripeAccount, businessName, customerId, isCheckout, answerText }) => {
|
|
1461
1462
|
setIsCheckout(!!isCheckout)
|
|
1462
1463
|
setClientSecret(clientSecret)
|
|
1463
1464
|
setStripePromise(loadStripe(publishableKey, { stripeAccount }))
|
|
1464
1465
|
setBusinessName(businessName)
|
|
1465
1466
|
setCustomerId(customerId)
|
|
1467
|
+
setAnswertext(answerText || '')
|
|
1466
1468
|
})
|
|
1467
1469
|
.catch(console.error)
|
|
1468
1470
|
}, [session, value, field.id])
|
|
@@ -1488,7 +1490,7 @@ export const StripeInput = ({ field, value, onChange, setCustomerId }: FormInput
|
|
|
1488
1490
|
<EmbeddedCheckoutProvider stripe={stripePromise}
|
|
1489
1491
|
options={{
|
|
1490
1492
|
clientSecret,
|
|
1491
|
-
onComplete: () => onChange('Completed checkout', field.id),
|
|
1493
|
+
onComplete: () => onChange(answertext || 'Completed checkout', field.id),
|
|
1492
1494
|
}}
|
|
1493
1495
|
>
|
|
1494
1496
|
<EmbeddedCheckout />
|
|
@@ -1498,7 +1500,7 @@ export const StripeInput = ({ field, value, onChange, setCustomerId }: FormInput
|
|
|
1498
1500
|
<Elements stripe={stripePromise} options={{
|
|
1499
1501
|
clientSecret,
|
|
1500
1502
|
}}>
|
|
1501
|
-
<StripeForm businessName={businessName} onSuccess={() => onChange('Saved card details', field.id)}
|
|
1503
|
+
<StripeForm businessName={businessName} onSuccess={() => onChange(answertext || 'Saved card details', field.id)}
|
|
1502
1504
|
cost={cost}
|
|
1503
1505
|
field={field}
|
|
1504
1506
|
/>
|
|
@@ -1841,6 +1843,7 @@ export const DatabaseSelectInput = ({ field, value: _value, onChange, onDatabase
|
|
|
1841
1843
|
if (!doneLoading) return <LinearProgress />
|
|
1842
1844
|
return (
|
|
1843
1845
|
<Autocomplete id={field.id} freeSolo={false}
|
|
1846
|
+
componentsProps={{ popper: { sx: { wordBreak: "break-word" } } } }
|
|
1844
1847
|
options={filteredChoices} multiple={true}
|
|
1845
1848
|
getOptionLabel={o => (
|
|
1846
1849
|
Array.isArray(o) // edge case
|
|
@@ -1872,6 +1875,16 @@ export const DatabaseSelectInput = ({ field, value: _value, onChange, onDatabase
|
|
|
1872
1875
|
inputValue={typing}
|
|
1873
1876
|
onInputChange={(e, v) => e && setTyping(v)}
|
|
1874
1877
|
renderInput={params => <TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }} />}
|
|
1878
|
+
// use custom Chip to ensure very long entries break properly (whitespace: normal)
|
|
1879
|
+
renderTags={(value, getTagProps) =>
|
|
1880
|
+
value.map((value, index) => (
|
|
1881
|
+
<Chip
|
|
1882
|
+
label={<Typography style={{whiteSpace: 'normal'}}>{Array.isArray(value) ? '' : label_for_database_record(field, value)}</Typography>}
|
|
1883
|
+
{...getTagProps({ index })}
|
|
1884
|
+
sx={{height:"100%", py: 0.5 }}
|
|
1885
|
+
/>
|
|
1886
|
+
))
|
|
1887
|
+
}
|
|
1875
1888
|
/>
|
|
1876
1889
|
)
|
|
1877
1890
|
}
|
|
@@ -2722,7 +2735,7 @@ export const HeightInput = ({ field, value={} as any, onChange, ...props }: Form
|
|
|
2722
2735
|
</Grid>
|
|
2723
2736
|
)
|
|
2724
2737
|
|
|
2725
|
-
export const RedirectInput = ({ groupId, groupInsance, formResponseId, field, submit, value={} as any, onChange, ...props }: FormInputProps<'Redirect'>) => {
|
|
2738
|
+
export const RedirectInput = ({ groupId, groupInsance, formResponseId, field, submit, value={} as any, onChange, responses, enduser, ...props }: FormInputProps<'Redirect'>) => {
|
|
2726
2739
|
const session = useResolvedSession()
|
|
2727
2740
|
|
|
2728
2741
|
let eId = ''
|
|
@@ -2730,6 +2743,33 @@ export const RedirectInput = ({ groupId, groupInsance, formResponseId, field, su
|
|
|
2730
2743
|
eId = new URL(window.location.href).searchParams.get('eId') || ''
|
|
2731
2744
|
} catch(err) {}
|
|
2732
2745
|
|
|
2746
|
+
const email = (
|
|
2747
|
+
responses?.find(r => r.intakeField === 'email')?.answer?.value
|
|
2748
|
+
|| enduser?.email
|
|
2749
|
+
|| session.userInfo.email
|
|
2750
|
+
)
|
|
2751
|
+
const phone = (
|
|
2752
|
+
responses?.find(r => r.intakeField === 'phone')?.answer?.value
|
|
2753
|
+
|| enduser?.phone
|
|
2754
|
+
|| session.userInfo.phone
|
|
2755
|
+
)
|
|
2756
|
+
const fname = (
|
|
2757
|
+
responses?.find(r => r.intakeField === 'fname')?.answer?.value
|
|
2758
|
+
|| enduser?.fname
|
|
2759
|
+
|| session.userInfo?.fname
|
|
2760
|
+
)
|
|
2761
|
+
const lname = (
|
|
2762
|
+
responses?.find(r => r.intakeField === 'lname')?.answer?.value
|
|
2763
|
+
|| enduser?.lname
|
|
2764
|
+
|| session.userInfo?.lname
|
|
2765
|
+
)
|
|
2766
|
+
const state = (
|
|
2767
|
+
responses?.find(r => r.intakeField === 'state')?.answer?.value
|
|
2768
|
+
|| (responses?.find(r => r.intakeField === 'Address')?.answer?.value as any)?.state
|
|
2769
|
+
|| enduser?.state
|
|
2770
|
+
|| (session.userInfo as Enduser)?.state
|
|
2771
|
+
)
|
|
2772
|
+
|
|
2733
2773
|
useEffect(() => {
|
|
2734
2774
|
if (session.type === 'user') { return }
|
|
2735
2775
|
|
|
@@ -2738,7 +2778,15 @@ export const RedirectInput = ({ groupId, groupInsance, formResponseId, field, su
|
|
|
2738
2778
|
.finally(() => {
|
|
2739
2779
|
if (!field.options?.redirectExternalUrl) { return }
|
|
2740
2780
|
|
|
2741
|
-
window.location.href =
|
|
2781
|
+
window.location.href = (
|
|
2782
|
+
replace_enduser_template_values(
|
|
2783
|
+
field.options.redirectExternalUrl,
|
|
2784
|
+
{
|
|
2785
|
+
...session.userInfo as any,
|
|
2786
|
+
email, fname, lname, state, phone,
|
|
2787
|
+
}
|
|
2788
|
+
)
|
|
2789
|
+
)
|
|
2742
2790
|
})
|
|
2743
2791
|
.catch(console.error)
|
|
2744
2792
|
|
|
@@ -2772,7 +2820,7 @@ export const RedirectInput = ({ groupId, groupInsance, formResponseId, field, su
|
|
|
2772
2820
|
})
|
|
2773
2821
|
))
|
|
2774
2822
|
.catch(console.error)
|
|
2775
|
-
}, [session])
|
|
2823
|
+
}, [session, email, fname, lname, state, phone])
|
|
2776
2824
|
|
|
2777
2825
|
if (session.type === 'user') {
|
|
2778
2826
|
return (
|
|
@@ -2861,6 +2909,12 @@ export const AllergiesInput = ({ goToNextField, goToPreviousField, field, value,
|
|
|
2861
2909
|
const [query, setQuery] = useState('')
|
|
2862
2910
|
const [results, setResults] = useState<{ code: string, display: string }[]>([])
|
|
2863
2911
|
|
|
2912
|
+
// if two allergy questions shown in a row, reset state
|
|
2913
|
+
useEffect(() => {
|
|
2914
|
+
setQuery('')
|
|
2915
|
+
setResults([])
|
|
2916
|
+
}, [field.id])
|
|
2917
|
+
|
|
2864
2918
|
const fetchRef = useRef(query)
|
|
2865
2919
|
useEffect(() => {
|
|
2866
2920
|
if (fetchRef.current === query) return
|
|
@@ -2869,36 +2923,55 @@ export const AllergiesInput = ({ goToNextField, goToPreviousField, field, value,
|
|
|
2869
2923
|
if (!query) return
|
|
2870
2924
|
|
|
2871
2925
|
const t = setTimeout(() => {
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2926
|
+
if (field.options?.dataSource === CANVAS_TITLE) {
|
|
2927
|
+
session.api.integrations
|
|
2928
|
+
.proxy_read({
|
|
2929
|
+
integration: CANVAS_TITLE,
|
|
2930
|
+
type: 'allergies',
|
|
2931
|
+
query,
|
|
2932
|
+
})
|
|
2933
|
+
.then((r : { data: AllergyResult }) => {
|
|
2934
|
+
const deduped: typeof results = []
|
|
2935
|
+
const totalResults = (
|
|
2936
|
+
(r.data.entry || [])
|
|
2937
|
+
.flatMap(v => v?.resource?.code?.coding || [])
|
|
2938
|
+
.filter(v => v.system.includes('fdbhealth'))
|
|
2939
|
+
.map(v => ({ code: v.code, display: v.display, system: v.system }))
|
|
2940
|
+
)
|
|
2941
|
+
for (const v of totalResults) {
|
|
2942
|
+
if (deduped.find(d => d.display === v.display)) { continue }
|
|
2888
2943
|
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2944
|
+
deduped.push(v)
|
|
2945
|
+
}
|
|
2946
|
+
setResults(deduped)
|
|
2947
|
+
})
|
|
2948
|
+
} else {
|
|
2949
|
+
session.api.allergy_codes.getSome({ search: { query }})
|
|
2950
|
+
.then(results => {
|
|
2951
|
+
const deduped: typeof results = []
|
|
2952
|
+
for (const v of results) {
|
|
2953
|
+
if (deduped.find(d => d.display === v.display)) { continue }
|
|
2954
|
+
|
|
2955
|
+
deduped.push(v)
|
|
2956
|
+
}
|
|
2957
|
+
setResults(deduped)
|
|
2958
|
+
})
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
|
|
2893
2962
|
}, 200)
|
|
2894
2963
|
|
|
2895
2964
|
return () => { clearTimeout(t) }
|
|
2896
|
-
}, [session, query])
|
|
2965
|
+
}, [session, query, field?.options?.dataSource])
|
|
2897
2966
|
|
|
2898
2967
|
return (
|
|
2899
|
-
<Autocomplete multiple value={value || []} options={
|
|
2968
|
+
<Autocomplete multiple value={value || []} options={results} style={{ marginTop: 5 }}
|
|
2900
2969
|
noOptionsText={query.length ? 'No results found' : 'Type to start search'}
|
|
2901
|
-
onChange={(e, v) =>
|
|
2970
|
+
onChange={(e, v) => {
|
|
2971
|
+
if (!v) { return }
|
|
2972
|
+
onChange(v, field.id)
|
|
2973
|
+
setResults([])
|
|
2974
|
+
}}
|
|
2902
2975
|
getOptionLabel={v => first_letter_capitalized(v.display)} filterOptions={o => o}
|
|
2903
2976
|
inputValue={query} onInputChange={(e, v) => e && setQuery(v) }
|
|
2904
2977
|
renderInput={(params) => (
|
|
@@ -2906,6 +2979,15 @@ export const AllergiesInput = ({ goToNextField, goToPreviousField, field, value,
|
|
|
2906
2979
|
required={!field.isOptional} size="small" label="" placeholder="Search allergies..."
|
|
2907
2980
|
/>
|
|
2908
2981
|
)}
|
|
2982
|
+
renderTags={(value, getTagProps) =>
|
|
2983
|
+
value.map((value, index) => (
|
|
2984
|
+
<Chip
|
|
2985
|
+
label={<Typography style={{whiteSpace: 'normal'}}>{value.display}</Typography>}
|
|
2986
|
+
{...getTagProps({ index })}
|
|
2987
|
+
sx={{height:"100%", py: 0.5 }}
|
|
2988
|
+
/>
|
|
2989
|
+
))
|
|
2990
|
+
}
|
|
2909
2991
|
/>
|
|
2910
2992
|
)
|
|
2911
2993
|
}
|
|
@@ -2939,9 +3021,13 @@ export const ConditionsInput = ({ goToNextField, goToPreviousField, field, value
|
|
|
2939
3021
|
}, [session, query])
|
|
2940
3022
|
|
|
2941
3023
|
return (
|
|
2942
|
-
<Autocomplete multiple value={value || []} options={
|
|
3024
|
+
<Autocomplete multiple value={value || []} options={results} style={{ marginTop: 5 }}
|
|
2943
3025
|
noOptionsText={query.length ? 'No results found' : 'Type to start search'}
|
|
2944
|
-
onChange={(e, v) =>
|
|
3026
|
+
onChange={(e, v) => {
|
|
3027
|
+
if (!v) { return }
|
|
3028
|
+
onChange(v, field.id)
|
|
3029
|
+
setResults([])
|
|
3030
|
+
}}
|
|
2945
3031
|
getOptionLabel={v => first_letter_capitalized(v.display)} filterOptions={o => o}
|
|
2946
3032
|
inputValue={query} onInputChange={(e, v) => e && setQuery(v) }
|
|
2947
3033
|
renderInput={(params) => (
|
|
@@ -2949,6 +3035,15 @@ export const ConditionsInput = ({ goToNextField, goToPreviousField, field, value
|
|
|
2949
3035
|
required={!field.isOptional} size="small" label="" placeholder="Search conditions..."
|
|
2950
3036
|
/>
|
|
2951
3037
|
)}
|
|
3038
|
+
renderTags={(value, getTagProps) =>
|
|
3039
|
+
value.map((value, index) => (
|
|
3040
|
+
<Chip
|
|
3041
|
+
label={<Typography style={{whiteSpace: 'normal'}}>{value.display}</Typography>}
|
|
3042
|
+
{...getTagProps({ index })}
|
|
3043
|
+
sx={{height:"100%", py: 0.5 }}
|
|
3044
|
+
/>
|
|
3045
|
+
))
|
|
3046
|
+
}
|
|
2952
3047
|
/>
|
|
2953
3048
|
)
|
|
2954
3049
|
}
|
package/src/inputs_shared.tsx
CHANGED
|
@@ -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, DiagnosisCode, 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, useDiagnosisCodes, 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 "."
|
|
8
|
+
import { 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 } from "@tellescope/types-client"
|
|
9
|
+
import { Button, Checkbox, Flex, HoverPaper, LoadingButton, LoadingData, LoadingLinear, ScrollingList, SearchTextInput, Typography, 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, value_is_loaded } from "."
|
|
10
10
|
import { SxProps } from "@mui/material"
|
|
11
11
|
import { AccessPermissions } from "@tellescope/types-models"
|
|
12
12
|
|
|
@@ -618,6 +618,17 @@ export const SuggestedContactSearch = (props: Omit<GenericSearchProps<SuggestedC
|
|
|
618
618
|
)
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
+
export const AllergyCodeSearch = (props: Omit<GenericSearchProps<AllergyCode>, 'filterKey'> & { filterKey?: string }) => {
|
|
622
|
+
const session = useSession()
|
|
623
|
+
const [, { addLocalElements }] = useAllergyCodes({ dontFetch: true })
|
|
624
|
+
return (
|
|
625
|
+
<ModelSearchInput filterKey="allergy-code" {...props}
|
|
626
|
+
searchAPI={session.api.allergy_codes.getSome}
|
|
627
|
+
onLoad={addLocalElements}
|
|
628
|
+
/>
|
|
629
|
+
)
|
|
630
|
+
}
|
|
631
|
+
|
|
621
632
|
export const DiagnosisCodeSearch = (props: Omit<GenericSearchProps<DiagnosisCode>, 'filterKey'> & { filterKey?: string }) => {
|
|
622
633
|
const session = useSession()
|
|
623
634
|
const [, { addLocalElements }] = useDiagnosisCodes({ dontFetch: true })
|
package/src/state.tsx
CHANGED
|
@@ -94,6 +94,7 @@ import {
|
|
|
94
94
|
CallHoldQueue,
|
|
95
95
|
SuggestedContact,
|
|
96
96
|
DiagnosisCode,
|
|
97
|
+
AllergyCode,
|
|
97
98
|
} from "@tellescope/types-client"
|
|
98
99
|
|
|
99
100
|
import {
|
|
@@ -355,6 +356,7 @@ const messageTemplateSnippetsSlice = createSliceForList<MessageTemplateSnippet,
|
|
|
355
356
|
const faxLogsSlice = createSliceForList<FaxLog, 'fax_logs'>('fax_logs')
|
|
356
357
|
const suggestedContactsSlice = createSliceForList<SuggestedContact, 'suggested_contacts'>('suggested_contacts')
|
|
357
358
|
const diagnosisCodesSlice = createSliceForList<DiagnosisCode, 'diagnosis_codes'>('diagnosis_codes')
|
|
359
|
+
const allergyCodesSlice = createSliceForList<AllergyCode, 'allergy_codes'>('allergy_codes')
|
|
358
360
|
|
|
359
361
|
const roleBasedAccessPermissionsSlice = createSliceForList<RoleBasedAccessPermission, 'role_based_access_permissions'>('role_based_access_permissions')
|
|
360
362
|
|
|
@@ -443,6 +445,7 @@ export const sharedConfig = {
|
|
|
443
445
|
call_hold_queues: callHoldQueuesSlice.reducer,
|
|
444
446
|
suggested_contacts: suggestedContactsSlice.reducer,
|
|
445
447
|
diagnosis_codes: diagnosisCodesSlice.reducer,
|
|
448
|
+
allergy_codes: allergyCodesSlice.reducer,
|
|
446
449
|
},
|
|
447
450
|
}
|
|
448
451
|
|
|
@@ -1259,6 +1262,24 @@ export const usePortalBrandings = (options={} as HookOptions<PortalBranding>) =>
|
|
|
1259
1262
|
},
|
|
1260
1263
|
)
|
|
1261
1264
|
}
|
|
1265
|
+
export const useAllergyCodes = (options={} as HookOptions<AllergyCode>) => {
|
|
1266
|
+
const session = useResolvedSession()
|
|
1267
|
+
|
|
1268
|
+
return useListStateHook('allergy_codes', useTypedSelector(s => s.allergy_codes), session, allergyCodesSlice,
|
|
1269
|
+
{
|
|
1270
|
+
loadQuery: session.api.allergy_codes.getSome,
|
|
1271
|
+
findOne: session.api.allergy_codes.getOne,
|
|
1272
|
+
findByIds: session.api.allergy_codes.getByIds,
|
|
1273
|
+
addOne: session.api.allergy_codes.createOne,
|
|
1274
|
+
addSome: session.api.allergy_codes.createSome,
|
|
1275
|
+
deleteOne: session.api.allergy_codes.deleteOne,
|
|
1276
|
+
updateOne: session.api.allergy_codes.updateOne,
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
...options,
|
|
1280
|
+
},
|
|
1281
|
+
)
|
|
1282
|
+
}
|
|
1262
1283
|
export const useDiagnosisCodes = (options={} as HookOptions<DiagnosisCode>) => {
|
|
1263
1284
|
const session = useResolvedSession()
|
|
1264
1285
|
|