@tellescope/react-components 1.232.1 → 1.233.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/lib/cjs/Forms/forms.js +1 -1
- package/lib/cjs/Forms/forms.js.map +1 -1
- package/lib/cjs/Forms/forms.v2.js +1 -1
- package/lib/cjs/Forms/forms.v2.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +19 -11
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/Forms/inputs.v2.d.ts +1 -2
- package/lib/cjs/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.v2.js +4 -96
- package/lib/cjs/Forms/inputs.v2.js.map +1 -1
- package/lib/esm/CMS/components.d.ts +1 -0
- package/lib/esm/CMS/components.d.ts.map +1 -1
- package/lib/esm/Forms/form_responses.d.ts +1 -0
- package/lib/esm/Forms/form_responses.d.ts.map +1 -1
- package/lib/esm/Forms/forms.d.ts +3 -3
- package/lib/esm/Forms/forms.js +1 -1
- package/lib/esm/Forms/forms.js.map +1 -1
- package/lib/esm/Forms/forms.v2.d.ts +3 -3
- package/lib/esm/Forms/forms.v2.js +1 -1
- package/lib/esm/Forms/forms.v2.js.map +1 -1
- package/lib/esm/Forms/hooks.d.ts +1 -0
- package/lib/esm/Forms/hooks.d.ts.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 +19 -11
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/Forms/inputs.v2.d.ts +2 -3
- package/lib/esm/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.v2.js +3 -94
- package/lib/esm/Forms/inputs.v2.js.map +1 -1
- package/lib/esm/controls.d.ts +2 -2
- package/lib/esm/inputs.d.ts +1 -1
- package/lib/esm/inputs.native.d.ts +1 -0
- package/lib/esm/inputs.native.d.ts.map +1 -1
- package/lib/esm/state.d.ts +315 -315
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/src/Forms/forms.tsx +2 -2
- package/src/Forms/forms.v2.tsx +1 -1
- package/src/Forms/inputs.tsx +15 -7
- package/src/Forms/inputs.v2.tsx +4 -118
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.233.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/tellescope-os/enduser-authentication#readme",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@babel/core": "
|
|
32
|
+
"@babel/core": "7.28.5",
|
|
33
33
|
"@types/css-to-react-native": "^3.0.0",
|
|
34
34
|
"@types/react": "^17.0.27",
|
|
35
35
|
"@types/react-beautiful-dnd": "^13.1.2",
|
|
36
36
|
"@types/react-dom": "^17.0.9",
|
|
37
37
|
"@types/react-native": "^0.65.24",
|
|
38
38
|
"@types/react-window": "^1.8.5",
|
|
39
|
-
"babel-loader": "
|
|
39
|
+
"babel-loader": "8.4.1",
|
|
40
40
|
"react-native": "0.68.0",
|
|
41
41
|
"typescript": "4.9.3"
|
|
42
42
|
},
|
|
@@ -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.233.1",
|
|
51
|
+
"@tellescope/sdk": "1.233.1",
|
|
52
|
+
"@tellescope/types-client": "1.233.1",
|
|
53
|
+
"@tellescope/types-models": "1.233.1",
|
|
54
|
+
"@tellescope/types-utilities": "1.233.1",
|
|
55
|
+
"@tellescope/utilities": "1.233.1",
|
|
56
|
+
"@tellescope/validation": "1.233.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",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
84
84
|
"react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "455d8a11af50f3d67892e2eb90fb1d29162e2fea",
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
}
|
package/src/Forms/forms.tsx
CHANGED
|
@@ -44,8 +44,8 @@ const TellescopeFormContainerWithTheme: typeof TellescopeFormContainer = ({ pape
|
|
|
44
44
|
? null
|
|
45
45
|
: theme.logoURL
|
|
46
46
|
? (
|
|
47
|
-
<Flex alignItems="center" justifyContent={"center"} style={{
|
|
48
|
-
<img src={theme.logoURL} alt={theme.name} style={{
|
|
47
|
+
<Flex alignItems="center" justifyContent={"center"} style={{ height: logoHeight || LOGO_HEIGHT, marginTop: 10 }}>
|
|
48
|
+
<img src={theme.logoURL} alt={theme.name} style={{ height: logoHeight || LOGO_HEIGHT, maxWidth: 225 }} /> {/* todo: replace with something that resolves better for native */}
|
|
49
49
|
</Flex>
|
|
50
50
|
)
|
|
51
51
|
: (
|
package/src/Forms/forms.v2.tsx
CHANGED
|
@@ -621,7 +621,7 @@ export const TellescopeSingleQuestionFlowV2: typeof TellescopeFormV2 = ({
|
|
|
621
621
|
theme?.logoURL
|
|
622
622
|
? (
|
|
623
623
|
<Flex alignItems="flex-start" style={{ marginBottom: '20px' }}>
|
|
624
|
-
<img src={theme.logoURL} alt={theme.name} style={{
|
|
624
|
+
<img src={theme.logoURL} alt={theme.name} style={{ height: customization?.logoHeight || LOGO_HEIGHT, maxWidth: 225 }} />
|
|
625
625
|
</Flex>
|
|
626
626
|
)
|
|
627
627
|
: (
|
package/src/Forms/inputs.tsx
CHANGED
|
@@ -3771,29 +3771,37 @@ export const RedirectInput = ({ enduserId, groupId, groupInsance, rootResponseId
|
|
|
3771
3771
|
eId = new URL(window.location.href).searchParams.get('eId') || enduserId || enduser?.id || ''
|
|
3772
3772
|
} catch(err) {}
|
|
3773
3773
|
|
|
3774
|
+
// Helper function to find the first answered intake field response
|
|
3775
|
+
// This handles cases where duplicate intake fields exist across conditional branches
|
|
3776
|
+
const findAnsweredIntakeField = (intakeField: string) => {
|
|
3777
|
+
return responses?.find(r => r.intakeField === intakeField && r.answer?.value)?.answer?.value
|
|
3778
|
+
}
|
|
3779
|
+
|
|
3774
3780
|
const email = (
|
|
3775
|
-
|
|
3776
|
-
|| enduser?.email
|
|
3781
|
+
findAnsweredIntakeField('email')
|
|
3782
|
+
|| enduser?.email
|
|
3777
3783
|
|| session.userInfo.email
|
|
3778
3784
|
)
|
|
3779
3785
|
const phone = (
|
|
3780
|
-
|
|
3786
|
+
findAnsweredIntakeField('phone')
|
|
3781
3787
|
|| enduser?.phone
|
|
3782
3788
|
|| session.userInfo.phone
|
|
3783
3789
|
)
|
|
3784
3790
|
const fname = (
|
|
3785
|
-
|
|
3791
|
+
findAnsweredIntakeField('fname')
|
|
3786
3792
|
|| enduser?.fname
|
|
3787
3793
|
|| session.userInfo?.fname
|
|
3788
3794
|
)
|
|
3789
3795
|
const lname = (
|
|
3790
|
-
|
|
3796
|
+
findAnsweredIntakeField('lname')
|
|
3791
3797
|
|| enduser?.lname
|
|
3792
3798
|
|| session.userInfo?.lname
|
|
3793
3799
|
)
|
|
3794
3800
|
const state = (
|
|
3795
|
-
|
|
3796
|
-
|
|
3801
|
+
findAnsweredIntakeField('state')
|
|
3802
|
+
// Handle Address field - find first Address with an actual state value
|
|
3803
|
+
// (in case of multiple address questions where some are blank)
|
|
3804
|
+
|| (responses?.find(r => r.intakeField === 'Address' && r.answer?.type === 'Address' && r.answer?.value?.state)?.answer?.value as Address)?.state
|
|
3797
3805
|
|| enduser?.state
|
|
3798
3806
|
|| (session.userInfo as Enduser)?.state
|
|
3799
3807
|
)
|
package/src/Forms/inputs.v2.tsx
CHANGED
|
@@ -5,14 +5,14 @@ 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"
|
|
7
7
|
import { MM_DD_YYYY_to_YYYY_MM_DD, capture_is_supported, downloadFile, emit_gtm_event, first_letter_capitalized, form_response_value_to_string, getLocalTimezone, getPublicFileURL, mm_dd_yyyy, replace_enduser_template_values, responses_satisfy_conditions, truncate_string, update_local_storage, user_display_name } from "@tellescope/utilities"
|
|
8
|
-
import {
|
|
8
|
+
import { Enduser, EnduserRelationship, FormResponseValue, InsuranceRelationship, MedicationResponse, MultipleChoiceOptions, TellescopeGender, TIMEZONES_USA } from "@tellescope/types-models"
|
|
9
9
|
import { VALID_STATES, emailValidator, phoneValidator } from "@tellescope/validation"
|
|
10
10
|
import Slider from '@mui/material/Slider';
|
|
11
11
|
import LinearProgress from '@mui/material/LinearProgress';
|
|
12
12
|
|
|
13
13
|
import DatePicker from "react-datepicker";
|
|
14
14
|
import { datepickerCSS } from "./css/react-datepicker" // avoids build issue with RN
|
|
15
|
-
import { CancelIcon, FileBlob, IconButton, LabeledIconButton, LoadingButton, Styled, form_display_text_for_language, isDateString,
|
|
15
|
+
import { CancelIcon, FileBlob, IconButton, LabeledIconButton, LoadingButton, Styled, form_display_text_for_language, isDateString, useResolvedSession } from ".."
|
|
16
16
|
import { CalendarEvent, DatabaseRecord, FormField } from "@tellescope/types-client"
|
|
17
17
|
import { css } from '@emotion/css'
|
|
18
18
|
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
|
|
@@ -2919,122 +2919,8 @@ export const HeightInput = ({ field, value={} as any, onChange, ...props }: Form
|
|
|
2919
2919
|
</Grid>
|
|
2920
2920
|
)
|
|
2921
2921
|
|
|
2922
|
-
export
|
|
2923
|
-
|
|
2924
|
-
// get parameters from the current URL, and replace all values where {{URL_PARAM.paramName}} is used
|
|
2925
|
-
const params = new URL(window.location.href).searchParams
|
|
2926
|
-
return url.replace(/{{URL_PARAM\.(.*?)}}/g, (_, paramName) => {
|
|
2927
|
-
const value = params.get(paramName)
|
|
2928
|
-
console.log(paramName, value)
|
|
2929
|
-
if (value === null) return ''
|
|
2930
|
-
return value
|
|
2931
|
-
})
|
|
2932
|
-
|
|
2933
|
-
} catch(err) {
|
|
2934
|
-
console.error(err)
|
|
2935
|
-
}
|
|
2936
|
-
return url
|
|
2937
|
-
}
|
|
2938
|
-
|
|
2939
|
-
export const RedirectInput = ({ enduserId, groupId, groupInsance, rootResponseId, formResponseId, field, submit, value={} as any, onChange, responses, enduser, ...props }: FormInputProps<'Redirect'>) => {
|
|
2940
|
-
const session = useResolvedSession()
|
|
2941
|
-
|
|
2942
|
-
let eId = ''
|
|
2943
|
-
try {
|
|
2944
|
-
eId = new URL(window.location.href).searchParams.get('eId') || enduserId || enduser?.id || ''
|
|
2945
|
-
} catch(err) {}
|
|
2946
|
-
|
|
2947
|
-
const email = (
|
|
2948
|
-
responses?.find(r => r.intakeField === 'email')?.answer?.value
|
|
2949
|
-
|| enduser?.email
|
|
2950
|
-
|| session.userInfo.email
|
|
2951
|
-
)
|
|
2952
|
-
const phone = (
|
|
2953
|
-
responses?.find(r => r.intakeField === 'phone')?.answer?.value
|
|
2954
|
-
|| enduser?.phone
|
|
2955
|
-
|| session.userInfo.phone
|
|
2956
|
-
)
|
|
2957
|
-
const fname = (
|
|
2958
|
-
responses?.find(r => r.intakeField === 'fname')?.answer?.value
|
|
2959
|
-
|| enduser?.fname
|
|
2960
|
-
|| session.userInfo?.fname
|
|
2961
|
-
)
|
|
2962
|
-
const lname = (
|
|
2963
|
-
responses?.find(r => r.intakeField === 'lname')?.answer?.value
|
|
2964
|
-
|| enduser?.lname
|
|
2965
|
-
|| session.userInfo?.lname
|
|
2966
|
-
)
|
|
2967
|
-
const state = (
|
|
2968
|
-
responses?.find(r => r.intakeField === 'state')?.answer?.value
|
|
2969
|
-
|| (responses?.find(r => r.intakeField === 'Address')?.answer?.value as any)?.state
|
|
2970
|
-
|| enduser?.state
|
|
2971
|
-
|| (session.userInfo as Enduser)?.state
|
|
2972
|
-
)
|
|
2973
|
-
|
|
2974
|
-
useEffect(() => {
|
|
2975
|
-
if (session.type === 'user') { return }
|
|
2976
|
-
|
|
2977
|
-
if (field.options?.redirectExternalUrl) {
|
|
2978
|
-
submit?.()
|
|
2979
|
-
.finally(() => {
|
|
2980
|
-
if (!field.options?.redirectExternalUrl) { return }
|
|
2981
|
-
|
|
2982
|
-
window.location.href = (
|
|
2983
|
-
include_current_url_parameters_if_templated(
|
|
2984
|
-
replace_enduser_template_values(
|
|
2985
|
-
field.options.redirectExternalUrl,
|
|
2986
|
-
{
|
|
2987
|
-
...session.userInfo as any,
|
|
2988
|
-
id: eId, email, fname, lname, state, phone,
|
|
2989
|
-
}
|
|
2990
|
-
)
|
|
2991
|
-
)
|
|
2992
|
-
)
|
|
2993
|
-
})
|
|
2994
|
-
.catch(console.error)
|
|
2995
|
-
|
|
2996
|
-
return
|
|
2997
|
-
}
|
|
2998
|
-
|
|
2999
|
-
if (!field.options?.redirectFormId) { return }
|
|
3000
|
-
|
|
3001
|
-
session.api.form_responses.prepare_form_response({
|
|
3002
|
-
enduserId: session.userInfo.id || eId,
|
|
3003
|
-
formId: field.options.redirectFormId,
|
|
3004
|
-
rootResponseId: rootResponseId || formResponseId,
|
|
3005
|
-
parentResponseId: formResponseId,
|
|
3006
|
-
})
|
|
3007
|
-
.then(({ fullURL }) => (
|
|
3008
|
-
// we should still redirect even if submission fails
|
|
3009
|
-
submit?.()
|
|
3010
|
-
.catch(console.error)
|
|
3011
|
-
.finally(() => {
|
|
3012
|
-
// if accessing form group in portal
|
|
3013
|
-
if (window.location.href.includes('/documents') && groupId && groupInsance) {
|
|
3014
|
-
const toRedirect = `${window.location.origin}/documents?groupId=${groupId}&groupInstance=${groupInsance}`
|
|
3015
|
-
if (fullURL.endsWith('&')) {
|
|
3016
|
-
window.location.replace(fullURL + `back=${toRedirect}&`)
|
|
3017
|
-
} else {
|
|
3018
|
-
window.location.replace(fullURL + `&back=${toRedirect}`)
|
|
3019
|
-
}
|
|
3020
|
-
} else {
|
|
3021
|
-
window.location.replace(fullURL)
|
|
3022
|
-
}
|
|
3023
|
-
})
|
|
3024
|
-
))
|
|
3025
|
-
.catch(console.error)
|
|
3026
|
-
}, [session, email, fname, lname, state, phone])
|
|
3027
|
-
|
|
3028
|
-
if (session.type === 'user') {
|
|
3029
|
-
return (
|
|
3030
|
-
<Typography>
|
|
3031
|
-
Redirect is for patient-facing forms only
|
|
3032
|
-
</Typography>
|
|
3033
|
-
)
|
|
3034
|
-
}
|
|
3035
|
-
|
|
3036
|
-
return null
|
|
3037
|
-
}
|
|
2922
|
+
// Re-export from V1 to follow DRY principles
|
|
2923
|
+
export { RedirectInput } from './inputs'
|
|
3038
2924
|
|
|
3039
2925
|
export const HiddenValueInput = ({ goToNextField, goToPreviousField, field, value, onChange, isSinglePage, groupFields }: FormInputProps<'email'>) => {
|
|
3040
2926
|
let lastRef = useRef(0)
|