@experts_hub/shared 1.0.251 → 1.0.253
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-valid-mobile-number.decorator.d.ts +6 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +592 -557
- package/dist/index.mjs +43 -5
- package/dist/modules/geographic/pattern/pattern.d.ts +1 -0
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -260,6 +260,43 @@ IfscOrOtherFieldsConstraint = __decorateClass([
|
|
|
260
260
|
ValidatorConstraint({ async: false })
|
|
261
261
|
], IfscOrOtherFieldsConstraint);
|
|
262
262
|
|
|
263
|
+
// src/decorators/is-valid-mobile-number.decorator.ts
|
|
264
|
+
import {
|
|
265
|
+
ValidatorConstraint as ValidatorConstraint2,
|
|
266
|
+
registerDecorator as registerDecorator2
|
|
267
|
+
} from "class-validator";
|
|
268
|
+
import { parsePhoneNumberFromString } from "libphonenumber-js";
|
|
269
|
+
var IsValidMobileNumberConstraint = class {
|
|
270
|
+
validate(mobile, args) {
|
|
271
|
+
const object = args.object;
|
|
272
|
+
const mobileCode = object.mobileCode;
|
|
273
|
+
if (!mobileCode || !mobile) return false;
|
|
274
|
+
try {
|
|
275
|
+
const phoneNumber = parsePhoneNumberFromString(mobileCode + mobile);
|
|
276
|
+
return phoneNumber?.isValid() ?? false;
|
|
277
|
+
} catch {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
defaultMessage(args) {
|
|
282
|
+
return "Please enter a valid mobile number for the selected country code.";
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
IsValidMobileNumberConstraint = __decorateClass([
|
|
286
|
+
ValidatorConstraint2({ name: "isValidMobileNumber", async: false })
|
|
287
|
+
], IsValidMobileNumberConstraint);
|
|
288
|
+
function IsValidMobileNumber(validationOptions) {
|
|
289
|
+
return function(object, propertyName) {
|
|
290
|
+
registerDecorator2({
|
|
291
|
+
name: "isValidMobileNumber",
|
|
292
|
+
target: object.constructor,
|
|
293
|
+
propertyName,
|
|
294
|
+
options: validationOptions,
|
|
295
|
+
validator: IsValidMobileNumberConstraint
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
263
300
|
// src/modules/onboarding/dto/freelancer-create-account.dto.ts
|
|
264
301
|
var FreelancerCreateAccountDto = class {
|
|
265
302
|
};
|
|
@@ -273,13 +310,13 @@ __decorateClass([
|
|
|
273
310
|
], FreelancerCreateAccountDto.prototype, "email", 2);
|
|
274
311
|
__decorateClass([
|
|
275
312
|
IsNotEmpty9({ message: "Please enter mobile code." }),
|
|
276
|
-
Matches3(
|
|
313
|
+
Matches3(/^\+\d{1,4}$/, {
|
|
314
|
+
message: "Please enter a valid country mobile code (e.g., +91, +1, +44)."
|
|
315
|
+
})
|
|
277
316
|
], FreelancerCreateAccountDto.prototype, "mobileCode", 2);
|
|
278
317
|
__decorateClass([
|
|
279
318
|
IsNotEmpty9({ message: "Please enter mobile number." }),
|
|
280
|
-
|
|
281
|
-
message: "Please enter a valid US mobile number"
|
|
282
|
-
})
|
|
319
|
+
IsValidMobileNumber({ message: "Mobile number is not valid for the selected country code." })
|
|
283
320
|
], FreelancerCreateAccountDto.prototype, "mobile", 2);
|
|
284
321
|
__decorateClass([
|
|
285
322
|
IsNotEmpty9({ message: "Please enter password." }),
|
|
@@ -4135,7 +4172,8 @@ __decorateClass([
|
|
|
4135
4172
|
|
|
4136
4173
|
// src/modules/geographic/pattern/pattern.ts
|
|
4137
4174
|
var COUNTRY_PATTERN = {
|
|
4138
|
-
fetchCountryDropdown: "fetch.country.dropdown"
|
|
4175
|
+
fetchCountryDropdown: "fetch.country.dropdown",
|
|
4176
|
+
fetchCountryPhoneCodeDropdown: "fetch.country.phone.code.dropdown"
|
|
4139
4177
|
};
|
|
4140
4178
|
var STATE_PATTERN = {
|
|
4141
4179
|
fetchStateDropdown: "fetch.state.dropdown"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@experts_hub/shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.253",
|
|
4
4
|
"description": "Shared DTOs, interfaces, and utilities for experts hub applications",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@nestjs/swagger": "^11.1.2",
|
|
54
54
|
"@nestjs/typeorm": "^11.0.0",
|
|
55
55
|
"dotenv": "^16.5.0",
|
|
56
|
+
"libphonenumber-js": "^1.12.9",
|
|
56
57
|
"typeorm": "^0.3.22"
|
|
57
58
|
}
|
|
58
59
|
}
|