@hmcts/rpx-xui-common-lib 3.2.8 → 3.2.9

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, EventEmitter, ViewEncapsulation, Input, Output, Injectable, InjectionToken, DOCUMENT, Inject, ViewChild, Pipe, ChangeDetectionStrategy, Directive, ElementRef, NgModule } from '@angular/core';
2
+ import { Component, EventEmitter, ViewEncapsulation, Input, Output, Injectable, InjectionToken, DOCUMENT, Inject, ViewChild, Pipe, ChangeDetectionStrategy, Directive, SecurityContext, ElementRef, NgModule } from '@angular/core';
3
3
  import * as i2 from 'rpx-xui-translation';
4
4
  import { RpxTranslationModule } from 'rpx-xui-translation';
5
5
  import * as i1 from '@angular/common';
@@ -6502,16 +6502,21 @@ function ServiceMessageComponent_Conditional_8_Template(rf, ctx) { if (rf & 1) {
6502
6502
  i0.ɵɵelement(0, "h2", 5);
6503
6503
  } if (rf & 2) {
6504
6504
  const ctx_r0 = i0.ɵɵnextContext();
6505
- i0.ɵɵproperty("innerHTML", ctx_r0.message_cy, i0.ɵɵsanitizeHtml);
6505
+ i0.ɵɵproperty("innerHTML", ctx_r0.sanitizeHtml(ctx_r0.message_cy), i0.ɵɵsanitizeHtml);
6506
6506
  } }
