@hmcts/ccd-case-ui-toolkit 5.0.44-angular11-welsh-release-part1-4 → 5.0.44-angular11-welsh-release-part1-5

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.
Files changed (28) hide show
  1. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +78 -21
  2. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
  3. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
  4. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
  5. package/esm2015/lib/shared/components/case-editor/case-create/case-create.component.js +2 -2
  6. package/esm2015/lib/shared/components/case-editor/case-progress/case-progress.component.js +2 -2
  7. package/esm2015/lib/shared/components/case-editor/services/case-edit-wizard.guard.js +3 -2
  8. package/esm2015/lib/shared/components/case-editor/services/work-allocation.service.js +2 -2
  9. package/esm2015/lib/shared/components/case-timeline/case-timeline.component.js +2 -2
  10. package/esm2015/lib/shared/components/case-viewer/case-event-trigger/case-event-trigger.component.js +12 -4
  11. package/esm2015/lib/shared/components/palette/base-field/field-read.component.js +5 -1
  12. package/esm2015/lib/shared/components/palette/label/label-field.component.js +24 -5
  13. package/esm2015/lib/shared/components/palette/palette.module.js +2 -2
  14. package/esm2015/lib/shared/domain/alert/alert-status-params.model.js +2 -0
  15. package/esm2015/lib/shared/services/alert/alert.service.js +28 -8
  16. package/fesm2015/hmcts-ccd-case-ui-toolkit.js +70 -20
  17. package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
  18. package/lib/shared/components/case-editor/services/case-edit-wizard.guard.d.ts.map +1 -1
  19. package/lib/shared/components/case-viewer/case-event-trigger/case-event-trigger.component.d.ts.map +1 -1
  20. package/lib/shared/components/palette/base-field/field-read.component.d.ts +1 -0
  21. package/lib/shared/components/palette/base-field/field-read.component.d.ts.map +1 -1
  22. package/lib/shared/components/palette/label/label-field.component.d.ts +2 -1
  23. package/lib/shared/components/palette/label/label-field.component.d.ts.map +1 -1
  24. package/lib/shared/domain/alert/alert-status-params.model.d.ts +6 -0
  25. package/lib/shared/domain/alert/alert-status-params.model.d.ts.map +1 -0
  26. package/lib/shared/services/alert/alert.service.d.ts +8 -4
  27. package/lib/shared/services/alert/alert.service.d.ts.map +1 -1
  28. package/package.json +1 -1
@@ -6795,9 +6795,10 @@
6795
6795
  })();
6796
6796
 
