@optimiser/common 1.0.281 → 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.
@@ -224,7 +224,8 @@ declare function GetMailFromString(fromUser: string): string;
224
224
  /**
225
225
  * TODO: Return On behalf String in Calendar Invitation mails
226
226
  * @param fromUser From User Name
227
+ * @param fromEmail From User Email
227
228
  * @returns string
228
229
  */
229
- declare function InvitationMailReplyContent(fromUser: string): string;
230
+ declare function InvitationMailReplyContent(fromUser: string, fromEmail: string): string;
230
231
  export { CheckForWhiteListedDomain, ReturnJsonResponse, ConvertFileByteSize, GetObjectByKeyValueFromList, IsEqualArrays, IsEqualValue, CheckUserProfileField, GetPageFieldData, GetPageObjectSchema, GetFieldDetail, UpdateRecentViewObject, UpdateRecentViewFields, SyncChildObjectData, SyncParentObjectData, DeleteFieldInOtherCollection, SyncFieldInSameCollection, SyncFieldInSameCollectionByObjectID, SyncFieldInSameCollectionByObjectIDWithPromise, SyncFieldInOtherCollection, SyncUserInOtherCollection, BuildLookupDataField, CheckDataBeforeAdd, CheckDataBeforeUpdate, BuildGridFieldProjection, BuildFieldProjection, BuildLookupFieldProjection, FilterConditions, GirdHeaderFilters, FieldsGridHeaderFilters, AddLog, CheckFilterFieldsProjection, VerifyEmailPassword, GetMyTeamUsers, ExtractChildUsersTree, GetMaxKeyValueListSchema, VerifyAWSEmailConfig, GenerateId, SyncUserDetailsWithMasterDB, SignoutUserFromAllDevices, SignoutUsersWithPromise, SignoutMultipleUsersFromAllDevices, UserLicenseConsumeCalculate, sendMailWithUserAccount, GetEmailClientConfigs, GetCompanyEncryptionKey, ExecuteDynamicDMLQuery, ExecuteDynamicDQLQuery, GetUserProfilePermissions, MakeUserPasswordInvalid, ConvertJsonToXLXS, SendResetPasswordMail, SendMailToSupport, MailTemplateStructure, SendMailToCustomer, parseMSPCookie, GetIPDetailsFromReq, isEmptyObj, SyncListSchemaFieldInOtherCollection, UpdateTagCountAfterDelete, SyncTagCountAfterUpdate, ReactivateFieldInOtherCollection, SyncUserLicenceConsumedCount, BroadCastEventToAllCompanyUsers, CheckDataPermission, SyncCompanyLicenceInMasterCompanyAfterAdd, NextServiceDateForDashboard, CheckDateNotInPast, GetWeekDayByDayAndOccurance, GetInterValFromOccurance, GetWeekDayInfoInMonth, GetDayIndex, RemoveFieldsFromFilters, GetUserProfile, CheckPageAuthentication, ErrorHandlerForServices, CheckCaptcha, ValidateSanitizeUserInput, CreateBanquetingVATSettingsData, CheckReportFolderAccess, GetMailFromString, InvitationMailReplyContent };
@@ -1808,7 +1808,8 @@ function BuildGridFieldProjection(project, field, group) {
1808
1808
  $reduce: {
1809
1809
  input: { $concatArrays: searchConcatArry },
1810
1810
  initialValue: "",
1811
- in: { $concat: ["$$value", "$$this"] }
1811
+ //in: { $concat: ["$$value", "$$this"] } // Commented by and below line was added by Shahzaib, make int to string
1812
+ in: { $concat: ["$$value", { $toString: "$$this" }] }
1812
1813
  }
1813
1814
  };
1814
1815
  break;