6507
6507
  class ServiceMessageComponent {
6508
- constructor() {
6508
+ constructor(sanitizer) {
6509
+ this.sanitizer = sanitizer;
6509
6510
  this.hideMessage = new EventEmitter();
6510
6511
  }
6511
6512
  onHideMessageEvent(key) {
6512
6513
  this.hideMessage.emit(key);
6513
6514
  }
6514
- static { this.ɵfac = function ServiceMessageComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ServiceMessageComponent)(); }; }
6515
+ // ensure no dangerous HTML is rendered in the service message banner
6516
+ sanitizeHtml(content) {
6517
+ return this.sanitizer.sanitize(SecurityContext.HTML, content ?? '') ?? '';
6518
+ }
6519
+ static { this.ɵfac = function ServiceMessageComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ServiceMessageComponent)(i0.ɵɵdirectiveInject(i2$1.DomSanitizer)); }; }
6515
6520
  static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ServiceMessageComponent, selectors: [["xuilib-service-message"]], inputs: { message_en: "message_en", message_cy: "message_cy", key: "key" }, outputs: { hideMessage: "hideMessage" }, standalone: false, decls: 12, vars: 8, consts: [[1, "hmcts-banner", "hmcts-banner--warning"], ["fill", "currentColor", "role", "img", "aria-label", "hmcts-warning-icon", "focusable", "false", "xmlns", "http://www.w3.org/2000/svg", "viewBox", "0 0 25 25", "height", "25", "width", "25", 1, "hmcts-banner__icon"], ["d", "M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z"], [1, "hmcts-banner__message"], [1, "hmcts-banner__assistive"], [1, "govuk-heading-s", 3, "innerHTML"], ["tabindex", "0", 1, "govuk-link--no-visited-state", 3, "click", "keyup.enter", "routerLink"]], template: function ServiceMessageComponent_Template(rf, ctx) { if (rf & 1) {
6516
6521
  i0.ɵɵelementStart(0, "div", 0);
6517
6522
  i0.ɵɵnamespaceSVG();
@@ -6534,7 +6539,7 @@ class ServiceMessageComponent {
6534
6539
  i0.ɵɵadvance(5);
6535
6540
  i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(6, 4, "Warning"));
6536
6541
  i0.ɵɵadvance(2);
6537
- i0.ɵɵproperty("innerHTML", ctx.message_en, i0.ɵɵsanitizeHtml);
6542
+ i0.ɵɵproperty("innerHTML", ctx.sanitizeHtml(ctx.message_en), i0.ɵɵsanitizeHtml);
6538
6543
  i0.ɵɵadvance();
6539
6544
  i0.ɵɵconditional(ctx.message_cy ? 8 : -1);
6540
6545
  i0.ɵɵadvance(2);
@@ -6543,8 +6548,8 @@ class ServiceMessageComponent {
6543
6548
  }
6544
6549
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ServiceMessageComponent, [{
6545
6550
  type: Component,
6546
- args: [{ selector: 'xuilib-service-message', standalone: false, template: "<div class=\"hmcts-banner hmcts-banner--warning\">\n\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"img\" aria-label=\"hmcts-warning-icon\" focusable=\"false\"\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\">\n <path d=\"M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z\" />\n </svg>\n\n <div class=\"hmcts-banner__message\">\n <span class=\"hmcts-banner__assistive\">{{'Warning' | rpxTranslate}}</span>\n <h2 class=\"govuk-heading-s\" [innerHTML]=\"message_en\"></h2>\n @if (message_cy) {\n <h2 class=\"govuk-heading-s\" [innerHTML]=\"message_cy\"></h2>\n }\n <a [routerLink]=\"\" tabindex=\"0\" class=\"govuk-link--no-visited-state\" (click)=\"onHideMessageEvent(key)\" (keyup.enter)=\"onHideMessageEvent(key)\">{{'Hide message' | rpxTranslate}}</a>\n </div>\n\n</div>", styles: [".govuk-link--no-visited-state{cursor:pointer}\n"] }]
6547
- }], () => [], { message_en: [{
6551
+ args: [{ selector: 'xuilib-service-message', standalone: false, template: "<div class=\"hmcts-banner hmcts-banner--warning\">\n\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"img\" aria-label=\"hmcts-warning-icon\" focusable=\"false\"\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\">\n <path d=\"M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z\" />\n </svg>\n\n <div class=\"hmcts-banner__message\">\n <span class=\"hmcts-banner__assistive\">{{'Warning' | rpxTranslate}}</span>\n <h2 class=\"govuk-heading-s\" [innerHTML]=\"sanitizeHtml(message_en)\"></h2>\n @if (message_cy) {\n <h2 class=\"govuk-heading-s\" [innerHTML]=\"sanitizeHtml(message_cy)\"></h2>\n }\n <a [routerLink]=\"\" tabindex=\"0\" class=\"govuk-link--no-visited-state\" (click)=\"onHideMessageEvent(key)\" (keyup.enter)=\"onHideMessageEvent(key)\">{{'Hide message' | rpxTranslate}}</a>\n </div>\n\n</div>", styles: [".govuk-link--no-visited-state{cursor:pointer}\n"] }]
6552
+ }], () => [{ type: i2$1.DomSanitizer }], { message_en: [{
6548
6553
  type: Input
6549
6554
  }], message_cy: [{
6550
6555
  type: Input
@@ -6553,7 +6558,7 @@ class ServiceMessageComponent {
6553
6558
  }], hideMessage: [{
6554
6559
  type: Output
6555
6560
  }] }); })();
6556
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ServiceMessageComponent, { className: "ServiceMessageComponent", filePath: "lib/components/service-message/service-message.component.ts", lineNumber: 10 }); })();
6561
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ServiceMessageComponent, { className: "ServiceMessageComponent", filePath: "lib/components/service-message/service-message.component.ts", lineNumber: 11 }); })();
6557
6562
 