6797
6797
  var AlertService = /** @class */ (function () {
6798
- function AlertService(router) {
6798
+ function AlertService(router, rpxTranslationService) {
6799
6799
  var _this = this;
6800
6800
  this.router = router;
6801
+ this.rpxTranslationService = rpxTranslationService;
6801
6802
  // the preserved messages
6802
6803
  this.preservedError = '';
6803
6804
  this.preservedWarning = '';
@@ -6840,29 +6841,48 @@
6840
6841
  this.alertObserver.next(null);
6841
6842
  this.message = '';
6842
6843
  };
6843
- AlertService.prototype.error = function (message) {
6844
+ AlertService.prototype.error = function (_a) {
6845
+ var phrase = _a.phrase, replacements = _a.replacements;
6846
+ var message = this.getTranslationWithReplacements(phrase, replacements);
6844
6847
  this.preservedError = this.preserveMessages(message);
6845
6848
  var alert = { level: 'error', message: message };
6846
6849
  this.errorObserver.next(alert);
6847
6850
  // EUI-3381.
6848
6851
  this.push(alert);
6849
6852
  };
6850
- AlertService.prototype.warning = function (message) {
6853
+ AlertService.prototype.warning = function (_a) {
6854
+ var phrase = _a.phrase, replacements = _a.replacements;
6855
+ var message = this.getTranslationWithReplacements(phrase, replacements);
6851
6856
  this.preservedWarning = this.preserveMessages(message);
6852
6857
  var alert = { level: 'warning', message: message };
6853
6858
  this.warningObserver.next(alert);
6854
6859
  // EUI-3381.
6855
6860
  this.push(alert);
6856
6861
  };
6857
- AlertService.prototype.success = function (message, preserve) {
6858
- if (preserve === void 0) { preserve = false; }
6859
- this.preservedSuccess = this.preserveMessages(message);
6862
+ AlertService.prototype.success = function (_a) {
6863
+ var preserve = _a.preserve, phrase = _a.phrase, replacements = _a.replacements;
6864
+ var message = this.getTranslationWithReplacements(phrase, replacements);
6860
6865
  this.preserveAlerts = preserve || this.preserveAlerts;
6861
6866
  var alert = { level: 'success', message: message };
6867
+ this.preservedSuccess = this.preserveMessages(message);
6862
6868
  this.successObserver.next(alert);
6863
6869
  // EUI-3381.
6864
6870
  this.push(alert);
6865
6871
  };
6872
+ AlertService.prototype.getTranslationWithReplacements = function (phrase, replacements) {
6873
+ var message;
6874
+ if (replacements) {
6875
+ this.rpxTranslationService.getTranslationWithReplacements(phrase, replacements).subscribe(function (translation) {
6876
+ message = translation;
6877
+ });
6878
+ }
6879
+ else {
6880
+ this.rpxTranslationService.getTranslation(phrase).subscribe(function (translation) {
6881
+ message = translation;
6882
+ });
6883
+ }
6884
+ return message;
6885
+ };
6866
6886
  AlertService.prototype.setPreserveAlerts = function (preserve, urlInfo) {
6867
6887
  // if there is no url setting then just preserve the messages
6868
6888
  if (!urlInfo) {
@@ -6918,12 +6938,12 @@
6918
6938
  };
6919
6939
  return AlertService;
6920
6940
  }());
6921
- AlertService.ɵfac = function AlertService_Factory(t) { return new (t || AlertService)(i0__namespace.ɵɵinject(i1__namespace$1.Router)); };
6941
+ AlertService.ɵfac = function AlertService_Factory(t) { return new (t || AlertService)(i0__namespace.ɵɵinject(i1__namespace$1.Router), i0__namespace.ɵɵinject(i1__namespace.RpxTranslationService)); };
6922
6942
  AlertService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: AlertService, factory: AlertService.ɵfac });
6923
6943
  (function () {
6924
6944
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(AlertService, [{
6925
6945
  type: i0.Injectable
6926
- }], function () { return [{ type: i1__namespace$1.Router }]; }, null);
6946
+ }], function () { return [{ type: i1__namespace$1.Router }, { type: i1__namespace.RpxTranslationService }]; }, null);
6927
6947
  })();
6928
6948
 
