@alviere/core 0.11.2 → 0.12.0

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
@@ -412,24 +412,8 @@ class Validator {
412
412
  if (!phone || typeof phone !== "string") {
413
413
  return "Please enter a valid phone number.";
414
414
  }
415
- if (!phone.startsWith("+")) {
416
- return "Phone number must start with country code (e.g., +1)";
417
- }
418
- const afterPlus = phone.substring(1);
419
- const countryCodeMatch = afterPlus.match(/^(\d{1,3})/);
420
- if (!countryCodeMatch) {
421
- return "Invalid country code format";
422
- }
423
- const countryCode = countryCodeMatch[1];
424
- const phoneNumber = afterPlus.substring(countryCode.length);
425
- if (phoneNumber.length < 7) {
426
- return "Phone number too short";
427
- }
428
- const totalDigits = countryCode.length + phoneNumber.length;
429
- if (totalDigits < 10 || totalDigits > 15) {
430
- return "Phone number must be between 10 and 15 digits total";
431
- }
432
- return null;
415
+ const e164Regex = /^\+[1-9]\d{1,14}$/;
416
+ return e164Regex.test(phone.trim()) ? null : "Please enter a valid phone number.";
433
417
  }
434
418
  /**
435
419
  * Validates date format and calendar validity
@@ -1054,7 +1038,7 @@ class AccountsGateway extends AlcoreBase {
1054
1038
  }
1055
1039
  async updateAddress(accountUuid, addressUuid, data) {
1056
1040
  const endpoint = `/accounts/${accountUuid}/addresses/${addressUuid}`;
1057
- const response = await this.send("PUT", endpoint, data);
1041
+ const response = await this.send("PATCH", endpoint, data);
1058
1042
  const encrypted = await response.json();
1059
1043
  const decrypted = await this.decrypt(encrypted);
1060
1044
  return throwIfApiError(decrypted);