@tellescope/react-components 1.166.1 → 1.167.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/react-components",
3
- "version": "1.166.1",
3
+ "version": "1.167.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.166.1",
51
- "@tellescope/sdk": "^1.166.1",
52
- "@tellescope/types-client": "^1.166.1",
53
- "@tellescope/types-models": "^1.166.1",
54
- "@tellescope/types-utilities": "^1.166.1",
55
- "@tellescope/utilities": "^1.166.1",
56
- "@tellescope/validation": "^1.166.1",
50
+ "@tellescope/constants": "^1.167.0",
51
+ "@tellescope/sdk": "^1.167.0",
52
+ "@tellescope/types-client": "^1.167.0",
53
+ "@tellescope/types-models": "^1.167.0",
54
+ "@tellescope/types-utilities": "^1.167.0",
55
+ "@tellescope/utilities": "^1.167.0",
56
+ "@tellescope/validation": "^1.167.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": "b25b999a8f6b78c6f41641f88e80672afc2e49ca",
83
+ "gitHead": "c38c1cdd092cc5a0881c68117d88e98b83daed8e",
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  }
@@ -266,7 +266,7 @@ export const QuestionForField = ({
266
266
  <Height field={field} disabled={value.disabled} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<any>} form={form} />
267
267
  )
268
268
  : field.type === 'Redirect' ? (
269
- <Redirect rootResponseId={rootResponseId} formResponseId={formResponseId} 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} />
269
+ <Redirect enduserId={enduserId} rootResponseId={rootResponseId} formResponseId={formResponseId} 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} />
270
270
  )
271
271
  : field.type === 'Related Contacts' ? (
272
272
  <RelatedContacts field={field} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<any>} form={form} />
@@ -2177,68 +2177,18 @@ export const CanvasMedicationsInput = ({ field, value=[], onChange }: FormInputP
2177
2177
  </Grid>
2178
2178
 
2179
2179
  <Grid item>
2180
- <Grid container alignItems="center" wrap="nowrap" columnGap={0.5} justifyContent={"space-between"}>
2181
- <Grid item sx={{ width: '50%', mr: 1 }}>
2182
- <TextField type="number" InputProps={{ sx: defaultInputProps.sx }} fullWidth size="small"
2183
- label="Units (e.g. capsule, table, puff) per dose?"
2184
- value={medication.dosage?.quantity || ''}
2185
- onChange={e => (
2186
- onChange((value || []).map((v, _i) =>
2187
- i === _i
2188
- ? { ...v, dosage: { ...v.dosage!, quantity: e.target.value } }
2189
- : v
2190
- ),
2191
- field.id
2192
- )
2193
- )} />
2194
- </Grid>
2195
-
2196
- <Grid item sx={{ width: '30%' }}>
2197
- <StringSelector size="small" label="How many times?"
2198
- options={["1", "2", "3", "4", "5", "6", "As Needed"]}
2199
- value={medication.dosage?.frequency ?? ''}
2200
- onChange={async (frequency) => {
2201
- onChange(
2202
- (value ?? []).map((_v, _i) => (
2203
- i === _i
2204
- ? {
2205
- ..._v,
2206
- dosage: {
2207
- ..._v.dosage!,
2208
- frequency: frequency || ''
2209
- }
2210
- }
2211
- : _v
2212
- )),
2213
- field.id,
2214
- )
2215
- }}
2216
- />
2217
- </Grid>
2218
-
2219
- <Grid item sx={{ width: '20%' }}>
2220
- <StringSelector options={['Day', 'Week', 'Month', "Year"]} size="small" label="Per"
2221
- value={medication.dosage?.frequencyDescriptor || 'Day'}
2222
- onChange={frequencyDescriptor => (
2223
- onChange((value || []).map((v, _i) =>
2224
- i === _i
2225
- ? { ...v, dosage: { ...v.dosage!, frequencyDescriptor } }
2226
- : v
2227
- ),
2228
- field.id
2229
- )
2230
- )}
2231
- getDisplayValue={first_letter_capitalized}
2232
- />
2233
- </Grid>
2234
- </Grid>
2235
- </Grid>
2236
-
2237
- <Grid item>
2238
- <TextField InputProps={{ sx: defaultInputProps.sx }} fullWidth size="small" label="Reason for taking medication"
2239
- value={medication.reasonForTaking || ''}
2240
- onChange={e => onChange((value || []).map((v, _i) => i === _i ? { ...v, reasonForTaking: e.target.value } : v), field.id)}
2241
- />
2180
+ <TextField InputProps={{ sx: defaultInputProps.sx }} fullWidth size="small"
2181
+ label="Medication instructions: how much you take, how often, and when"
2182
+ value={medication.dosage?.description || ''}
2183
+ onChange={e => (
2184
+ onChange((value || []).map((v, _i) =>
2185
+ i === _i
2186
+ ? { ...v, dosage: { ...v.dosage!, description: e.target.value } }
2187
+ : v
2188
+ ),
2189
+ field.id
2190
+ )
2191
+ )} />
2242
2192
  </Grid>
2243
2193
 
2244
2194
  <Grid item>
@@ -2983,14 +2933,12 @@ export const HeightInput = ({ field, value={} as any, onChange, ...props }: Form
2983
2933
  )
2984
2934
 
2985
2935
  export const RedirectInput = ({ enduserId, groupId, groupInsance, rootResponseId, formResponseId, field, submit, value={} as any, onChange, responses, enduser, ...props }: FormInputProps<'Redirect'>) => {
2986
- console.log('formResponseId', formResponseId, 'rootResponseId', rootResponseId)
2987
2936
  const session = useResolvedSession()
2988
2937
 
2989
2938
  let eId = ''
2990
2939
  try {
2991
- eId = new URL(window.location.href).searchParams.get('eId') || enduserId || ''
2940
+ eId = new URL(window.location.href).searchParams.get('eId') || enduserId || enduser?.id || ''
2992
2941
  } catch(err) {}
2993
- console.log(eId)
2994
2942
 
2995
2943
  const email = (
2996
2944
  responses?.find(r => r.intakeField === 'email')?.answer?.value
@@ -3084,9 +3032,11 @@ export const RedirectInput = ({ enduserId, groupId, groupInsance, rootResponseId
3084
3032
 
3085
3033
  export const HiddenValueInput = ({ goToNextField, goToPreviousField, field, value, onChange, form, isSinglePage, }: FormInputProps<'email'>) => {
3086
3034
  let lastRef = useRef(0)
3035
+ let lastIdRef = useRef('')
3087
3036
  useEffect(() => {
3088
- if (lastRef.current > Date.now() - 1000) return
3037
+ if (lastRef.current > Date.now() - 1000 && lastIdRef.current === field.id) return
3089
3038
  lastRef.current = Date.now()
3039
+ lastIdRef.current = field.id
3090
3040
 
3091
3041
  if (value) {
3092
3042
  if (isSinglePage) return