6929
6949
  var CaseFileViewService = /** @class */ (function () {
@@ -8404,7 +8424,7 @@
8404
8424
  if (this.userIsCaseworker(userDetails.userInfo.roles)) {
8405
8425
  // when submitting the completion of task if not yet rendered cases/case confirm then preserve the alert for re-rendering
8406
8426
  this.alertService.setPreserveAlerts(true, ['cases/case', 'submit']);
8407
- this.alertService.warning('A task could not be completed successfully. Please complete the task associated with the case manually.');
8427
+ this.alertService.warning({ phrase: 'A task could not be completed successfully. Please complete the task associated with the case manually.' });
8408
8428
  }
8409
8429
  };
8410
8430
  /**
@@ -8834,7 +8854,7 @@
8834
8854
  _this.eventTriggerService.announceEventTrigger(eventTrigger);
8835
8855
  })
8836
8856
  .catch(function (error) {
8837
- _this.alertService.error(error.message);
8857
+ _this.alertService.error({ phrase: error.message });
8838
8858
  return rxjs.throwError(error);
8839
8859
  });
8840
8860
  };
@@ -9039,7 +9059,8 @@
9039
9059
  if (!wizard.hasPage(pageId)) {
9040
9060
  this.goToFirst(wizard, canShowPredicate, route)
9041
9061
  .then(function () {
9042
- _this.alertService.error("No page could be found for '" + pageId + "'");
9062
+ var replacements = { PAGEID: pageId };
9063
+ _this.alertService.error({ phrase: 'No page could be found for %PAGEID%', replacements: replacements });
9043
9064
  });
9044
9065
  return Promise.resolve(false);
9045
9066
  }
@@ -16123,26 +16144,49 @@
16123
16144
  }], function () { return [{ type: i1__namespace$1.ActivatedRoute }, { type: i0__namespace.ChangeDetectorRef }, { type: JurisdictionService }]; }, null);
16124
16145
  })();
16125
16146
 
16147
+ function LabelFieldComponent_ccd_markdown_2_Template(rf, ctx) {
16148
+ if (rf & 1) {
16149
+ i0__namespace.ɵɵelement(0, "ccd-markdown", 2);
16150
+ i0__namespace.ɵɵpipe(1, "rpxTranslate");
16151
+ }
16152
+ if (rf & 2) {
16153
+ var ctx_r0 = i0__namespace.ɵɵnextContext();
16154
+ i0__namespace.ɵɵproperty("content", i0__namespace.ɵɵpipeBind1(1, 2, ctx_r0.caseField.label))("markdownUseHrefAsRouterLink", ctx_r0.markdownUseHrefAsRouterLink);
16155
+ }
16156
+ }
16157
+ function LabelFieldComponent_ccd_markdown_3_Template(rf, ctx) {
16158
+ if (rf & 1) {
16159
+ i0__namespace.ɵɵelement(0, "ccd-markdown", 2);
16160
+ }
16161
+ if (rf & 2) {
16162
+ var ctx_r1 = i0__namespace.ɵɵnextContext();
16163
+ i0__namespace.ɵɵproperty("content", ctx_r1.caseField.value || ctx_r1.caseField.label)("markdownUseHrefAsRouterLink", ctx_r1.markdownUseHrefAsRouterLink);
16164
+ }
16165
+ }
16126
16166
  var LabelFieldComponent = /** @class */ (function () {
16127
16167
  function LabelFieldComponent() {
16128
16168
  this.caseFields = [];
16169
+ this.labelCanBeTranslated = false;
16129
16170
  }
16130
16171
  return LabelFieldComponent;
16131
16172
  }());
16132
16173
  LabelFieldComponent.ɵfac = function LabelFieldComponent_Factory(t) { return new (t || LabelFieldComponent)(); };
16133
- LabelFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: LabelFieldComponent, selectors: [["ccd-label-field"]], inputs: { caseField: "caseField", caseFields: "caseFields", markdownUseHrefAsRouterLink: "markdownUseHrefAsRouterLink" }, decls: 4, vars: 6, consts: [["ccdLabelSubstitutor", "", 1, "case-field", 3, "hidden", "caseField", "contextFields", "id"], [3, "content", "markdownUseHrefAsRouterLink"]], template: function LabelFieldComponent_Template(rf, ctx) {
16174
+ LabelFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: LabelFieldComponent, selectors: [["ccd-label-field"]], inputs: { caseField: "caseField", caseFields: "caseFields", labelCanBeTranslated: "labelCanBeTranslated", markdownUseHrefAsRouterLink: "markdownUseHrefAsRouterLink" }, decls: 5, vars: 6, consts: [["ccdLabelSubstitutor", "", 1, "case-field", 3, "hidden", "caseField", "contextFields", "id"], [3, "content", "markdownUseHrefAsRouterLink", 4, "ngIf"], [3, "content", "markdownUseHrefAsRouterLink"]], template: function LabelFieldComponent_Template(rf, ctx) {
16134
16175
  if (rf & 1) {
16135
16176
  i0__namespace.ɵɵelementStart(0, "dl", 0);
16136
16177
  i0__namespace.ɵɵelementStart(1, "dt");
16137
- i0__namespace.ɵɵelement(2, "ccd-markdown", 1);
16178
+ i0__namespace.ɵɵtemplate(2, LabelFieldComponent_ccd_markdown_2_Template, 2, 4, "ccd-markdown", 1);
16179
+ i0__namespace.ɵɵtemplate(3, LabelFieldComponent_ccd_markdown_3_Template, 1, 2, "ccd-markdown", 1);
16138
16180
  i0__namespace.ɵɵelementEnd();
16139
- i0__namespace.ɵɵelement(3, "dd");
16181
+ i0__namespace.ɵɵelement(4, "dd");
16140
16182
  i0__namespace.ɵɵelementEnd();
16141
16183
  }
16142
16184
  if (rf & 2) {
16143
16185
  i0__namespace.ɵɵproperty("hidden", ctx.caseField.hidden)("caseField", ctx.caseField)("contextFields", ctx.caseFields)("id", ctx.caseField.id);
16144
16186
  i0__namespace.ɵɵadvance(2);
16145
- i0__namespace.ɵɵproperty("content", ctx.caseField.value || ctx.caseField.label)("markdownUseHrefAsRouterLink", ctx.markdownUseHrefAsRouterLink);
16187
+ i0__namespace.ɵɵproperty("ngIf", ctx.labelCanBeTranslated);
16188
+ i0__namespace.ɵɵadvance(1);
16189
+ i0__namespace.ɵɵproperty("ngIf", !ctx.labelCanBeTranslated);
16146
16190
  }
16147
16191
  }, encapsulation: 2 });
16148
16192
  (function () {
@@ -16156,6 +16200,8 @@
16156
16200
  type: i0.Input
16157
16201
  }], caseFields: [{
16158
16202
  type: i0.Input
16203
+ }], labelCanBeTranslated: [{
16204
+ type: i0.Input
16159
16205
  }], markdownUseHrefAsRouterLink: [{
16160
16206
  type: i0.Input
16161
16207
  }] });
