@experts_hub/shared 1.0.283 → 1.0.284
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/dist/decorators/index.d.ts +1 -0
- package/dist/decorators/is-business-email.decorator.d.ts +7 -0
- package/dist/index.js +618 -574
- package/dist/index.mjs +48 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -310,6 +310,52 @@ function IsValidMobileNumber(validationOptions) {
|
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
+
// src/decorators/is-business-email.decorator.ts
|
|
314
|
+
import {
|
|
315
|
+
registerDecorator as registerDecorator3,
|
|
316
|
+
ValidatorConstraint as ValidatorConstraint3
|
|
317
|
+
} from "class-validator";
|
|
318
|
+
var IsBusinessEmailConstraint = class {
|
|
319
|
+
constructor() {
|
|
320
|
+
this.blockedDomains = [
|
|
321
|
+
"gmail.com",
|
|
322
|
+
"yahoo.com",
|
|
323
|
+
"hotmail.com",
|
|
324
|
+
"yopmail.com",
|
|
325
|
+
"outlook.com",
|
|
326
|
+
"aol.com",
|
|
327
|
+
"mail.com",
|
|
328
|
+
"zoho.com",
|
|
329
|
+
"protonmail.com",
|
|
330
|
+
"icloud.com"
|
|
331
|
+
];
|
|
332
|
+
}
|
|
333
|
+
validate(value) {
|
|
334
|
+
if (typeof value !== "string") return false;
|
|
335
|
+
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
336
|
+
if (!emailRegex.test(value)) return false;
|
|
337
|
+
const domain = value.split("@")[1].toLowerCase();
|
|
338
|
+
return !this.blockedDomains.includes(domain);
|
|
339
|
+
}
|
|
340
|
+
defaultMessage(args) {
|
|
341
|
+
return "Please enter a valid business email address. Personal email domains are not allowed.";
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
IsBusinessEmailConstraint = __decorateClass([
|
|
345
|
+
ValidatorConstraint3({ async: false })
|
|
346
|
+
], IsBusinessEmailConstraint);
|
|
347
|
+
function IsBusinessEmail(validationOptions) {
|
|
348
|
+
return function(object, propertyName) {
|
|
349
|
+
registerDecorator3({
|
|
350
|
+
target: object.constructor,
|
|
351
|
+
propertyName,
|
|
352
|
+
options: validationOptions,
|
|
353
|
+
constraints: [],
|
|
354
|
+
validator: IsBusinessEmailConstraint
|
|
355
|
+
});
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
|
|
313
359
|
// src/modules/onboarding/dto/freelancer-create-account.dto.ts
|
|
314
360
|
var FreelancerCreateAccountDto = class {
|
|
315
361
|
};
|
|
@@ -539,7 +585,8 @@ __decorateClass([
|
|
|
539
585
|
], ClientCreateAccountDto.prototype, "lastName", 2);
|
|
540
586
|
__decorateClass([
|
|
541
587
|
IsNotEmpty20({ message: "Please enter email." }),
|
|
542
|
-
IsEmail3()
|
|
588
|
+
IsEmail3(),
|
|
589
|
+
IsBusinessEmail()
|
|
543
590
|
], ClientCreateAccountDto.prototype, "email", 2);
|
|
544
591
|
__decorateClass([
|
|
545
592
|
IsNotEmpty20({ message: "Please enter company name." }),
|