6558
6563
  function ServiceMessagesComponent_Conditional_0_For_2_Template(rf, ctx) { if (rf & 1) {
6559
6564
  i0.ɵɵelementStart(0, "div", 1);
@@ -7560,7 +7565,7 @@ function TermsAndConditionsComponent_Case_0_Template(rf, ctx) { if (rf & 1) {
7560
7565
  } if (rf & 2) {
7561
7566
  const ctx_r0 = i0.ɵɵnextContext();
7562
7567
  i0.ɵɵadvance();
7563
- i0.ɵɵproperty("innerHTML", i0.ɵɵpipeBind1(2, 1, ctx_r0.document.content), i0.ɵɵsanitizeHtml);
7568
+ i0.ɵɵproperty("innerHTML", ctx_r0.sanitizeHtml(i0.ɵɵpipeBind1(2, 1, ctx_r0.document.content)), i0.ɵɵsanitizeHtml);
7564
7569
  } }
7565
7570
  function TermsAndConditionsComponent_Case_1_Template(rf, ctx) { if (rf & 1) {
7566
7571
  i0.ɵɵelementStart(0, "xuilib-tc-display-plain");
@@ -7582,8 +7587,14 @@ function TermsAndConditionsComponent_Case_2_Template(rf, ctx) { if (rf & 1) {
7582
7587
  i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 1, "An error occured. Please try again."), " ");
7583
7588
  } }
7584
7589
  class TermsAndConditionsComponent {
7585
- constructor() { }
7586
- static { this.ɵfac = function TermsAndConditionsComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TermsAndConditionsComponent)(); }; }
7590
+ constructor(sanitizer) {
7591
+ this.sanitizer = sanitizer;
7592
+ }
7593
+ // ensure no dangerous HTML is rendered in the terms and conditions document
7594
+ sanitizeHtml(content) {
7595
+ return this.sanitizer.sanitize(SecurityContext.HTML, content ?? '') ?? '';
7596
+ }
7597
+ static { this.ɵfac = function TermsAndConditionsComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TermsAndConditionsComponent)(i0.ɵɵdirectiveInject(i2$1.DomSanitizer)); }; }
7587
7598
  static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TermsAndConditionsComponent, selectors: [["xuilib-terms-and-conditions"]], inputs: { document: "document" }, standalone: false, decls: 3, vars: 1, consts: [[3, "innerHTML"]], template: function TermsAndConditionsComponent_Template(rf, ctx) { if (rf & 1) {
7588
7599
  i0.ɵɵconditionalCreate(0, TermsAndConditionsComponent_Case_0_Template, 3, 3, "xuilib-tc-display-html")(1, TermsAndConditionsComponent_Case_1_Template, 3, 3, "xuilib-tc-display-plain")(2, TermsAndConditionsComponent_Case_2_Template, 3, 3, "div");
7589
7600
  } if (rf & 2) {
@@ -7593,11 +7604,11 @@ class TermsAndConditionsComponent {
7593
7604
  }
7594
7605
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TermsAndConditionsComponent, [{
7595
7606
  type: Component,
7596
- args: [{ selector: 'xuilib-terms-and-conditions', standalone: false, template: "\n@switch (document.mimeType) {\n @case ('text/html') {\n <xuilib-tc-display-html>\n <div [innerHTML]=\"document.content | rpxTranslate\"></div>\n </xuilib-tc-display-html>\n }\n @case ('text/plain') {\n <xuilib-tc-display-plain>\n {{ document.content | rpxTranslate}}\n </xuilib-tc-display-plain>\n }\n @default {\n <div>\n {{'An error occured. Please try again.' | rpxTranslate}}\n </div>\n }\n}\n", styles: [":host{display:block;width:100%}\n"] }]
7597
- }], () => [], { document: [{
7607
+ args: [{ selector: 'xuilib-terms-and-conditions', standalone: false, template: "\n@switch (document.mimeType) {\n @case ('text/html') {\n <xuilib-tc-display-html>\n <div [innerHTML]=\"sanitizeHtml(document.content | rpxTranslate)\"></div>\n </xuilib-tc-display-html>\n }\n @case ('text/plain') {\n <xuilib-tc-display-plain>\n {{ document.content | rpxTranslate}}\n </xuilib-tc-display-plain>\n }\n @default {\n <div>\n {{'An error occured. Please try again.' | rpxTranslate}}\n </div>\n }\n}\n", styles: [":host{display:block;width:100%}\n"] }]
7608
+ }], () => [{ type: i2$1.DomSanitizer }], { document: [{
7598
7609
  type: Input
7599
7610
  }] }); })();
7600
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TermsAndConditionsComponent, { className: "TermsAndConditionsComponent", filePath: "lib/components/terms-and-conditions/terms-and-conditions.component.ts", lineNumber: 10 }); })();
7611
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TermsAndConditionsComponent, { className: "TermsAndConditionsComponent", filePath: "lib/components/terms-and-conditions/terms-and-conditions.component.ts", lineNumber: 11 }); })();
7601
7612
 
7602
7613
  function UserDetailsComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
7603
7614
  i0.ɵɵelementStart(0, "div", 0)(1, "span", 4);