@tellescope/react-components 1.181.1 → 1.182.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/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/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/hooks.tsx +2 -2
- package/src/Forms/inputs.tsx +10 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.182.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.182.0",
|
|
51
|
+
"@tellescope/sdk": "^1.182.0",
|
|
52
|
+
"@tellescope/types-client": "^1.182.0",
|
|
53
|
+
"@tellescope/types-models": "^1.182.0",
|
|
54
|
+
"@tellescope/types-utilities": "^1.182.0",
|
|
55
|
+
"@tellescope/utilities": "^1.182.0",
|
|
56
|
+
"@tellescope/validation": "^1.182.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": "76fbac14a3c471a878c803d7be06c3179e62b385",
|
|
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
|
/>
|