@tellescope/react-components 1.218.0 → 1.220.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.218.0",
3
+ "version": "1.220.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.218.0",
51
- "@tellescope/sdk": "^1.218.0",
52
- "@tellescope/types-client": "^1.218.0",
53
- "@tellescope/types-models": "^1.218.0",
54
- "@tellescope/types-utilities": "^1.218.0",
55
- "@tellescope/utilities": "^1.218.0",
56
- "@tellescope/validation": "^1.218.0",
50
+ "@tellescope/constants": "^1.220.0",
51
+ "@tellescope/sdk": "^1.220.0",
52
+ "@tellescope/types-client": "^1.220.0",
53
+ "@tellescope/types-models": "^1.220.0",
54
+ "@tellescope/types-utilities": "^1.220.0",
55
+ "@tellescope/utilities": "^1.220.0",
56
+ "@tellescope/validation": "^1.220.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",
@@ -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": "74eae7c7a83047d1d337e8f9ab3e935ccd852271",
86
+ "gitHead": "53762e2ba183af157f6a5edd1a5f37999a93569e",
87
87
  "publishConfig": {
88
88
  "access": "public"
89
89
  }
@@ -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, EnduserRelationship, FormCustomization, FormResponseAnswerAddress, FormResponseAnswerFileValue, FormResponseValue, FormResponseValueAnswer, OrganizationTheme, PreviousFormCompoundLogic, PreviousFormFieldType } from "@tellescope/types-models"
7
+ import { CompoundFilter, EnduserRelationship, FormCustomization, FormResponseAnswerAddress, FormResponseAnswerFileValue, FormResponseValue, FormResponseValueAnswer, OrganizationTheme, PreviousFormCompoundLogic, PreviousFormFieldType, Timezone, TIMEZONES } from "@tellescope/types-models"
8
8
  import { WithTheme, contact_is_valid, useAddGTMTag, useFileUpload, useFormFields, useFormResponses, useResolvedSession, value_is_loaded } from "../index"
9
9
  import ReactGA from "react-ga4";
10
10
 
@@ -751,6 +751,12 @@ export const useTellescopeForm = ({ dontAutoadvance, isPublicForm, form, urlLogi
751
751
 
752
752
  const stringValues: string[] = []
753
753
  for (const databaseValue of databaseValues) {
754
+ if (r.answer.type === 'Timezone') {
755
+ if (typeof databaseValue.value !== 'string') { continue }
756
+ if (!TIMEZONES.includes(databaseValue.value as Timezone)) { continue }
757
+
758
+ return { ...r, answer: { ...r.answer, value: databaseValue.value } }
759
+ }
754
760
  if (databaseValue.type === 'Address') {
755
761
  if (r.answer.type !== 'Address') return r
756
762
 
@@ -1334,6 +1340,7 @@ export const useTellescopeForm = ({ dontAutoadvance, isPublicForm, form, urlLogi
1334
1340
  if (!currentValue) return
1335
1341
  if (isNextDisabled() && currentValue?.answer.type !== 'Hidden Value') return
1336
1342
 
1343
+ console.log('going to next field')
1337
1344
  if (currentValue.answer.type === 'Question Group') {
1338
1345
  const responsesToSave = (
1339
1346
  (currentValue.field.options?.subFields || [])
@@ -1373,7 +1380,7 @@ export const useTellescopeForm = ({ dontAutoadvance, isPublicForm, form, urlLogi
1373
1380
 
1374
1381
  return newField || activeField
1375
1382
  })
1376
- }, [prevFieldStackRef, currentValue, isNextDisabled, updateFormResponse, session, responses, logicOptions])
1383
+ }, [prevFieldStackRef, currentValue, isNextDisabled, updateFormResponse, session, responses, logicOptions, accessCode, formResponseId, setActiveField, setCurrentPageIndex])
1377
1384
 
1378
1385
  useEffect(() => {
1379
1386
  if (dontAutoadvance) return
@@ -1383,7 +1390,10 @@ export const useTellescopeForm = ({ dontAutoadvance, isPublicForm, form, urlLogi
1383
1390
  // add slight delay so it's obvious which answer was selected before proceeding
1384
1391
  const t = setTimeout(goToNextField, 250)
1385
1392
 
1386
- return () => { clearTimeout(t) }
1393
+ return () => {
1394
+ console.log('clearing autoadvance timeout');
1395
+ clearTimeout(t)
1396
+ }
1387
1397
  }, [responses, goToNextField, dontAutoadvance])
1388
1398
 
1389
1399
  const isPreviousDisabled = useCallback(() => (
@@ -969,7 +969,7 @@ export const AddressInput = ({ field, form, value, onChange, ...props }: FormInp
969
969
  // state only
970
970
  field.options?.addressFields?.includes('state')
971
971
  ? (
972
- <Autocomplete value={value?.state}
972
+ <Autocomplete value={value?.state || ''}
973
973
  options={field.options?.validStates?.length ? field.options.validStates : VALID_STATES}
974
974
  disablePortal
975
975
  onChange={(e, v) => v &&
@@ -1043,7 +1043,7 @@ export const AddressInput = ({ field, form, value, onChange, ...props }: FormInp
1043
1043
  </Grid>
1044
1044
 
1045
1045
  <Grid item xs={field.fullZIP ? 4 : 6} sm={field.fullZIP ? 2 : 3}>
1046
- <Autocomplete value={value?.state} fullWidth
1046
+ <Autocomplete value={value?.state || ''} fullWidth
1047
1047
  options={field.options?.validStates?.length ? field.options.validStates : VALID_STATES}
1048
1048
  disablePortal
1049
1049
  onChange={(e, v) => v &&