@tellescope/react-components 1.200.1 → 1.201.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.
Files changed (53) hide show
  1. package/lib/cjs/CMS/components.d.ts +0 -1
  2. package/lib/cjs/CMS/components.d.ts.map +1 -1
  3. package/lib/cjs/Forms/form_responses.d.ts +0 -1
  4. package/lib/cjs/Forms/form_responses.d.ts.map +1 -1
  5. package/lib/cjs/Forms/hooks.d.ts +0 -1
  6. package/lib/cjs/Forms/hooks.d.ts.map +1 -1
  7. package/lib/cjs/Forms/hooks.js +1 -0
  8. package/lib/cjs/Forms/hooks.js.map +1 -1
  9. package/lib/cjs/controls.d.ts +2 -2
  10. package/lib/cjs/hooks.d.ts +1 -0
  11. package/lib/cjs/hooks.d.ts.map +1 -1
  12. package/lib/cjs/hooks.js +20 -1
  13. package/lib/cjs/hooks.js.map +1 -1
  14. package/lib/cjs/inputs.native.d.ts +0 -1
  15. package/lib/cjs/inputs.native.d.ts.map +1 -1
  16. package/lib/cjs/inputs_shared.d.ts +1 -0
  17. package/lib/cjs/inputs_shared.d.ts.map +1 -1
  18. package/lib/cjs/inputs_shared.js.map +1 -1
  19. package/lib/cjs/layout.d.ts +4 -1
  20. package/lib/cjs/layout.d.ts.map +1 -1
  21. package/lib/cjs/layout.js +2 -2
  22. package/lib/cjs/layout.js.map +1 -1
  23. package/lib/esm/CMS/components.d.ts +0 -1
  24. package/lib/esm/CMS/components.d.ts.map +1 -1
  25. package/lib/esm/Forms/form_responses.d.ts +0 -1
  26. package/lib/esm/Forms/form_responses.d.ts.map +1 -1
  27. package/lib/esm/Forms/forms.d.ts +3 -3
  28. package/lib/esm/Forms/hooks.d.ts +0 -1
  29. package/lib/esm/Forms/hooks.d.ts.map +1 -1
  30. package/lib/esm/Forms/hooks.js +2 -1
  31. package/lib/esm/Forms/hooks.js.map +1 -1
  32. package/lib/esm/controls.d.ts +2 -2
  33. package/lib/esm/hooks.d.ts +1 -0
  34. package/lib/esm/hooks.d.ts.map +1 -1
  35. package/lib/esm/hooks.js +18 -0
  36. package/lib/esm/hooks.js.map +1 -1
  37. package/lib/esm/inputs.d.ts +1 -1
  38. package/lib/esm/inputs.native.d.ts +0 -1
  39. package/lib/esm/inputs.native.d.ts.map +1 -1
  40. package/lib/esm/inputs_shared.d.ts +1 -0
  41. package/lib/esm/inputs_shared.d.ts.map +1 -1
  42. package/lib/esm/inputs_shared.js.map +1 -1
  43. package/lib/esm/layout.d.ts +4 -1
  44. package/lib/esm/layout.d.ts.map +1 -1
  45. package/lib/esm/layout.js +2 -2
  46. package/lib/esm/layout.js.map +1 -1
  47. package/lib/esm/state.d.ts +40 -40
  48. package/lib/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +9 -9
  50. package/src/Forms/hooks.tsx +3 -1
  51. package/src/hooks.ts +24 -0
  52. package/src/inputs_shared.tsx +1 -0
  53. package/src/layout.tsx +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/react-components",
3
- "version": "1.200.1",
3
+ "version": "1.201.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.200.1",
51
- "@tellescope/sdk": "^1.200.1",
52
- "@tellescope/types-client": "^1.200.1",
53
- "@tellescope/types-models": "^1.200.1",
54
- "@tellescope/types-utilities": "^1.200.1",
55
- "@tellescope/utilities": "^1.200.1",
56
- "@tellescope/validation": "^1.200.1",
50
+ "@tellescope/constants": "^1.201.0",
51
+ "@tellescope/sdk": "^1.201.0",
52
+ "@tellescope/types-client": "^1.201.0",
53
+ "@tellescope/types-models": "^1.201.0",
54
+ "@tellescope/types-utilities": "^1.201.0",
55
+ "@tellescope/utilities": "^1.201.0",
56
+ "@tellescope/validation": "^1.201.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": "de1357ce5489fa00e4044d1c39b697f1e298c0a7",
87
+ "gitHead": "f47e1bb6ac39838d698df1c4d0d40170920526b6",
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  }
@@ -5,7 +5,7 @@ import { DatabaseRecord, Enduser, Form, FormField, FormResponse } from "@tellesc
5
5
  import { phoneValidator } from "@tellescope/validation"
