@tellescope/react-components 1.250.0 → 1.250.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.250.0",
3
+ "version": "1.250.1",
4
4
  "description": "",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -51,13 +51,13 @@
51
51
  "@reduxjs/toolkit": "1.9.0",
52
52
  "@stripe/react-stripe-js": "2.9.0",
53
53
  "@stripe/stripe-js": "1.52.1",
54
- "@tellescope/constants": "1.250.0",
55
- "@tellescope/sdk": "1.250.0",
56
- "@tellescope/types-client": "1.250.0",
57
- "@tellescope/types-models": "1.250.0",
58
- "@tellescope/types-utilities": "1.250.0",
59
- "@tellescope/utilities": "1.250.0",
60
- "@tellescope/validation": "1.250.0",
54
+ "@tellescope/constants": "1.250.1",
55
+ "@tellescope/sdk": "1.250.1",
56
+ "@tellescope/types-client": "1.250.1",
57
+ "@tellescope/types-models": "1.250.1",
58
+ "@tellescope/types-utilities": "1.250.1",
59
+ "@tellescope/utilities": "1.250.1",
60
+ "@tellescope/validation": "1.250.1",
61
61
  "@twilio/video-processors": "3.2.0",
62
62
  "css-to-react-native": "3.0.0",
63
63
  "draft-js": "0.11.7",
@@ -85,7 +85,7 @@
85
85
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
86
86
  "react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
87
87
  },
88
- "gitHead": "dc1bcee546276fd38231a5ac672efd21761fe8e8",
88
+ "gitHead": "1d3f595cd692366a94bf05bc3c7a31e051ab44e4",
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  }
@@ -1213,13 +1213,24 @@ export const useTellescopeForm = ({ dontAutoadvance, isPublicForm, form, urlLogi
1213
1213
  // remaining are required, non-empty
1214
1214
 
1215
1215
  if (field.type === 'file' || field.type === 'files') {
1216
- if (!file.blobs?.length) {
1216
+ const blobCount = file.blobs?.length ?? 0
1217
+
1218
+ let existingCount = 0
1219
+ if (field.type === 'files' && value.answer.type === 'files' && Array.isArray(value.answer.value)) {
1220
+ existingCount = value.answer.value.filter(av => !file.blobs?.some(b => b.name === av.name)).length
1221
+ } else if (field.type === 'file' && value.answer.type === 'file' && value.answer.value?.secureName) {
1222
+ existingCount = 1
1223
+ }
1224
+
1225
+ const totalCount = blobCount + existingCount
1226
+
1227
+ if (totalCount === 0) {
1217
1228
  return "A file is required"
1218
1229
  }
1219
- if (typeof field.options?.min === 'number' && file.blobs.length < field.options.min) {
1230
+ if (typeof field.options?.min === 'number' && totalCount < field.options.min) {
1220
1231
  return `At least ${field.options?.min} file(s) are required`
1221
1232
  }
1222
- if (typeof field.options?.max === 'number' && file.blobs.length > field.options.max) {
1233
+ if (typeof field.options?.max === 'number' && totalCount > field.options.max) {
1223
1234
  return `At most ${field.options?.max} file(s) are allowed`
1224
1235
  }
1225
1236
  return null // no need to check against other stuff