@hmcts/ccd-case-ui-toolkit 7.0.17-error-message → 7.0.17-welsh-event-trigger

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.
@@ -1241,14 +1241,9 @@ class HttpError {
1241
1241
  }
1242
1242
  static from(response) {
1243
1243
  const error = new HttpError();
1244
- if (response?.status === 429) {
1245
- error.error = HttpError.MESSAGE_ERROR_429;
1246
- error.status = response.status;
1247
- error.message = response.message;
1248
- }
1249
1244
  // Check that the HttpErrorResponse contains an "error" object before mapping the error properties
1250
1245
  if (!!(response && response.error)) {
1251
- Object.keys(error).forEach((key) => {
1246
+ Object.keys(error).forEach(key => {
1252
1247
  error[key] = response.error.hasOwnProperty(key) && response.error[key] ? response.error[key] : error[key];
1253
1248
  });
1254
1249
  }
@@ -1265,7 +1260,6 @@ class HttpError {
1265
1260
  HttpError.DEFAULT_ERROR = 'Unknown error';
1266
1261
  HttpError.DEFAULT_MESSAGE = 'Something unexpected happened, our technical staff have been automatically notified';
1267
1262
  HttpError.DEFAULT_STATUS = 500;
1268
- HttpError.MESSAGE_ERROR_429 = 'Your request was rate limited. Please wait a few seconds before retrying your document upload';
1269
1263
 
1270
1264
  /**
1271
1265
  * `Oauth2Service` and `AuthService` cannot be merged as it creates a cyclic dependency on `AuthService` through `HttpErrorService`.
@@ -13457,19 +13451,19 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
13457
13451
  if (0 === error.status || 502 === error.status) {
13458
13452
  return WriteDocumentFieldComponent.UPLOAD_ERROR_NOT_AVAILABLE;
13459
13453
  }
13460
- // let errorMsg = 'Error uploading file';
13461
- // if (error?.error) {
13462
- // const fullError = error.error;
13463
- // const start = fullError.indexOf('{');
13464
- // if (start >= 0) {
13465
- // const json = fullError.substring(start, fullError.length - 1).split('<EOL>').join('');
13466
- // const obj = JSON.parse(json);
13467
- // if (obj?.error) {
13468
- // errorMsg = obj.error;
13469
- // }
13470
- // }
13471
- // }
13472
- return error.error;
13454
+ let errorMsg = 'Error uploading file';
13455
+ if (error?.error) {
13456
+ const fullError = error.error;
13457
+ const start = fullError.indexOf('{');
13458
+ if (start >= 0) {
13459
+ const json = fullError.substring(start, fullError.length - 1).split('<EOL>').join('');
13460
+ const obj = JSON.parse(json);
13461
+ if (obj?.error) {
13462
+ errorMsg = obj.error;
13463
+ }
13464
+ }
13465
+ }
13466
+ return errorMsg;
13473
13467
  }
13474
13468
  buildDocumentUploadData(selectedFile) {
13475
13469
  const documentUpload = new FormData();
@@ -32465,14 +32459,14 @@ class EventTriggerComponent {
32465
32459
  }
32466
32460
  }
32467
32461
  EventTriggerComponent.ɵfac = function EventTriggerComponent_Factory(t) { return new (t || EventTriggerComponent)(i0.ɵɵdirectiveInject(i3.FormBuilder), i0.ɵɵdirectiveInject(OrderService)); };
32468
- EventTriggerComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EventTriggerComponent, selectors: [["ccd-event-trigger"]], inputs: { triggers: "triggers", triggerText: "triggerText", isDisabled: "isDisabled" }, outputs: { onTriggerSubmit: "onTriggerSubmit", onTriggerChange: "onTriggerChange" }, features: [i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [["class", "event-trigger", 3, "formGroup", "ngSubmit", 4, "ngIf"], [1, "event-trigger", 3, "formGroup", "ngSubmit"], [1, "form-group"], ["for", "next-step", 1, "form-label"], ["id", "next-step", "formControlName", "trigger", 1, "form-control", "ccd-dropdown", 3, "ngClass", "change"], ["value", "", "data-default", "", 4, "ngIf"], [3, "ngValue", "title", 4, "ngFor", "ngForOf"], ["type", "submit", 1, "button", 3, "disabled"], ["value", "", "data-default", ""], [3, "ngValue", "title"]], template: function EventTriggerComponent_Template(rf, ctx) { if (rf & 1) {
32462
+ EventTriggerComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EventTriggerComponent, selectors: [["ccd-event-trigger"]], inputs: { triggers: "triggers", triggerText: "triggerText", isDisabled: "isDisabled" }, outputs: { onTriggerSubmit: "onTriggerSubmit", onTriggerChange: "onTriggerChange" }, features: [i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [["class", "event-trigger", 3, "formGroup", "ngSubmit", 4, "ngIf"], [1, "event-trigger", 3, "formGroup", "ngSubmit"], [1, "form-group", 2, "width", "350px !important"], ["for", "next-step", 1, "form-label"], ["id", "next-step", "formControlName", "trigger", 1, "form-control", "ccd-dropdown", 3, "ngClass", "change"], ["value", "", "data-default", "", 4, "ngIf"], [3, "ngValue", "title", 4, "ngFor", "ngForOf"], ["type", "submit", 1, "button", 3, "disabled"], ["value", "", "data-default", ""], [3, "ngValue", "title"]], template: function EventTriggerComponent_Template(rf, ctx) { if (rf & 1) {
32469
32463
  i0.ɵɵtemplate(0, EventTriggerComponent_form_0_Template, 11, 13, "form", 0);
32470
32464
  } if (rf & 2) {
32471
32465
  i0.ɵɵproperty("ngIf", ctx.triggers && ctx.triggers.length);
32472
32466
  } }, dependencies: [i4.NgClass, i4.NgForOf, i4.NgIf, i3.ɵNgNoValidate, i3.NgSelectOption, i3.ɵNgSelectMultipleOption, i3.SelectControlValueAccessor, i3.NgControlStatus, i3.NgControlStatusGroup, i3.FormGroupDirective, i3.FormControlName, i1.RpxTranslatePipe], styles: [".event-trigger[_ngcontent-%COMP%]{width:auto;margin-top:40px;margin-bottom:20px}.event-trigger[_ngcontent-%COMP%] .form-group[_ngcontent-%COMP%]{margin-top:3px;margin-right:10px;margin-bottom:0;float:left;text-align:right;width:325px}.event-trigger[_ngcontent-%COMP%] .form-group[_ngcontent-%COMP%] .form-label[_ngcontent-%COMP%]{float:left;margin-top:5px}.event-trigger[_ngcontent-%COMP%] select[_ngcontent-%COMP%]{width:250px}.event-trigger[_ngcontent-%COMP%] select.EventTrigger-empty[_ngcontent-%COMP%], .event-trigger[_ngcontent-%COMP%] select[_ngcontent-%COMP%] [data-default][_ngcontent-%COMP%]{color:#6f777b}"] });
32473
32467
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EventTriggerComponent, [{
32474
32468
  type: Component,
32475
- args: [{ selector: 'ccd-event-trigger', template: "<form *ngIf=\"triggers && triggers.length\" class=\"event-trigger\" (ngSubmit)=\"triggerSubmit()\" [formGroup]=\"triggerForm\">\n <div class=\"form-group\">\n <label class=\"form-label\" for=\"next-step\">{{'Next step' | rpxTranslate}}</label>\n <select class=\"form-control ccd-dropdown\" id=\"next-step\" (change)=\"triggerChange()\" formControlName=\"trigger\" [ngClass]=\"{\n 'EventTrigger-empty': !triggerForm.value['trigger']\n }\">\n <option *ngIf=\"1 !== triggers.length\" value=\"\" data-default>{{'Select action' | rpxTranslate}}</option>\n <option *ngFor=\"let trigger of triggers\" [ngValue]=\"trigger\" [title]=\"trigger.description\">{{trigger.name | rpxTranslate}}</option>\n </select>\n </div>\n <button [disabled]=\"isButtonDisabled()\" type=\"submit\" class=\"button\">{{triggerText | rpxTranslate}}</button>\n</form>\n", styles: [".event-trigger{width:auto;margin-top:40px;margin-bottom:20px}.event-trigger .form-group{margin-top:3px;margin-right:10px;margin-bottom:0;float:left;text-align:right;width:325px}.event-trigger .form-group .form-label{float:left;margin-top:5px}.event-trigger select{width:250px}.event-trigger select.EventTrigger-empty,.event-trigger select [data-default]{color:#6f777b}\n"] }]
32469
+ args: [{ selector: 'ccd-event-trigger', template: "<form *ngIf=\"triggers && triggers.length\" class=\"event-trigger\" (ngSubmit)=\"triggerSubmit()\" [formGroup]=\"triggerForm\">\n <div class=\"form-group\" style=\"width: 350px !important;\">\n <label class=\"form-label\" for=\"next-step\">{{'Next step' | rpxTranslate}}</label>\n <select class=\"form-control ccd-dropdown\" id=\"next-step\" (change)=\"triggerChange()\" formControlName=\"trigger\" [ngClass]=\"{\n 'EventTrigger-empty': !triggerForm.value['trigger']\n }\">\n <option *ngIf=\"1 !== triggers.length\" value=\"\" data-default>{{'Select action' | rpxTranslate}}</option>\n <option *ngFor=\"let trigger of triggers\" [ngValue]=\"trigger\" [title]=\"trigger.description\">{{trigger.name | rpxTranslate}}</option>\n </select>\n </div>\n <button [disabled]=\"isButtonDisabled()\" type=\"submit\" class=\"button\">{{triggerText | rpxTranslate}}</button>\n</form>\n", styles: [".event-trigger{width:auto;margin-top:40px;margin-bottom:20px}.event-trigger .form-group{margin-top:3px;margin-right:10px;margin-bottom:0;float:left;text-align:right;width:325px}.event-trigger .form-group .form-label{float:left;margin-top:5px}.event-trigger select{width:250px}.event-trigger select.EventTrigger-empty,.event-trigger select [data-default]{color:#6f777b}\n"] }]
32476
32470
  }], function () { return [{ type: i3.FormBuilder }, { type: OrderService }]; }, { triggers: [{
32477
32471
  type: Input
32478
32472
  }], triggerText: [{