6
6
  import { FileBlob, Indexable } from "@tellescope/types-utilities"
7
7
  import { CompoundFilter, EnduserRelationship, FormCustomization, FormResponseAnswerAddress, FormResponseAnswerFileValue, FormResponseValue, FormResponseValueAnswer, OrganizationTheme, PreviousFormCompoundLogic, PreviousFormFieldType } from "@tellescope/types-models"
8
- import { WithTheme, contact_is_valid, useFileUpload, useFormFields, useFormResponses, useResolvedSession, value_is_loaded } from "../index"
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
 
11
11
  import isEmail from "validator/lib/isEmail"
@@ -544,6 +544,8 @@ export const useTellescopeForm = ({ dontAutoadvance, isPublicForm, form, urlLogi
544
544
  goBackURL = new URL(window.location.href).searchParams.get('back') || ''
545
545
  } catch(err) {}
546
546
 
547
+ useAddGTMTag(form?.gtmTag)
548
+
547
549
  useEffect(() => {
548
550
  try {
549
551
  window.location.hash = activeField.value.id
package/src/hooks.ts CHANGED
@@ -60,4 +60,28 @@ export const useSearchAPI = <T,>({ query, onLoad, searchAPI } : { query: string
60
60
 
61
61
  return () => { clearTimeout(t) }
62
62
  }, [query, searchAPI, onLoad, searchedRef])
63
+ }
64
+
65
+ export const useAddGTMTag = (gtmTag?: string) => {
66
+ useEffect(() => {
67
+ if (!gtmTag) return
68
+
69
+ try {
70
+ const existingScript = document.querySelector(
71
+ `script[src*="https://www.googletagmanager.com/gtm.js?id=${gtmTag}"]`
72
+ )
73
+ if (existingScript) return
74
+
75
+ const script = document.createElement('script');
76
+ script.type = 'text/javascript';
77
+ script.text = `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
78
+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
79
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
80
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
81
+ })(window,document,'script','dataLayer','${gtmTag}');`
82
+ document.head.appendChild(script);
83
+ } catch(err) {
84
+ console.warn(err)
85
+ }
86
+ }, [gtmTag])
63
87
  }
@@ -817,6 +817,7 @@ export interface GenericSearchProps <T> extends FilterComponent<T> {
817
817
  value?: string,
818
818
  onChange?: (s: string) => void,
819
819
  hideIcon?: boolean,
820
+ variant?: TextFieldProps['variant'],
820
821
  }
821
822
  interface ModelSearchProps<T> extends GenericSearchProps<T>, SearchAPIProps<T> {}
822
823
  export const ModelSearchInput = <T,>({
package/src/layout.tsx CHANGED
@@ -303,6 +303,7 @@ export interface ScrollingListProps <T extends { id: string | number }> extends
303
303
  hideHorizontalScroll?: boolean,
304
304
  }
305
305
  loadMoreOptions?: LoadMoreOptions<T>,
306
+ scrollRef?: React.RefObject<FixedSizeList<T[]>>,
306
307
  }
307
308
  export const ScrollingList = <T extends { id: string | number }>({
308
309
  title,
@@ -322,7 +323,9 @@ export const ScrollingList = <T extends { id: string | number }>({
322
323
  itemContainerStyle,
323
324
  virtualization,
324
325
  loadMoreOptions,
325
- } : ScrollingListProps<T> & { noParentScroll?: boolean, }) => {
326
+ initialScrollOffset,
327
+ scrollRef,
328
+ } : ScrollingListProps<T> & { noParentScroll?: boolean, initialScrollOffset?: number }) => {
326
329
  const width = usePageWidth()
327
330
  const fetchRef = useRef(0)
328
331
  const titleStyleWithDefaults = { fontSize: 20, fontWeight: 'bold', marginBottom: 3, ...titleStyle }
@@ -380,7 +383,7 @@ export const ScrollingList = <T extends { id: string | number }>({
380
383
  : emptyText
381
384
  : virtualization?.virtualize ? (
382
385
  // keep consistent with DraggableList
383
- <FixedSizeList
386
+ <FixedSizeList initialScrollOffset={initialScrollOffset} ref={scrollRef}
384
387
  style={{ overflowX: virtualization?.hideHorizontalScroll ? 'hidden' : undefined }}
385
388
  height={virtualization?.height || window.innerHeight - 225}
386
389
  width={