@@ -3990,12 +3991,12 @@ exports.GetDayIndex = GetDayIndex;
3990
3991
  function GetUserProfile(msp_d, db, mdb, next) {
3991
3992
  var _a;
3992
3993
  return __awaiter(this, void 0, void 0, function () {
3993
- var userData, userProfile_1, error_3, objectIDs_1, modules_1, licenceDetail, moduleList, _loop_17, i, error_4;
3994
+ var userData, userProfile_1, error_3, objectIDs_1, modules_1, licenceDetail, companylicenceDetail, receptionLicense, moduleList, _loop_17, i, error_4;
3994
3995
  return __generator(this, function (_b) {
3995
3996
  switch (_b.label) {
3996
3997
  case 0:
3997
- _b.trys.push([0, 10, , 11]);
3998
- return [4 /*yield*/, db.collection("User").findOne({ '_id': new mongodb_1.ObjectId(msp_d.ui), IsActive: true }, { projection: { 'LicenceDetail': 1 } })];
3998
+ _b.trys.push([0, 12, , 13]);
3999
+ return [4 /*yield*/, db.collection("User").findOne({ '_id': new mongodb_1.ObjectId(msp_d.ui), IsActive: true }, { projection: { 'LicenceDetail': 1, 'CompanyID': 1 } })];
3999
4000
  case 1:
4000
4001
  userData = _b.sent();
4001
4002
  if (!userData) {
@@ -4034,7 +4035,7 @@ function GetUserProfile(msp_d, db, mdb, next) {
4034
4035
  if (!(!userProfile_1 || userProfile_1.length <= 0)) return [3 /*break*/, 6];
4035
4036
  return [2 /*return*/, { statusCode: 500, message: "User's profile data not found.", data: {} }];
4036
4037
  case 6:
4037
- if (!(userData.LicenceDetail && userData.LicenceDetail.length > 0)) return [3 /*break*/, 8];
4038
+ if (!(userData.LicenceDetail && userData.LicenceDetail.length > 0)) return [3 /*break*/, 10];
4038
4039
  objectIDs_1 = [];
4039
4040
  userData.LicenceDetail.forEach(function (licenceDetail) {
4040
4041
  if (licenceDetail.Status == "active")
@@ -4044,6 +4045,22 @@ function GetUserProfile(msp_d, db, mdb, next) {
4044
4045
  return [4 /*yield*/, mdb.collection("Licences").find({ '_id': { $in: objectIDs_1 }, 'Status': 'active', 'IsActive': true }).toArray()];
4045
4046
  case 7:
4046
4047
  licenceDetail = _b.sent();
4048
+ if (!(userData && userData.CompanyID)) return [3 /*break*/, 9];
4049
+ return [4 /*yield*/, mdb.collection("CompanyLicence").find({ 'CompanyID': userData.CompanyID, 'Status': 'active', 'IsActive': true }).toArray()];
4050
+ case 8:
4051
+ companylicenceDetail = _b.sent();
4052
+ if (companylicenceDetail && companylicenceDetail.length > 0) {
4053
+ receptionLicense = companylicenceDetail.find(function (licence) { return licence.LicenceName === "Reception" && licence.LicenceType === "App"; });
4054
+ if (receptionLicense) {
4055
+ licenceDetail.push({
4056
+ "Modules": [
4057
+ "reception"
4058
+ ]
4059
+ });
4060
+ }
4061
+ }
4062
+ _b.label = 9;
4063
+ case 9:
4047
4064
  if (licenceDetail && licenceDetail.length > 0) {
4048
4065
  licenceDetail.forEach(function (licence) {
4049
4066
  modules_1 = modules_1.concat(licence.Modules);
@@ -4072,15 +4089,15 @@ function GetUserProfile(msp_d, db, mdb, next) {
4072
4089
  else {
4073
4090
  return [2 /*return*/, { statusCode: 200, message: "Licence data is not found in Master database.", data: {} }];
4074
4091
  }
4075
- return [3 /*break*/, 9];
4076
- case 8: return [2 /*return*/, { statusCode: 200, message: "There is no licence assigned to this user, please contact your administrator.", data: {} }];
4077
- case 9: return [3 /*break*/, 11];
4078
- case 10:
4092
+ return [3 /*break*/, 11];
4093
+ case 10: return [2 /*return*/, { statusCode: 200, message: "There is no licence assigned to this user, please contact your administrator.", data: {} }];
4094
+ case 11: return [3 /*break*/, 13];
4095
+ case 12:
4079
4096
  error_4 = _b.sent();
4080
4097
  console.error("Internal Error in GetUserProfile Utility function : " + error_4);
4081
4098
  next(error_4);
4082
- return [3 /*break*/, 11];
4083
- case 11: return [2 /*return*/];
4099
+ return [3 /*break*/, 13];
4100
+ case 13: return [2 /*return*/];
4084
4101
  }
4085
4102
  });
4086
4103
  });
@@ -4418,9 +4435,10 @@ exports.GetMailFromString = GetMailFromString;
4418
4435
  /**
4419
4436
  * TODO: Return On behalf String in Calendar Invitation mails
4420
4437
  * @param fromUser From User Name
4438
+ * @param fromEmail From User Email
4421
4439
  * @returns string
4422
4440
  */
4423
- function InvitationMailReplyContent(fromUser) {
4424
- return "Please do not 'reply' to this email as it is an automated message and replies are routed to an unmonitored mailbox. If you wish to propose an alternative time, or send a message, please contact " + fromUser + " directly.";
4441
+ function InvitationMailReplyContent(fromUser, fromEmail) {
4442
+ return "Please do not 'reply' to this email as it is an automated message and replies are routed to an unmonitored mailbox. If you wish to propose an alternative time, or send a message, please contact " + fromUser + " at " + fromEmail + " directly.";
4425
4443
  }
4426
4444
  exports.InvitationMailReplyContent = InvitationMailReplyContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.281",
3
+ "version": "1.0.284",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {