@tellescope/react-components 1.181.1 → 1.183.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/Forms/hooks.d.ts.map +1 -1
- package/lib/cjs/Forms/hooks.js +2 -2
- package/lib/cjs/Forms/hooks.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +15 -12
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/forms.d.ts +2 -1
- package/lib/cjs/forms.d.ts.map +1 -1
- package/lib/cjs/forms.js +2 -2
- package/lib/cjs/forms.js.map +1 -1
- package/lib/cjs/inputs_shared.d.ts.map +1 -1
- package/lib/cjs/inputs_shared.js +8 -1
- package/lib/cjs/inputs_shared.js.map +1 -1
- package/lib/esm/Forms/hooks.d.ts.map +1 -1
- package/lib/esm/Forms/hooks.js +2 -2
- package/lib/esm/Forms/hooks.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +15 -12
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/Forms/utilities.d.ts +1 -0
- package/lib/esm/Forms/utilities.d.ts.map +1 -0
- package/lib/esm/Forms/utilities.js +2 -0
- package/lib/esm/Forms/utilities.js.map +1 -0
- package/lib/esm/forms.d.ts +2 -1
- package/lib/esm/forms.d.ts.map +1 -1
- package/lib/esm/forms.js +2 -2
- package/lib/esm/forms.js.map +1 -1
- package/lib/esm/inputs_shared.d.ts.map +1 -1
- package/lib/esm/inputs_shared.js +9 -2
- package/lib/esm/inputs_shared.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/hooks.tsx +2 -2
- package/src/Forms/inputs.tsx +10 -3
- package/src/forms.tsx +3 -2
- package/src/inputs_shared.tsx +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.183.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.183.0",
|
|
51
|
+
"@tellescope/sdk": "^1.183.0",
|
|
52
|
+
"@tellescope/types-client": "^1.183.0",
|
|
53
|
+
"@tellescope/types-models": "^1.183.0",
|
|
54
|
+
"@tellescope/types-utilities": "^1.183.0",
|
|
55
|
+
"@tellescope/utilities": "^1.183.0",
|
|
56
|
+
"@tellescope/validation": "^1.183.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",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
85
85
|
"react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "1b65f936169b011cfd20179c25625af7a6f34cba",
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
}
|
package/src/Forms/hooks.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { ChangeHandler, FormFieldNode } from "./types"
|
|
|
4
4
|
import { DatabaseRecord, Enduser, Form, FormField, FormResponse } from "@tellescope/types-client"
|
|
5
5
|
import { phoneValidator } from "@tellescope/validation"
|
|
6
6
|
import { FileBlob, Indexable } from "@tellescope/types-utilities"
|
|
7
|
-
import { CompoundFilter, FormCustomization, FormResponseAnswerAddress, FormResponseAnswerFileValue,
|
|
7
|
+
import { CompoundFilter, EnduserRelationship, FormCustomization, FormResponseAnswerAddress, FormResponseAnswerFileValue, FormResponseValue, FormResponseValueAnswer, OrganizationTheme, PreviousFormCompoundLogic, PreviousFormFieldType } from "@tellescope/types-models"
|
|
8
8
|
import { WithTheme, contact_is_valid, useFileUpload, useFormFields, useFormResponses, useResolvedSession, value_is_loaded } from "../index"
|
|
9
9
|
import ReactGA from "react-ga4";
|
|
10
10
|
|
|
@@ -637,7 +637,7 @@ export const useTellescopeForm = ({ isPublicForm, form, urlLogicValue, customiza
|
|
|
637
637
|
: (f.options?.from || 1)
|
|
638
638
|
)
|
|
639
639
|
: f.type === 'Related Contacts'
|
|
640
|
-
? (f.isOptional ? [] : [{}])
|
|
640
|
+
? (f.isOptional ? [] : [{ relationships: f?.options?.relatedContactTypes?.length === 1 ? [{ type: f.options.relatedContactTypes[0] as EnduserRelationship['type'], id: ''! } ] : [] }])
|
|
641
641
|
: '' as any // null flag that the response was not filled out
|
|
642
642
|
)
|
|
643
643
|
),
|
package/src/Forms/inputs.tsx
CHANGED
|
@@ -873,6 +873,7 @@ const StringSelector = ({ options, value, onChange, required, getDisplayValue, .
|
|
|
873
873
|
size?: "small",
|
|
874
874
|
required?: boolean,
|
|
875
875
|
getDisplayValue?: (v: string) => string,
|
|
876
|
+
disabled?: boolean,
|
|
876
877
|
}) => (
|
|
877
878
|
<FormControl fullWidth size={props.size} required={required}>
|
|
878
879
|
<InputLabel>{props.label}</InputLabel>
|
|
@@ -2576,9 +2577,14 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, ...props
|
|
|
2576
2577
|
const [editing, setEditing] = useState(value.length === 1 ? 0 : -1)
|
|
2577
2578
|
|
|
2578
2579
|
const handleAddContact = useCallback(() => {
|
|
2579
|
-
onChange([
|
|
2580
|
+
onChange([
|
|
2581
|
+
...value,
|
|
2582
|
+
{ relationships: field?.options?.relatedContactTypes?.length === 1 ? [{ type: field.options.relatedContactTypes[0] as EnduserRelationship['type'], id: ''! } ] : [] }],
|
|
2583
|
+
field.id,
|
|
2584
|
+
true
|
|
2585
|
+
)
|
|
2580
2586
|
setEditing(value.length)
|
|
2581
|
-
}, [onChange, value, field?.id])
|
|
2587
|
+
}, [onChange, value, field?.id, field?.options?.relatedContactTypes])
|
|
2582
2588
|
|
|
2583
2589
|
if (value[editing]) {
|
|
2584
2590
|
const { fname, lname, email, phone, fields={}, dateOfBirth='', relationships } = value[editing]
|
|
@@ -2607,7 +2613,8 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, ...props
|
|
|
2607
2613
|
}
|
|
2608
2614
|
|
|
2609
2615
|
<Grid item xs={4}>
|
|
2610
|
-
<StringSelector options={RELATIONSHIP_TYPES} label="Relationship" size="small"
|
|
2616
|
+
<StringSelector options={field.options?.relatedContactTypes?.length ? field.options.relatedContactTypes : RELATIONSHIP_TYPES} label="Relationship" size="small"
|
|
2617
|
+
disabled={field?.options?.relatedContactTypes?.length === 1}
|
|
2611
2618
|
value={relationships?.[0]?.type ?? ''}
|
|
2612
2619
|
onChange={type => onChange(value.map((v, i) => i === editing ? { ...v, relationships: [{ type: type as EnduserRelationship['type'], id: '' /* to be filled on server-side */ }] } : v), field.id)}
|
|
2613
2620
|
/>
|
package/src/forms.tsx
CHANGED
|
@@ -226,14 +226,15 @@ interface LoadingButtonProps extends SubmitButtonOptions {
|
|
|
226
226
|
uniquenessError?: string,
|
|
227
227
|
onError?: OnApiError,
|
|
228
228
|
onClick?: ((...args: any[]) => void) | (() => Promise<any>),
|
|
229
|
+
muiColor?: string,
|
|
229
230
|
}
|
|
230
|
-
export const LoadingButton = ({ disabled, uniquenessError, throwOnError, variant="contained", onError, submitting, onClick, submitText="Submit", submittingText="Submitting", type, style={ marginTop: 5, width: '100%' } }: LoadingButtonProps & Styled & { type?: 'submit'}) => {
|
|
231
|
+
export const LoadingButton = ({ muiColor, disabled, uniquenessError, throwOnError, variant="contained", onError, submitting, onClick, submitText="Submit", submittingText="Submitting", type, style={ marginTop: 5, width: '100%' } }: LoadingButtonProps & Styled & { type?: 'submit'}) => {
|
|
231
232
|
const { errorDisplay, handleAPIError, loading } = useHandleError({ onError, uniquenessError })
|
|
232
233
|
const formLoading = React.useContext(WithHTMLFormContext)?.loading
|
|
233
234
|
|
|
234
235
|
return (
|
|
235
236
|
<>
|
|
236
|
-
<Button color="primary" variant={variant} type={type} onClick={() => handleAPIError(async () => {
|
|
237
|
+
<Button color={muiColor as any || "primary"} variant={variant} type={type} onClick={() => handleAPIError(async () => {
|
|
237
238
|
if (!onClick) return
|
|
238
239
|
await onClick()
|
|
239
240
|
})}
|
package/src/inputs_shared.tsx
CHANGED
|
@@ -394,8 +394,14 @@ export const ModelSearchInput = <T,>({
|
|
|
394
394
|
|
|
395
395
|
...props
|
|
396
396
|
} : ModelSearchProps<T>) => {
|
|
397
|
+
let dontPersist = false
|
|
398
|
+
try { // may fail to load if enduser session
|
|
399
|
+
const [organizationLoading] = useOrganization()
|
|
400
|
+
dontPersist = !!(value_is_loaded(organizationLoading) ? organizationLoading.value?.settings?.interface?.dontPersistSearches : undefined )
|
|
401
|
+
} catch(err) {}
|
|
402
|
+
|
|
397
403
|
const cacheKey = `search-cache-${filterKey}`
|
|
398
|
-
const [_query, _setQuery] = useState(read_local_storage(cacheKey) || '')
|
|
404
|
+
const [_query, _setQuery] = useState(dontPersist ? '' : (read_local_storage(cacheKey) || ''))
|
|
399
405
|
|
|
400
406
|
const query = value ?? _query
|
|
401
407
|
const setQuery = onChange ?? _setQuery
|