@cobre-npm/library-onboarding-core 0.7.3 → 0.7.5

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.
@@ -14,6 +14,7 @@ export type FieldValidationRule = {
14
14
  };
15
15
  export interface FieldValidation {
16
16
  readonly maxLength?: number;
17
+ readonly minLength?: number;
17
18
  readonly rule?: FieldValidationRule;
18
19
  readonly noSpaces?: boolean;
19
20
  }
@@ -21,5 +22,6 @@ export declare const FIELD_VALIDATIONS: Record<string, FieldValidation>;
21
22
  export declare const getFieldValidation: (fieldName: string) => FieldValidation | undefined;
22
23
  export declare const getFieldRule: (fieldName: string) => FieldValidationRule | undefined;
23
24
  export declare const getFieldMaxLength: (fieldName: string, fallback?: number) => number;
25
+ export declare const getFieldMinLength: (fieldName: string) => number | undefined;
24
26
  export declare const disallowsSpaces: (fieldName: string) => boolean;
25
27
  export declare const hasFieldValidation: (fieldName: string) => boolean;
@@ -9,7 +9,7 @@
9
9
  * (input validation, date bounds); this module holds data + pure lookups only.
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.hasFieldValidation = exports.disallowsSpaces = exports.getFieldMaxLength = exports.getFieldRule = exports.getFieldValidation = exports.FIELD_VALIDATIONS = exports.DEFAULT_NAME_MIN_LENGTH = exports.DEFAULT_PHONE_MAX_LENGTH = exports.DEFAULT_MAX_LENGTH = void 0;
12
+ exports.hasFieldValidation = exports.disallowsSpaces = exports.getFieldMinLength = exports.getFieldMaxLength = exports.getFieldRule = exports.getFieldValidation = exports.FIELD_VALIDATIONS = exports.DEFAULT_NAME_MIN_LENGTH = exports.DEFAULT_PHONE_MAX_LENGTH = exports.DEFAULT_MAX_LENGTH = void 0;
13
13
  // Fallback max length when a field declares none.
14
14
  exports.DEFAULT_MAX_LENGTH = 500;
15
15
  // Fallback max length for phone fields specifically.
