@hmcts/ccd-case-ui-toolkit 7.0.70 → 7.0.71-special-characters-2

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.
@@ -7982,6 +7982,42 @@ class WizardPageFieldToCaseFieldMapper {
7982
7982
  }]
7983
7983
  }], null, null); })();
7984
7984
 
7985
+ function convertNonASCIICharacter(character) {
7986
+ if (character === '£') {
7987
+ // pound sign will be frequently used and works for btoa despite being non-ASCII
7988
+ // note: this could be done for other characters provided they work for btoa()
7989
+ return character;
7990
+ }
7991
+ // Note: Will convert to HTML entity
7992
+ return CaseEditUtils.PREFIX + character.charCodeAt(0) + CaseEditUtils.SUFFIX;
7993
+ }
7994
+ class CaseEditUtils {
7995
+ // Note: Made these purposely odd to avoid possible data conflicts
7996
+ static PREFIX = '&#';
7997
+ static SUFFIX = ';';
7998
+ convertNonASCIICharacters(rawString) {
7999
+ return rawString ? rawString.replace(/[^\x20-\x7F]/g, function (c) {
8000
+ return convertNonASCIICharacter(c);
8001
+ }) : '';
8002
+ }
8003
+ convertHTMLEntities(editedString) {
8004
+ const revertedCharacterList = editedString.split(CaseEditUtils.PREFIX);
8005
+ let rawString = revertedCharacterList[0];
8006
+ for (let index = 1; index < revertedCharacterList.length; index++) {
8007
+ const currentSection = revertedCharacterList[index];
8008
+ if (!currentSection.includes(CaseEditUtils.SUFFIX)) {
8009
+ return rawString.concat(currentSection);
8010
+ }
8011
+ else {
8012
+ const suffixSplitList = currentSection.split(CaseEditUtils.SUFFIX);
8013
+ const characterCode = Number(suffixSplitList[0]);
8014
+ rawString = rawString.concat(String.fromCharCode(characterCode), suffixSplitList[1]);
8015
+ }
8016
+ }
8017
+ return rawString;
8018
+ }
8019
+ }
8020
+
7985
8021
  class CasesService {
7986
8022
  http;
7987
8023
  appConfig;
@@ -8270,8 +8306,12 @@ class CasesService {
8270
8306
  addClientContextHeader(headers) {
8271
8307
  const clientContextDetails = this.sessionStorageService.getItem('clientContext');
8272
8308
  if (clientContextDetails) {
8273
- // may require URI encoding in certain circumstances
8274
- const clientContext = window.btoa(clientContextDetails);
8309
+ let clientContextEdit = JSON.parse(clientContextDetails);
8310
+ clientContextEdit.client_context.user_task.task_data.name = 'Review ㅪ the ㋚ appeal \`';
8311
+ const caseEditUtils = new CaseEditUtils();
8312
+ // below changes non-ASCII characters
8313
+ const editedClientContext = caseEditUtils.convertNonASCIICharacters(clientContextDetails);
8314
+ const clientContext = window.btoa(editedClientContext);
8275
8315
  if (clientContext) {
8276
8316
  headers = headers.set('Client-Context', clientContext);
8277
8317
  }
@@ -8279,11 +8319,12 @@ class CasesService {
8279
8319
  return headers;
8280
8320
  }
8281
8321
  updateClientContextStorage(headers) {
8282
- // for mocking - TODO: Kasi Remove/Uncomment for testing
8283
- // headers = this.setMockClientContextHeader(headers);
8284
8322
  if (headers && headers.get('Client-Context')) {
8323
+ const caseEditUtils = new CaseEditUtils();
8285
8324
  const clientContextString = window.atob(headers.get('Client-Context'));
8286
- this.sessionStorageService.setItem('clientContext', clientContextString);
8325
+ // below reverts non-ASCII characters
8326
+ const editedClientContextString = caseEditUtils.convertHTMLEntities(clientContextString);
8327
+ this.sessionStorageService.setItem('clientContext', editedClientContextString);
8287
8328
  }
8288
8329
  }
8289
8330
  static ɵfac = function CasesService_Factory(t) { return new (t || CasesService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(OrderService), i0.ɵɵinject(HttpErrorService), i0.ɵɵinject(WizardPageFieldToCaseFieldMapper), i0.ɵɵinject(LoadingService), i0.ɵɵinject(SessionStorageService), i0.ɵɵinject(RetryUtil)); };
@@ -35069,6 +35110,7 @@ class CaseSpecificAccessRequestComponent {
35069
35110
  $roleAssignmentResponseSubscription;
35070
35111
  genericError = 'There is a problem';
35071
35112
  specificReasonControlName = 'specificReason';
35113
+ getSpecificAccessError = false;
35072
35114
  constructor(fb, router, casesService, route, caseNotifier) {
35073
35115
  this.fb = fb;
35074
35116
  this.router = router;
@@ -35123,9 +35165,15 @@ class CaseSpecificAccessRequestComponent {
35123
35165
  .subscribe(() => {
35124
35166
  // Would have been nice to pass the caseId within state.data, but this isn't part of NavigationExtras until
35125
35167
  // Angular 7.2
35168
+ this.getSpecificAccessError = false;
35126
35169
  this.router.navigate(['success'], { relativeTo: this.route });
35127
35170
  }, () => {
35128
- // Navigate to error page
35171
+ // Show the generic error message
35172
+ this.getSpecificAccessError = true;
35173
+ this.errorMessage = {
35174
+ title: this.genericError,
35175
+ description: 'Sorry, there is a problem with the service; Try again later.'
35176
+ };
35129
35177
  });
35130
35178
  }
35131
35179
  }
@@ -35142,7 +35190,7 @@ class CaseSpecificAccessRequestComponent {
35142
35190
  return input.value === null || input.value.trim().length === 0;
35143
35191
  }
35144
35192
  static ɵfac = function CaseSpecificAccessRequestComponent_Factory(t) { return new (t || CaseSpecificAccessRequestComponent)(i0.ɵɵdirectiveInject(i4.FormBuilder), i0.ɵɵdirectiveInject(i1$1.Router), i0.ɵɵdirectiveInject(CasesService), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(CaseNotifier)); };
35145
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseSpecificAccessRequestComponent, selectors: [["ccd-case-specific-access-request"]], decls: 50, vars: 42, consts: [[3, "error", 4, "ngIf"], ["type", "information"], [3, "submit", "formGroup"], [1, "govuk-form-group", 3, "ngClass"], ["aria-describedby", "reason-hint", 1, "govuk-fieldset"], [1, "govuk-fieldset__legend", "govuk-fieldset__legend--l"], [1, "govuk-fieldset__heading"], ["data-module", "govuk-details", "role", "group", 1, "govuk-details"], ["role", "button", "aria-expanded", "false", 1, "govuk-details__summary"], [1, "govuk-details__summary-text"], ["aria-hidden", "true", 1, "govuk-details__text"], [1, "govuk-body"], [1, "govuk-list", "govuk-list--bullet"], ["id", "reason-hint", 1, "govuk-hint"], ["id", "conditional-reason-3"], [1, "govuk-form-group"], ["id", "specific-reason-error-message", "class", "govuk-error-message", 4, "ngIf"], ["id", "specific-reason", "name", "specific-reason", "rows", "8", "formControlName", "specificReason", 1, "govuk-textarea", 3, "ngClass"], [1, "govuk-button-group"], ["type", "submit", 1, "govuk-button", "govuk-!-margin-right-3"], [1, "govuk-grid-column-full", "govuk-!-padding-left-0"], ["href", "javascript:void(0)", 1, "govuk-body", 3, "click"], [3, "error"], ["id", "specific-reason-error-message", 1, "govuk-error-message"]], template: function CaseSpecificAccessRequestComponent_Template(rf, ctx) { if (rf & 1) {
35193
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseSpecificAccessRequestComponent, selectors: [["ccd-case-specific-access-request"]], decls: 50, vars: 42, consts: [[3, "error", 4, "ngIf"], ["type", "information"], [3, "submit", "formGroup"], [1, "govuk-form-group", 3, "ngClass"], ["aria-describedby", "reason-hint", 1, "govuk-fieldset"], [1, "govuk-fieldset__legend", "govuk-fieldset__legend--l"], [1, "govuk-fieldset__heading"], ["data-module", "govuk-details", "role", "group", 1, "govuk-details"], ["aria-expanded", "false", 1, "govuk-details__summary"], [1, "govuk-details__summary-text"], ["aria-hidden", "true", 1, "govuk-details__text"], [1, "govuk-body"], [1, "govuk-list", "govuk-list--bullet"], ["id", "reason-hint", 1, "govuk-hint"], ["id", "conditional-reason-3"], [1, "govuk-form-group"], ["id", "specific-reason-error-message", "class", "govuk-error-message", 4, "ngIf"], ["id", "specific-reason", "name", "specific-reason", "rows", "8", "formControlName", "specificReason", 1, "govuk-textarea", 3, "ngClass"], [1, "govuk-button-group"], ["type", "submit", 1, "govuk-button", "govuk-!-margin-right-3"], [1, "govuk-grid-column-full", "govuk-!-padding-left-0"], ["href", "javascript:void(0)", 1, "govuk-body", 3, "click"], [3, "error"], ["id", "specific-reason-error-message", 1, "govuk-error-message"]], template: function CaseSpecificAccessRequestComponent_Template(rf, ctx) { if (rf & 1) {
35146
35194
  i0.ɵɵtemplate(0, CaseSpecificAccessRequestComponent_exui_error_message_0_Template, 1, 1, "exui-error-message", 0);
35147
35195
  i0.ɵɵelementStart(1, "cut-alert", 1);
35148
35196
  i0.ɵɵtext(2);
@@ -35196,7 +35244,7 @@ class CaseSpecificAccessRequestComponent {
35196
35244
  i0.ɵɵpipe(49, "rpxTranslate");
35197
35245
  i0.ɵɵelementEnd()()()()();
35198
35246
  } if (rf & 2) {
35199
- i0.ɵɵproperty("ngIf", ctx.formGroup.invalid && ctx.submitted);
35247
+ i0.ɵɵproperty("ngIf", ctx.formGroup.invalid && ctx.submitted || ctx.getSpecificAccessError);
35200
35248
  i0.ɵɵadvance(2);
35201
35249
  i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 16, "Authorisation is needed to access this case."), "");
35202
35250
  i0.ɵɵadvance(3);
@@ -35231,7 +35279,7 @@ class CaseSpecificAccessRequestComponent {
35231
35279
  }
35232
35280
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseSpecificAccessRequestComponent, [{
35233
35281
  type: Component,
35234
- args: [{ selector: 'ccd-case-specific-access-request', template: "<exui-error-message\n *ngIf=\"formGroup.invalid && submitted\"\n [error]=\"errorMessage\"></exui-error-message>\n<cut-alert type=\"information\">\n {{'Authorisation is needed to access this case.' | rpxTranslate}}<br />\n {{'This could be because it\\'s outside your jurisdiction, or you may be excluded from the case. If you request access to this case, it will be logged for auditing purposes.' | rpxTranslate}}\n</cut-alert>\n<form [formGroup]=\"formGroup\" (submit)=\"onSubmit()\">\n <div class=\"govuk-form-group\"\n [ngClass]=\"{ 'form-group-error': formGroup.invalid && submitted }\">\n <fieldset class=\"govuk-fieldset\" aria-describedby=\"reason-hint\">\n <legend class=\"govuk-fieldset__legend govuk-fieldset__legend--l\">\n <h1 class=\"govuk-fieldset__heading\">\n {{ title | rpxTranslate }}\n </h1>\n </legend>\n\n <details class=\"govuk-details\" data-module=\"govuk-details\" role=\"group\">\n <summary\n class=\"govuk-details__summary\"\n role=\"button\"\n aria-expanded=\"false\">\n <span class=\"govuk-details__summary-text\">\n {{'Help with requesting case access' | rpxTranslate}}\n </span>\n </summary>\n <div\n class=\"govuk-details__text\"\n aria-hidden=\"true\">\n <p class=\"govuk-body\">{{'You could include:' | rpxTranslate}}</p>\n <ul class=\"govuk-list govuk-list--bullet\">\n <li>{{'the case reference of the linked case' | rpxTranslate}}</li>\n <li>{{'how long you require access to this case' | rpxTranslate}}</li>\n <li>{{'any other reasons why you require access' | rpxTranslate}}</li>\n </ul>\n </div>\n </details>\n\n <div id=\"reason-hint\" class=\"govuk-hint\">\n {{ hint | rpxTranslate }}\n </div>\n <div id=\"conditional-reason-3\">\n <div class=\"govuk-form-group\">\n <div\n id=\"specific-reason-error-message\"\n class=\"govuk-error-message\"\n *ngIf=\"formGroup.get('specificReason').invalid && submitted\">\n {{ errorMessage.description | rpxTranslate }}\n </div>\n <textarea\n class=\"govuk-textarea\"\n [ngClass]=\"{\n 'govuk-textarea--error':\n formGroup.get('specificReason').invalid && submitted\n }\"\n id=\"specific-reason\"\n name=\"specific-reason\"\n rows=\"8\"\n formControlName=\"specificReason\">\n </textarea>\n </div>\n </div>\n </fieldset>\n </div>\n\n <div class=\"govuk-button-group\">\n <button class=\"govuk-button govuk-!-margin-right-3\" type=\"submit\">\n {{'Submit' | rpxTranslate}}\n </button>\n <div class=\"govuk-grid-column-full govuk-!-padding-left-0\">\n <p>\n <a class=\"govuk-body\" (click)=\"onCancel()\" href=\"javascript:void(0)\">\n {{'Cancel' | rpxTranslate}}\n </a>\n </p>\n </div>\n </div>\n</form>\n" }]
35282
+ args: [{ selector: 'ccd-case-specific-access-request', template: "<exui-error-message\n *ngIf=\"(formGroup.invalid && submitted) || getSpecificAccessError\"\n [error]=\"errorMessage\"></exui-error-message>\n<cut-alert type=\"information\">\n {{'Authorisation is needed to access this case.' | rpxTranslate}}<br />\n {{'This could be because it\\'s outside your jurisdiction, or you may be excluded from the case. If you request access to this case, it will be logged for auditing purposes.' | rpxTranslate}}\n</cut-alert>\n<form [formGroup]=\"formGroup\" (submit)=\"onSubmit()\">\n <div class=\"govuk-form-group\"\n [ngClass]=\"{ 'form-group-error': formGroup.invalid && submitted }\">\n <fieldset class=\"govuk-fieldset\" aria-describedby=\"reason-hint\">\n <legend class=\"govuk-fieldset__legend govuk-fieldset__legend--l\">\n <h1 class=\"govuk-fieldset__heading\">\n {{ title | rpxTranslate }}\n </h1>\n </legend>\n\n <details class=\"govuk-details\" data-module=\"govuk-details\" role=\"group\">\n <summary\n class=\"govuk-details__summary\"\n aria-expanded=\"false\">\n <span class=\"govuk-details__summary-text\">\n {{'Help with requesting case access' | rpxTranslate}}\n </span>\n </summary>\n <div\n class=\"govuk-details__text\"\n aria-hidden=\"true\">\n <p class=\"govuk-body\">{{'You could include:' | rpxTranslate}}</p>\n <ul class=\"govuk-list govuk-list--bullet\">\n <li>{{'the case reference of the linked case' | rpxTranslate}}</li>\n <li>{{'how long you require access to this case' | rpxTranslate}}</li>\n <li>{{'any other reasons why you require access' | rpxTranslate}}</li>\n </ul>\n </div>\n </details>\n\n <div id=\"reason-hint\" class=\"govuk-hint\">\n {{ hint | rpxTranslate }}\n </div>\n <div id=\"conditional-reason-3\">\n <div class=\"govuk-form-group\">\n <div\n id=\"specific-reason-error-message\"\n class=\"govuk-error-message\"\n *ngIf=\"formGroup.get('specificReason').invalid && submitted\">\n {{ errorMessage.description | rpxTranslate }}\n </div>\n <textarea\n class=\"govuk-textarea\"\n [ngClass]=\"{\n 'govuk-textarea--error':\n formGroup.get('specificReason').invalid && submitted\n }\"\n id=\"specific-reason\"\n name=\"specific-reason\"\n rows=\"8\"\n formControlName=\"specificReason\">\n </textarea>\n </div>\n </div>\n </fieldset>\n </div>\n\n <div class=\"govuk-button-group\">\n <button class=\"govuk-button govuk-!-margin-right-3\" type=\"submit\">\n {{'Submit' | rpxTranslate}}\n </button>\n <div class=\"govuk-grid-column-full govuk-!-padding-left-0\">\n <p>\n <a class=\"govuk-body\" (click)=\"onCancel()\" href=\"javascript:void(0)\">\n {{'Cancel' | rpxTranslate}}\n </a>\n </p>\n </div>\n </div>\n</form>\n" }]
35235
35283
  }], () => [{ type: i4.FormBuilder }, { type: i1$1.Router }, { type: CasesService }, { type: i1$1.ActivatedRoute }, { type: CaseNotifier }], null); })();
35236
35284
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseSpecificAccessRequestComponent, { className: "CaseSpecificAccessRequestComponent", filePath: "lib/shared/components/case-viewer/case-specific-access-request/case-specific-access-request.component.ts", lineNumber: 22 }); })();
35237
35285