@forwardslashns/taskit-validation-messages 1.10.43 → 1.10.45

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.
@@ -212,7 +212,7 @@ exports.TEMPLATE_INFORMATION = (0, validation_message_types_1.defineValidationFe
212
212
  },
213
213
  PARENT_FILING_CANNOT_FILE_UNDER_PARENT: {
214
214
  severity: validation_message_types_1.VALIDATION_SEVERITY.ERROR,
215
- message: `{parentFilingTemplateName} is set as 'Filing under parent' and cannot be a parent template. Please select a different parent template.`,
215
+ message: `{parentFilingTemplateName} is set as 'Files under parent' and cannot be a parent template. Please select a different parent template.`,
216
216
  params: ['parentFilingTemplateName'],
217
217
  affectedFields: ['filesUnder'],
218
218
  },
@@ -251,7 +251,7 @@ exports.TEMPLATE_INFORMATION = (0, validation_message_types_1.defineValidationFe
251
251
  },
252
252
  TAX_PAYMENT_FILING_MUST_FILE_SEPARATELY: {
253
253
  severity: validation_message_types_1.VALIDATION_SEVERITY.ERROR,
254
- message: `Tax payments can only be associated with filings that file separately. {filingTemplateName} is set as 'Filing under parent'. Please select a different filing template.`,
254
+ message: `Tax payments can only be associated with filings that file separately. {filingTemplateName} is set as 'Files under parent'. Please select a different filing template.`,
255
255
  params: ['filingTemplateName'],
256
256
  affectedFields: ['taxPaymentFiling'],
257
257
  },
@@ -284,7 +284,7 @@ exports.TEMPLATE_INFORMATION = (0, validation_message_types_1.defineValidationFe
284
284
  },
285
285
  MAIN_FILING_MUST_FILE_SEPARATELY: {
286
286
  severity: validation_message_types_1.VALIDATION_SEVERITY.ERROR,
287
- message: `Tax payments can only be associated with filings that file separately. {mainFilingName} is set as 'Filing under parent'. Please select a different filing template.`,
287
+ message: `Tax payments can only be associated with filings that file separately. {mainFilingName} is set as 'Files under parent'. Please select a different filing template.`,
288
288
  params: ['mainFilingName'],
289
289
  affectedFields: ['taxPaymentFiling'],
290
290
  },