@@ -39,7 +39,7 @@ exports.FIELD_VALIDATIONS = {
39
39
  third_party_id: { maxLength: 100, noSpaces: true },
40
40
  email: { noSpaces: true },
41
41
  // Length-only fields.
42
- phone: { maxLength: exports.DEFAULT_PHONE_MAX_LENGTH },
42
+ phone: { minLength: 2, maxLength: exports.DEFAULT_PHONE_MAX_LENGTH },
43
43
  legal_name: { maxLength: 300 },
44
44
  dba_name: { maxLength: 300 },
45
45
  incorporation_state: { maxLength: 100 },
@@ -70,6 +70,9 @@ const getFieldRule = (fieldName) => exports.FIELD_VALIDATIONS[fieldName]?.rule;
70
70
  exports.getFieldRule = getFieldRule;
71
71
  const getFieldMaxLength = (fieldName, fallback = exports.DEFAULT_MAX_LENGTH) => exports.FIELD_VALIDATIONS[fieldName]?.maxLength ?? fallback;
72
72
  exports.getFieldMaxLength = getFieldMaxLength;
73
+ // Undefined when the field declares no floor — consumers skip the check entirely.
74
+ const getFieldMinLength = (fieldName) => exports.FIELD_VALIDATIONS[fieldName]?.minLength;
75
+ exports.getFieldMinLength = getFieldMinLength;
73
76
  const disallowsSpaces = (fieldName) => exports.FIELD_VALIDATIONS[fieldName]?.noSpaces === true;
74
77
  exports.disallowsSpaces = disallowsSpaces;
75
78
  const hasFieldValidation = (fieldName) => (0, exports.getFieldValidation)(fieldName) !== undefined;
package/dist/index.d.ts CHANGED
@@ -2360,6 +2360,7 @@ export declare const locales: {
2360
2360
  badExtensionQuestionnaire: string;
2361
2361
  tooLarge: string;
2362
2362
  tooLargeQuestionnaire: string;
2363
+ empty: string;
2363
2364
  rejected: string;
2364
2365
  invalidFileType: string;
2365
2366
  invalidFileName: string;
@@ -2418,8 +2419,14 @@ export declare const locales: {
2418
2419
  invalid: string;
2419
2420
  nameFormat: string;
2420
2421
  nameMinLength: string;
2422
+ numericOnly: string;
2421
2423
  numericRange: string;
2424
+ alphanumericOnly: string;
2425
+ minLength: string;
2426
+ maxLength: string;
2422
2427
  emailFormat: string;
2428
+ urlFormat: string;
2429
+ phoneFormat: string;
2423
2430
  };
2424
2431
  };
2425
2432
  es: {
@@ -2433,6 +2440,7 @@ export declare const locales: {
2433
2440
  badExtensionQuestionnaire: string;
2434
2441
  tooLarge: string;
2435
2442
  tooLargeQuestionnaire: string;
2443
+ empty: string;
2436
2444
  rejected: string;
2437
2445
  invalidFileType: string;
2438
2446
  invalidFileName: string;
@@ -2491,8 +2499,14 @@ export declare const locales: {
2491
2499
  invalid: string;
2492
2500
  nameFormat: string;
2493
2501
  nameMinLength: string;
2502
+ numericOnly: string;
2494
2503
  numericRange: string;
2504
+ alphanumericOnly: string;
2505
+ minLength: string;
2506
+ maxLength: string;
2495
2507
  emailFormat: string;
2508
+ urlFormat: string;
2509
+ phoneFormat: string;
2496
2510
  };
2497
2511
  };
2498
2512
  };
@@ -9,6 +9,7 @@
9
9
  "badExtensionQuestionnaire": "The questionnaire must be a PDF or HTML file.",
10
10
  "tooLarge": "The file exceeds the 90 MB maximum.",
11
11
  "tooLargeQuestionnaire": "The file exceeds the 5 MB maximum.",
12
+ "empty": "The file is empty. Please select a file with content.",
12
13
  "rejected": "The document was rejected because its contents don't match an allowed format. Please upload it again.",
13
14
  "invalidFileType": "File type not allowed. Accepted: PDF, images (PNG, JPG), Office documents (Word, Excel, PowerPoint) and ZIP.",
14
15
  "invalidFileName": "This file name isn't allowed. Rename the file and try again.",
@@ -65,9 +66,15 @@
65
66
  "validation": {
66
67
  "required": "This field is required",
67
68
  "invalid": "This field is invalid",
68
- "nameFormat": "Enter a valid name (letters, spaces, apostrophes and hyphens only)",
69
+ "nameFormat": "Use only letters, spaces, apostrophes and hyphens",
69
70
  "nameMinLength": "Name must be at least {min} characters",
71
+ "numericOnly": "Use digits only, no letters or symbols",
70
72
  "numericRange": "Enter a value between {min} and {max}",
71
- "emailFormat": "Enter a valid email"
73
+ "alphanumericOnly": "Use letters and numbers only",
74
+ "minLength": "Must be at least {min} characters",
75
+ "maxLength": "Cannot exceed {max} characters",
76
+ "emailFormat": "Enter a valid email (e.g. name@company.com)",
77
+ "urlFormat": "Enter a valid website (e.g. company.com)",
78
+ "phoneFormat": "Use digits only for the phone number"
72
79
  }
73
80
  }
@@ -9,6 +9,7 @@
9
9
  "badExtensionQuestionnaire": "El cuestionario debe ser un archivo PDF o HTML.",
10
10
  "tooLarge": "El archivo supera el tamaño máximo de 90 MB.",
11
11
  "tooLargeQuestionnaire": "El archivo supera el tamaño máximo de 5 MB.",
12
+ "empty": "El archivo está vacío. Selecciona un archivo con contenido.",
12
13
  "rejected": "El documento fue rechazado porque su contenido no corresponde a un formato permitido. Vuelve a subirlo.",
13
14
  "invalidFileType": "Tipo de archivo no permitido. Formatos aceptados: PDF, imágenes (PNG, JPG), documentos de Office (Word, Excel, PowerPoint) y ZIP.",
14
15
  "invalidFileName": "El nombre del archivo no es válido. Renómbralo e inténtalo de nuevo.",
@@ -65,9 +66,15 @@
65
66
  "validation": {
66
67
  "required": "Este campo es requerido",
67
68
  "invalid": "Este campo es inválido",
68
- "nameFormat": "Ingresa un nombre válido (solo letras, espacios, apóstrofes y guiones)",
69
+ "nameFormat": "Usa solo letras, espacios, apóstrofes y guiones",
69
70
  "nameMinLength": "El nombre debe tener al menos {min} caracteres",
71
+ "numericOnly": "Usa solo números, sin letras ni símbolos",
70
72
  "numericRange": "Ingresa un valor entre {min} y {max}",
71
- "emailFormat": "Ingresa un correo válido"
73
+ "alphanumericOnly": "Usa solo letras y números",
74
+ "minLength": "Debe tener al menos {min} caracteres",
75
+ "maxLength": "No puede tener más de {max} caracteres",
76
+ "emailFormat": "Ingresa un correo válido (ej. nombre@empresa.com)",
77
+ "urlFormat": "Ingresa un sitio web válido (ej. empresa.com)",
78
+ "phoneFormat": "Usa solo números en el teléfono"
72
79
  }
73
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobre-npm/library-onboarding-core",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "Shared configurations and resources for onboarding MFEs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",