@riocrypto/common 1.0.1371 → 1.0.1372

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.
@@ -0,0 +1,4 @@
1
+ export declare const validateBusinessName: (name: string) => {
2
+ isValid: boolean;
3
+ message: string;
4
+ } | undefined;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateBusinessName = void 0;
4
+ const validateBusinessName = (name) => {
5
+ const trimmedName = name.trim();
6
+ if (trimmedName.length < 2 || trimmedName.length > 100) {
7
+ return {
8
+ isValid: false,
9
+ message: `Business name must be between 2 and 100 characters`,
10
+ };
11
+ }
12
+ // Check character pattern
13
+ if (!/^[a-zA-Z0-9\s,'-]*$/.test(trimmedName)) {
14
+ return {
15
+ isValid: false,
16
+ message: `Business name can only contain letters, numbers, spaces, and ,'- characters`,
17
+ };
18
+ }
19
+ };
20
+ exports.validateBusinessName = validateBusinessName;
@@ -0,0 +1,4 @@
1
+ export declare const validateIndividualName: (name: string, label: string) => {
2
+ isValid: boolean;
3
+ message: string;
4
+ } | undefined;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateIndividualName = void 0;
4
+ const validateIndividualName = (name, label) => {
5
+ const trimmedName = name.trim();
6
+ if (trimmedName.length < 1 || trimmedName.length > 50) {
7
+ return {
8
+ isValid: false,
9
+ message: `${label} must be between 1 and 50 characters`,
10
+ };
11
+ }
12
+ // Check character pattern
13
+ if (!/^[A-Za-z '-]+$/.test(trimmedName)) {
14
+ return {
15
+ isValid: false,
16
+ message: `${label} can only contain alphabets, spaces, hyphens, and apostrophes`,
17
+ };
18
+ }
19
+ };
20
+ exports.validateIndividualName = validateIndividualName;
package/build/index.d.ts CHANGED
@@ -252,6 +252,8 @@ export * from "./helpers/alpha-2-to-alpha-3";
252
252
  export * from "./helpers/get-user-name";
253
253
  export * from "./helpers/get-highest-onboarding-status";
254
254
  export * from "./helpers/get-auth-name";
255
+ export * from "./helpers/validate-individual-name";
256
+ export * from "./helpers/validate-business-name";
255
257
  export * from "./clients/rio-client";
256
258
  export * from "./clients/rio-admin-client";
257
259
  export * from "./constants/mexico-fiscal-regimens";
package/build/index.js CHANGED
@@ -268,6 +268,8 @@ __exportStar(require("./helpers/alpha-2-to-alpha-3"), exports);
268
268
  __exportStar(require("./helpers/get-user-name"), exports);
269
269
  __exportStar(require("./helpers/get-highest-onboarding-status"), exports);
270
270
  __exportStar(require("./helpers/get-auth-name"), exports);
271
+ __exportStar(require("./helpers/validate-individual-name"), exports);
272
+ __exportStar(require("./helpers/validate-business-name"), exports);
271
273
  __exportStar(require("./clients/rio-client"), exports);
272
274
  __exportStar(require("./clients/rio-admin-client"), exports);
273
275
  __exportStar(require("./constants/mexico-fiscal-regimens"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.1371",
3
+ "version": "1.0.1372",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",