@tellescope/react-components 1.170.0 → 1.171.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/react-components",
3
- "version": "1.170.0",
3
+ "version": "1.171.1",
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.170.0",
51
- "@tellescope/sdk": "^1.170.0",
52
- "@tellescope/types-client": "^1.170.0",
53
- "@tellescope/types-models": "^1.170.0",
54
- "@tellescope/types-utilities": "^1.170.0",
55
- "@tellescope/utilities": "^1.170.0",
56
- "@tellescope/validation": "^1.170.0",
50
+ "@tellescope/constants": "^1.171.1",
51
+ "@tellescope/sdk": "^1.171.1",
52
+ "@tellescope/types-client": "^1.171.1",
53
+ "@tellescope/types-models": "^1.171.1",
54
+ "@tellescope/types-utilities": "^1.171.1",
55
+ "@tellescope/utilities": "^1.171.1",
56
+ "@tellescope/validation": "^1.171.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",
@@ -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": "d9bbecc704e9ecd06d59ffbdaa155879a109c925",
87
+ "gitHead": "6909a4e4706eae5a624b226e781893775d20bb42",
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  }
@@ -1290,7 +1290,7 @@ export const useTellescopeForm = ({ isPublicForm, form, urlLogicValue, customiza
1290
1290
  }, [activeField, validateField, uploadingFiles])
1291
1291
 
1292
1292
  const autoAdvanceRef = useRef(false)
1293
- const goToNextField = useCallback(() => {
1293
+ const goToNextField = useCallback((answer?: FormResponseValue['answer']) => {
1294
1294
  if (!currentValue) return
1295
1295
  if (isNextDisabled() && currentValue?.answer.type !== 'Hidden Value') return
1296
1296
 
@@ -1313,7 +1313,10 @@ export const useTellescopeForm = ({ isPublicForm, form, urlLogicValue, customiza
1313
1313
  session.api.form_responses.save_field_response({
1314
1314
  accessCode,
1315
1315
  formResponseId,
1316
- response: currentValue,
1316
+ response: {
1317
+ ...currentValue,
1318
+ answer: answer || currentValue.answer
1319
+ },
1317
1320
  })
1318
1321
  .catch(console.error)
1319
1322
  }
@@ -1767,9 +1767,10 @@ const useDatabaseChoices = ({ databaseId='', field, otherAnswers } : { databaseI
1767
1767
  const session = useResolvedSession()
1768
1768
  const [renderCount, setRenderCount] = useState(0)
1769
1769
 
1770
+ // todo: make searchable, don't load all
1770
1771
  useEffect(() => {
1771
1772
  if (choicesForDatabase[databaseId]?.done) return
1772
- if (renderCount > 10) return // limit to 5000 entries / prevent infinite looping
1773
+ if (renderCount > 100) return // limit to 50000 entries / prevent infinite looping
1773
1774
  const choices = choicesForDatabase[databaseId]?.records ?? []
1774
1775
  const lastId = choicesForDatabase[databaseId]?.lastId
1775
1776
 
@@ -3072,7 +3073,9 @@ export const HiddenValueInput = ({ goToNextField, goToPreviousField, field, valu
3072
3073
  goToPreviousField?.()
3073
3074
  } else {
3074
3075
  onChange(field.title, field.id)
3075
- goToNextField?.()
3076
+ console.log('going to next field for hidden value', field.title, !!goToNextField)
3077
+ // pass value that is set after above onChange
3078
+ goToNextField?.({ type: 'Hidden Value', value: field.title })
3076
3079
  }
3077
3080
  }, [value, onChange, field, goToNextField, goToPreviousField, isSinglePage])
3078
3081
 
@@ -1,9 +1,8 @@
1
- import { AnswerForType } from "@tellescope/types-models";
1
+ import { AnswerForType, FormResponseValue } from "@tellescope/types-models";
2
2
  import { DatabaseRecord, Enduser, Form, FormField } from "@tellescope/types-client";
3
3
  import { FileBlob, TreeNode } from "@tellescope/types-utilities";
4
4
  import { JSXElementConstructor } from "react";
5
5
  import { Response } from "./hooks";
6
- import { FileUploadHandler } from "../inputs";
7
6
 
8
7
  export type FormFieldNode = TreeNode<FormField>
9
8
 
@@ -24,7 +23,7 @@ export interface FormInputProps<K extends keyof AnswerForType> {
24
23
  enduserId?: string,
25
24
  enduser?: Partial<Enduser>
26
25
  goToPreviousField?: () => void,
27
- goToNextField?: () => void,
26
+ goToNextField?: (response?: FormResponseValue['answer']) => void,
28
27
  isPreviousDisabled?: () => boolean,
29
28
  formResponseId?: string,
30
29
  rootResponseId?: string,