@@ -1 +1 @@
1
- {"version":3,"file":"validation-message.formatter.d.ts","sourceRoot":"","sources":["../../src/validation/validation-message.formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAA+B,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAE7F,KAAK,QAAQ,GAAG,MAAM,OAAO,mBAAmB,CAAC;AACjD,KAAK,SAAS,CAAC,CAAC,SAAS,QAAQ,IAAI,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3E,KAAK,kBAAkB,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;IAC/G,MAAM,EAAE,MAAM,CAAC,SAAS,SAAS,MAAM,EAAE,CAAC;CAC3C,GACG,CAAC,GACD,EAAE,CAAC;AACP,KAAK,aAAa,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE,IAAI;KAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM;CAAE,CAAC;AAE/E,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,kBAAkB,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,WAAW,SAAS,QAAQ,EAAE,gBAAgB,SAAS,SAAS,CAAC,WAAW,CAAC,EAChH,aAAa,GAAG,WAAW,IAAI,gBAAgB,GAAG,MAAM,EAAE,EAC1D,SAAS,aAAa,CAAC,kBAAkB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,KACxE,uBAqDF,CAAC"}
1
+ {"version":3,"file":"validation-message.formatter.d.ts","sourceRoot":"","sources":["../../src/validation/validation-message.formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAA+B,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAU7F,KAAK,QAAQ,GAAG,MAAM,OAAO,mBAAmB,CAAC;AACjD,KAAK,SAAS,CAAC,CAAC,SAAS,QAAQ,IAAI,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3E,KAAK,kBAAkB,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;IAC/G,MAAM,EAAE,MAAM,CAAC,SAAS,SAAS,MAAM,EAAE,CAAC;CAC3C,GACG,CAAC,GACD,EAAE,CAAC;AACP,KAAK,aAAa,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE,IAAI;KAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM;CAAE,CAAC;AAE/E,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,kBAAkB,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,WAAW,SAAS,QAAQ,EAAE,gBAAgB,SAAS,SAAS,CAAC,WAAW,CAAC,EAChH,aAAa,GAAG,WAAW,IAAI,gBAAgB,GAAG,MAAM,EAAE,EAC1D,SAAS,aAAa,CAAC,kBAAkB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,KACxE,uBAqDF,CAAC"}
@@ -2,6 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getValidationMessage = void 0;
4
4
  const validation_messages_1 = require("./validation-messages");
5
+ const escapeHtml = (text) => text
6
+ .replaceAll('&', '&')
7
+ .replaceAll('<', '&lt;')
8
+ .replaceAll('>', '&gt;')
9
+ .replaceAll('"', '&quot;')
10
+ .replaceAll("'", '&#x27;');
5
11
  const getValidationMessage = (combinedKey, params) => {
6
12
  const parts = combinedKey.split('.');
7
13
  const feature = parts[0];
@@ -36,7 +42,7 @@ const getValidationMessage = (combinedKey, params) => {
36
42
  }
37
43
  }
38
44
  expectedParams.forEach((param) => {
39
- message = message.replaceAll(`{${param}}`, inputParams[param]);
45
+ message = message.replaceAll(`{${param}}`, `<b>${escapeHtml(inputParams[param])}</b>`);
40
46
  });
41
47
  return {
42
48
  content: message,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forwardslashns/taskit-validation-messages",
3
- "version": "1.10.43",
3
+ "version": "1.10.45",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "commonjs",
@@ -216,7 +216,7 @@ export const TEMPLATE_INFORMATION = defineValidationFeatureMessages({
216
216
  },
217
217
  PARENT_FILING_CANNOT_FILE_UNDER_PARENT: {
218
218
  severity: VALIDATION_SEVERITY.ERROR,
219
- message: `{parentFilingTemplateName} is set as 'Filing under parent' and cannot be a parent template. Please select a different parent template.`,
219
+ message: `{parentFilingTemplateName} is set as 'Files under parent' and cannot be a parent template. Please select a different parent template.`,
220
220
  params: ['parentFilingTemplateName'],
221
221
  affectedFields: ['filesUnder'],
222
222
  },
@@ -255,7 +255,7 @@ export const TEMPLATE_INFORMATION = defineValidationFeatureMessages({
255
255
  },
256
256
  TAX_PAYMENT_FILING_MUST_FILE_SEPARATELY: {
257
257
  severity: VALIDATION_SEVERITY.ERROR,
258
- message: `Tax payments can only be associated with filings that file separately. {filingTemplateName} is set as 'Filing under parent'. Please select a different filing template.`,
258
+ message: `Tax payments can only be associated with filings that file separately. {filingTemplateName} is set as 'Files under parent'. Please select a different filing template.`,
259
259
  params: ['filingTemplateName'],
260
260
  affectedFields: ['taxPaymentFiling'],
261
261
  },
@@ -288,7 +288,7 @@ export const TEMPLATE_INFORMATION = defineValidationFeatureMessages({
288
288
  },
289
289
  MAIN_FILING_MUST_FILE_SEPARATELY: {
290
290
  severity: VALIDATION_SEVERITY.ERROR,
291
- message: `Tax payments can only be associated with filings that file separately. {mainFilingName} is set as 'Filing under parent'. Please select a different filing template.`,
291
+ message: `Tax payments can only be associated with filings that file separately. {mainFilingName} is set as 'Files under parent'. Please select a different filing template.`,
292
292
  params: ['mainFilingName'],
293
293
  affectedFields: ['taxPaymentFiling'],
294
294
  },
@@ -1,6 +1,14 @@
1
1
  import { VALIDATION_MESSAGES } from './validation-messages';
2
2
  import { ValidationMessageDefinition, ValidationSeverity } from './validation-message.types';
3
3
 
4
+ const escapeHtml = (text: string): string =>
5
+ text
6
+ .replaceAll('&', '&amp;')
7
+ .replaceAll('<', '&lt;')
8
+ .replaceAll('>', '&gt;')
9
+ .replaceAll('"', '&quot;')
10
+ .replaceAll("'", '&#x27;');
11
+
4
12
  type Features = keyof typeof VALIDATION_MESSAGES;
5
13
  type ErrorType<F extends Features> = keyof (typeof VALIDATION_MESSAGES)[F];
6
14
  type ErrorMessageParams<F extends Features, E extends ErrorType<F>> = (typeof VALIDATION_MESSAGES)[F][E] extends {
@@ -64,7 +72,7 @@ export const getValidationMessage = <FeatureType extends Features, FeatureErrorT
64
72
  }
65
73
 
66
74
  expectedParams.forEach((param) => {
67
- message = message.replaceAll(`{${param}}`, (inputParams as Record<string, string>)[param]);
75
+ message = message.replaceAll(`{${param}}`, `<b>${escapeHtml((inputParams as Record<string, string>)[param])}</b>`);
68
76
  });
69
77
 
70
78
  return {