@riocrypto/common 1.0.1382 → 1.0.1384

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.
@@ -4,9 +4,15 @@ exports.getUserName = void 0;
4
4
  const user_type_1 = require("../types/user-type");
5
5
  const getUserName = (user) => {
6
6
  if (user.type === user_type_1.UserType.Business) {
7
+ if (!user.businessData) {
8
+ return "Anonymous Business";
9
+ }
7
10
  return user.businessData.businessName;
8
11
  }
9
12
  else {
13
+ if (!user.individualData) {
14
+ return "Anonymous Individual";
15
+ }
10
16
  let name = user.individualData.firstName;
11
17
  if (user.individualData.middleName) {
12
18
  name += ` ${user.individualData.middleName}`;
@@ -10,7 +10,7 @@ const validateIndividualName = (name, label) => {
10
10
  };
11
11
  }
12
12
  // Check character pattern
13
- if (!/^[A-Za-z '-]+$/.test(trimmedName)) {
13
+ if (!/^[\p{L} \'-]+$/u.test(trimmedName)) {
14
14
  return {
15
15
  isValid: false,
16
16
  message: `${label} can only contain alphabets, spaces, hyphens, and apostrophes`,
@@ -13,5 +13,6 @@ export declare enum UserAttribute {
13
13
  shortQuote = "shortQuote",
14
14
  needsAddressApproval = "needsAddressApproval",
15
15
  canPriceMatch = "canPriceMatch",
16
- doNotSendOrderConfirmationEmail = "doNotSendOrderConfirmationEmail"
16
+ doNotSendOrderConfirmationEmail = "doNotSendOrderConfirmationEmail",
17
+ doNotSendOnboardingEmails = "doNotSendOnboardingEmails"
17
18
  }
@@ -18,4 +18,5 @@ var UserAttribute;
18
18
  UserAttribute["needsAddressApproval"] = "needsAddressApproval";
19
19
  UserAttribute["canPriceMatch"] = "canPriceMatch";
20
20
  UserAttribute["doNotSendOrderConfirmationEmail"] = "doNotSendOrderConfirmationEmail";
21
+ UserAttribute["doNotSendOnboardingEmails"] = "doNotSendOnboardingEmails";
21
22
  })(UserAttribute = exports.UserAttribute || (exports.UserAttribute = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.1382",
3
+ "version": "1.0.1384",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",