@tellescope/react-components 1.203.2 → 1.204.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.203.2",
3
+ "version": "1.204.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.203.2",
51
- "@tellescope/sdk": "^1.203.2",
52
- "@tellescope/types-client": "^1.203.2",
53
- "@tellescope/types-models": "^1.203.2",
54
- "@tellescope/types-utilities": "^1.203.2",
55
- "@tellescope/utilities": "^1.203.2",
56
- "@tellescope/validation": "^1.203.2",
50
+ "@tellescope/constants": "^1.204.0",
51
+ "@tellescope/sdk": "^1.204.0",
52
+ "@tellescope/types-client": "^1.204.0",
53
+ "@tellescope/types-models": "^1.204.0",
54
+ "@tellescope/types-utilities": "^1.204.0",
55
+ "@tellescope/utilities": "^1.204.0",
56
+ "@tellescope/validation": "^1.204.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": "015f8e67ae86e7e1275f6c1ea82aec14d2e6cd6c",
87
+ "gitHead": "a30f4306bf8aa1fd45d633bec0da763c0595ddc1",
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  }
@@ -638,7 +638,9 @@ export const useTellescopeForm = ({ dontAutoadvance, isPublicForm, form, urlLogi
638
638
  ? (
639
639
  (f.options?.default && !isNaN(parseInt(f.options.default)))
640
640
  ? parseInt(f.options.default)
641
- : (f.options?.from || 1)
641
+ : f.isOptional
642
+ ? undefined
643
+ : (f.options?.from || 1)
642
644
  )
643
645
  : f.type === 'Related Contacts'
644
646
  ? (f.isOptional ? [] : [{ relationships: f?.options?.relatedContactTypes?.length === 1 ? [{ type: f.options.relatedContactTypes[0] as EnduserRelationship['type'], id: ''! } ] : [] }])
@@ -142,6 +142,9 @@ export const RatingInput = ({ field, value, onChange }: FormInputProps<'rating'>
142
142
  valueLabelDisplay={marks.length < allMarks.length ? 'auto' : "off"}
143
143
  value={value}
144
144
  onChange={(e, v) => onChange(v as number, field.id)}
145
+ sx={{
146
+ '& .MuiSlider-thumb': value === undefined ? { display: 'none' } : {}, // Hide thumb until value is set
147
+ }}
145
148
  />
146
149
  )
147
150
  }
@@ -3143,6 +3146,19 @@ export const HiddenValueInput = ({ goToNextField, goToPreviousField, field, valu
3143
3146
  || !!(groupFields?.find(v => v.type !== 'Hidden Value')) // group contains at least 1 non-hidden value
3144
3147
  )
3145
3148
 
3149
+ const publicIdentifier = useMemo(() => {
3150
+ try {
3151
+ return new URL(window.location.href).searchParams.get('publicIdentifier') || ''
3152
+ } catch(err) {
3153
+ return ''
3154
+ }
3155
+ }, [])
3156
+
3157
+ const valueToSet = useMemo(() => (
3158
+ (field.title === "{{PUBLIC_IDENTIFIER}}" && publicIdentifier) ? publicIdentifier
3159
+ : field.title
3160
+ ), [field.title, publicIdentifier])
3161
+
3146
3162
  useEffect(() => {
3147
3163
  if (lastRef.current > Date.now() - 1000 && lastIdRef.current === field.id) return
3148
3164
  lastRef.current = Date.now()
@@ -3155,15 +3171,14 @@ export const HiddenValueInput = ({ goToNextField, goToPreviousField, field, valu
3155
3171
  if (dontNavigate) return
3156
3172
  goToPreviousField?.()
3157
3173
  } else {
3158
- onChange(field.title, field.id)
3174
+ onChange(valueToSet, field.id)
3159
3175
 
3160
3176
  if (dontNavigate) return
3161
3177
 
3162
3178
  // pass value that is set after above onChange
3163
- console.log('going to next field for hidden value', field.title, !!goToNextField)
3164
- goToNextField?.({ type: 'Hidden Value', value: field.title })
3179
+ goToNextField?.({ type: 'Hidden Value', value: valueToSet })
3165
3180
  }
3166
- }, [value, onChange, field, goToNextField, goToPreviousField, isSinglePage, dontNavigate])
3181
+ }, [value, onChange, field.id, valueToSet, goToNextField, goToPreviousField, isSinglePage, dontNavigate])
3167
3182
 
3168
3183
  return <></>
3169
3184
  }