@experts_hub/shared 1.0.283 → 1.0.285

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/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." }),
@@ -659,8 +706,7 @@ import {
659
706
  IsNotEmpty as IsNotEmpty23,
660
707
  IsEmail as IsEmail4,
661
708
  Length as Length2,
662
- IsUrl as IsUrl2,
663
- Matches as Matches5
709
+ IsUrl as IsUrl2
664
710
  } from "class-validator";
665
711
  var UpdateCompanyProfileDto = class {
666
712
  };
@@ -684,11 +730,12 @@ __decorateClass([
684
730
  IsNotEmpty23({ message: "Please enter mobile code." }),
685
731
  IsString9({ message: "Mobile Code must be a string" })
686
732
  ], UpdateCompanyProfileDto.prototype, "mobileCode", 2);
733
+ // @Matches(/^(\+1\s?)?(\(?\d{3}\)?[\s.-]?)?\d{3}[\s.-]?\d{4}$/, {
734
+ // message: "Please enter a valid US phone number",
735
+ // })
687
736
  __decorateClass([
688
737
  IsNotEmpty23({ message: "Please enter phone number." }),
689
- Matches5(/^(\+1\s?)?(\(?\d{3}\)?[\s.-]?)?\d{3}[\s.-]?\d{4}$/, {
690
- message: "Please enter a valid US phone number"
691
- })
738
+ IsString9({ message: "Please enter valid phone number." })
692
739
  ], UpdateCompanyProfileDto.prototype, "phoneNumber", 2);
693
740
  __decorateClass([
694
741
  IsNotEmpty23({ message: "Please enter email." }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@experts_hub/shared",
3
- "version": "1.0.283",
3
+ "version": "1.0.285",
4
4
  "description": "Shared DTOs, interfaces, and utilities for experts hub applications",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",