@tellescope/react-components 1.215.0 → 1.217.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.215.0",
3
+ "version": "1.217.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.215.0",
51
- "@tellescope/sdk": "^1.215.0",
52
- "@tellescope/types-client": "^1.215.0",
53
- "@tellescope/types-models": "^1.215.0",
54
- "@tellescope/types-utilities": "^1.215.0",
55
- "@tellescope/utilities": "^1.215.0",
56
- "@tellescope/validation": "^1.215.0",
50
+ "@tellescope/constants": "^1.217.0",
51
+ "@tellescope/sdk": "^1.217.0",
52
+ "@tellescope/types-client": "^1.217.0",
53
+ "@tellescope/types-models": "^1.217.0",
54
+ "@tellescope/types-utilities": "^1.217.0",
55
+ "@tellescope/utilities": "^1.217.0",
56
+ "@tellescope/validation": "^1.217.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": "39f09b83f8161a73400e9f69cadd41680ee1cc50",
86
+ "gitHead": "bb6a45b99c70cd4a7bd14f48061ed6e0c10a547b",
87
87
  "publishConfig": {
88
88
  "access": "public"
89
89
  }
@@ -5,7 +5,7 @@ import { FormInputProps } from "./types"
5
5
  import { useDropzone } from "react-dropzone"
6
6
  import { CANVAS_TITLE, EMOTII_TITLE, INSURANCE_RELATIONSHIPS, INSURANCE_RELATIONSHIPS_CANVAS, PRIMARY_HEX, RELATIONSHIP_TYPES, TELLESCOPE_GENDERS } from "@tellescope/constants"
7
7
  import { MM_DD_YYYY_to_YYYY_MM_DD, capture_is_supported, downloadFile, emit_gtm_event, first_letter_capitalized, form_response_value_to_string, getLocalTimezone, getPublicFileURL, mm_dd_yyyy, replace_enduser_template_values, truncate_string, update_local_storage, user_display_name } from "@tellescope/utilities"
8
- import { DatabaseSelectResponse, Enduser, EnduserRelationship, FormResponseValue, InsuranceRelationship, MedicationResponse, MultipleChoiceOptions, TellescopeGender, TIMEZONES_USA } from "@tellescope/types-models"
8
+ import { Address, DatabaseSelectResponse, Enduser, EnduserRelationship, FormResponseValue, InsuranceRelationship, MedicationResponse, MultipleChoiceOptions, TellescopeGender, TIMEZONES_USA } from "@tellescope/types-models"
9
9
  import { VALID_STATES, emailValidator, phoneValidator } from "@tellescope/validation"
10
10
  import Slider from '@mui/material/Slider';
11
11
  import LinearProgress from '@mui/material/LinearProgress';
@@ -1220,6 +1220,14 @@ export const SignatureInput = ({ value, field, autoFocus=true, enduser, onChange
1220
1220
  )
1221
1221
  }
1222
1222
 
1223
+ const formatBytes = (bytes: number) => {
1224
+ if (bytes === 0) return '0 Bytes';
1225
+ const k = 1024;
1226
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
1227
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
1228
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
1229
+ }
1230
+
1223
1231
  export async function convertHEIC (file: FileBlob | string){
1224
1232
  // get image as blob url
1225
1233
  let blobURL = (
@@ -1250,6 +1258,10 @@ export const FileInput = ({ value, onChange, field, existingFileName, uploadingF
1250
1258
  const file = acceptedFiles.pop()
1251
1259
  if (!file) return
1252
1260
 
1261
+ if (field.options?.maxFileSize && file.size > field.options.maxFileSize) {
1262
+ return setError(`File size must be less than ${formatBytes(field.options.maxFileSize)}`)
1263
+ }
1264
+
1253
1265
  if (field.options?.validFileTypes?.length) {
1254
1266
  const match = field.options.validFileTypes.find(t => file.type.includes(t.toLowerCase()))
1255
1267
  if (!match) {
@@ -2012,6 +2024,9 @@ export const DatabaseSelectInput = ({ AddToDatabase, field, value: _value, onCha
2012
2024
  ? (filterResponse as any[]).find(r => r === v.toString() || (typeof r === 'object' && r.text === v))
2013
2025
  : (typeof filterResponse === 'string' || typeof filterResponse === 'number')
2014
2026
  ? filterResponse.toString() === v.toString()
2027
+ : (typeof filterResponse === 'object' && (filterResponse as Address).city === v.toString()) ? true
2028
+ : (typeof filterResponse === 'object' && (filterResponse as Address).state === v.toString()) ? true
2029
+ : (typeof filterResponse === 'object' && (filterResponse as Address).zipCode === v.toString()) ? true
2015
2030
  : false
2016
2031
  )
2017
2032
  }