@@ -18306,9 +18352,13 @@
18306
18352
  component.instance['caseReference'] = _this.caseReference;
18307
18353
  component.instance['context'] = _this.context;
18308
18354
  component.instance['markdownUseHrefAsRouterLink'] = _this.markdownUseHrefAsRouterLink;
18355
+ component.instance['labelCanBeTranslated'] = _this.labelCanBeTranslated(_this.caseField);
18309
18356
  _this.fieldContainer.insert(component.hostView);
18310
18357
  });
18311
18358
  };
18359
+ FieldReadComponent.prototype.labelCanBeTranslated = function (caseField) {
18360
+ return !!(caseField.field_type.type === 'Label' && caseField.label);
18361
+ };
18312
18362
  return FieldReadComponent;
18313
18363
  }(AbstractFieldReadComponent));
18314
18364
  FieldReadComponent.ɵfac = function FieldReadComponent_Factory(t) { return new (t || FieldReadComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.ComponentFactoryResolver), i0__namespace.ɵɵdirectiveInject(PaletteService)); };
@@ -25932,7 +25982,7 @@
25932
25982
  }], null, null);
25933
25983
  })();
25934
25984
  i0__namespace.ɵɵsetComponentScope(FieldReadComponent, [FieldReadLabelComponent, i2__namespace$1.NgControlStatusGroup, i2__namespace$1.FormGroupDirective], []);
25935
- i0__namespace.ɵɵsetComponentScope(LabelFieldComponent, [LabelSubstitutorDirective, MarkdownComponent], []);
25985
+ i0__namespace.ɵɵsetComponentScope(LabelFieldComponent, [LabelSubstitutorDirective, i2__namespace.NgIf, MarkdownComponent], [i1__namespace.RpxTranslatePipe]);
25936
25986
  i0__namespace.ɵɵsetComponentScope(CaseHistoryViewerFieldComponent, [EventLogComponent], []);
25937
25987
  i0__namespace.ɵɵsetComponentScope(EventLogComponent, [i2__namespace.NgSwitch, i2__namespace.NgSwitchCase, EventLogTableComponent, i2__namespace.NgIf, EventLogDetailsComponent], []);
25938
25988
  i0__namespace.ɵɵsetComponentScope(ReadCollectionFieldComponent, [i2__namespace.NgIf, i2__namespace.NgSwitch, i2__namespace.NgSwitchCase, FieldReadComponent, i2__namespace.NgForOf], []);
@@ -26951,7 +27001,7 @@
26951
27001
  _this.eventTrigger = eventTrigger;
26952
27002
  })
26953
27003
  .catch(function (error) {
26954
- _this.alertService.error(error.message);
27004
+ _this.alertService.error({ phrase: error.message });
26955
27005
  return rxjs.throwError(error);
26956
27006
  });
26957
27007
  };
@@ -29742,7 +29792,7 @@
29742
29792
  }))
29743
29793
  .toPromise()
29744
29794
  .catch(function (error) {
29745
- _this.alertService.error(error.message);
29795
+ _this.alertService.error({ phrase: error.message });
29746
29796
  return rxjs.throwError(error);
29747
29797
  });
29748
29798
  };
@@ -30100,12 +30150,19 @@
30100
30150
  .navigate([this.parentUrl])
30101
30151
  .then(function () {
30102
30152
  var caseReference = _this.caseReferencePipe.transform(_this.caseDetails.case_id.toString());
30153
+ var replacements = { CASEREFERENCE: caseReference, NAME: _this.eventTrigger.name };
30103
30154
  if (EventStatusService.isIncomplete(eventStatus)) {
30104
- _this.alertService.warning("Case #" + caseReference + " has been updated with event: " + _this.eventTrigger.name + " "
30105
- + "but the callback service cannot be completed");
30155
+ _this.alertService.warning({
30156
+ phrase: "Case #%CASEREFERENCE% has been updated with event: %NAME%\n but the callback service cannot be completed",
30157
+ replacements: replacements
30158
+ });
30106
30159
  }
30107
30160
  else {
30108
- _this.alertService.success("Case #" + caseReference + " has been updated with event: " + _this.eventTrigger.name, true);
30161
+ _this.alertService.success({
30162
+ phrase: 'Case #%CASEREFERENCE% has been updated with event: %NAME%',
30163
+ replacements: replacements,
30164
+ preserve: true
30165
+ });
30109
30166
  }
30110
30167
  });
30111
30168
  };