@optimiser/common 1.0.448 → 1.0.450

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.
@@ -409,7 +409,7 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
409
409
  var getFiscalMonthIndex = moment_1.default.monthsShort().findIndex(function (month) { return month === fiscalMonth; });
410
410
  // GET FISCAL MONTH INDEX
411
411
  // if (operator.includes("Fiscal")) {
412
- if (operator.toLowerCase().includes("fiscal") || ["Year to Date", "year-to-date"].includes(operator)) {
412
+ if (operator.toLowerCase().includes("fiscal") || ["Year to Date", "year-to-date", "Year to Date Last Year", "year-to-date-last-year"].includes(operator)) {
413
413
  if (fiscalFrom === "End") {
414
414
  fiscalMonth = momentObj.clone().month(fiscalMonth).add(1, "months").format('MMM'); // Modify FiscalMonth in FiscalFrom - End
415
415
  }
@@ -684,6 +684,31 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
684
684
  }
685
685
  }
686
686
  break;
687
+ case "Year to Date Last Year":
688
+ case "year-to-date-last-year":
689
+ endDate = momentObj.clone().subtract(1, "years").format(requiredDateFormat);
690
+ if (fiscalFrom === "Start") {
691
+ if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex <= momentObj.clone().month()) {
692
+ startDate = (0, moment_1.default)(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(12, "months").startOf('month').format(requiredDateFormat);
693
+ }
694
+ else {
695
+ startDate = (0, moment_1.default)(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(24, "months").startOf('month').format(requiredDateFormat);
696
+ }
697
+ }
698
+ else {
699
+ if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex < momentObj.clone().month() || getFiscalMonthIndex == 11) {
700
+ startDate = (0, moment_1.default)(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(12, "months").startOf('month').format(requiredDateFormat);
701
+ }
702
+ else {
703
+ startDate = (0, moment_1.default)(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(24, "months").startOf('month').format(requiredDateFormat);
704
+ }
705
+ }
706
+ break;
707
+ case "This Month Last Year":
708
+ case "this-month-last-year":
709
+ startDate = momentObj.clone().subtract(12, "months").startOf('month').format(requiredDateFormat);
710
+ endDate = momentObj.clone().subtract(12, "months").endOf('month').format(requiredDateFormat);
711
+ break;
687
712
  default:
688
713
  break;
689
714
  }
@@ -80,6 +80,15 @@ var __rest = (this && this.__rest) || function (s, e) {
80
80
  }
81
81
  return t;
82
82
  };
83
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
84
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
85
+ if (ar || !(i in from)) {
86
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
87
+ ar[i] = from[i];
88
+ }
89
+ }
90
+ return to.concat(ar || Array.prototype.slice.call(from));
91
+ };
83
92
  var __importDefault = (this && this.__importDefault) || function (mod) {
84
93
  return (mod && mod.__esModule) ? mod : { "default": mod };
85
94
  };
@@ -5035,18 +5044,21 @@ function IsAnotherObjectField(pageData, fieldName) {
5035
5044
  return false;
5036
5045
  }
5037
5046
  var CustomSanitizeHtml = function (dirtyHtml, uiDataType) {
5038
- // Define default sanitization options
5039
5047
  var defaultOptions = {
5040
- allowedTags: sanitize_html_1.default.defaults.allowedTags || false, // Use an empty array if defaults are unavailable
5041
- allowedAttributes: false
5048
+ allowedTags: __spreadArray(__spreadArray([], (sanitize_html_1.default.defaults.allowedTags || []), true), [
5049
+ 'img' //allow img tag qpc-13026
5050
+ ], false),
5051
+ allowedAttributes: {
5052
+ img: ['src', 'alt', 'title', 'width', 'height'],
5053
+ a: ['href', 'name', 'target']
5054
+ },
5055
+ allowedSchemes: ['http', 'https', 'data'], // allow base64 images if needed
5042
5056
  };
5043
- // Determine sanitization options based on uiDataType
5044
5057
  var sanitizeOptions = (uiDataType === 'texteditor') ? defaultOptions : {};
5045
5058
  try {
5046
- // Sanitize the HTML content
5047
5059
  var sanitizedHtmlContent = (0, sanitize_html_1.default)(dirtyHtml, sanitizeOptions);
5048
5060
  if (uiDataType === 'texteditor') {
5049
- return sanitizedHtmlContent; //Return without replace code fixed QPC-11110 script data save
5061
+ return sanitizedHtmlContent;
5050
5062
  }
5051
5063
  return sanitizedHtmlContent
5052
5064
  .replace(/&amp;/g, '&')
@@ -5055,7 +5067,7 @@ var CustomSanitizeHtml = function (dirtyHtml, uiDataType) {
5055
5067
  }
5056
5068
  catch (error) {
5057
5069
  console.error('Sanitization failed:', error);
5058
- return ''; // Return empty string or handle error as needed
5070
+ return '';
5059
5071
  }
5060
5072
  };
5061
5073
  /*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.448",
3
+ "version": "1.0.450",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {