@hmcts/ccd-case-ui-toolkit 7.3.43 → 7.3.44-4371-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.
@@ -993,11 +993,11 @@ class NotificationBannerComponent {
993
993
  i0.ɵɵtemplate(0, NotificationBannerComponent_div_0_Template, 14, 10, "div", 0);
994
994
  } if (rf & 2) {
995
995
  i0.ɵɵproperty("ngIf", ctx.notificationBannerConfig);
996
- } }, dependencies: [i5.NgClass, i5.NgIf, i5.NgSwitch, i5.NgSwitchCase], styles: [".govuk-notification-banner[_ngcontent-%COMP%] .govuk-notification-banner__content[_ngcontent-%COMP%] .govuk-notification-banner__heading[_ngcontent-%COMP%]{margin-left:0;max-width:900px}.govuk-notification-banner[_ngcontent-%COMP%] .govuk-notification-banner__content[_ngcontent-%COMP%] .govuk-notification-banner__heading[_ngcontent-%COMP%] .govuk-notification-banner__link[_ngcontent-%COMP%]{margin-left:10px}.notification-banner-information[_ngcontent-%COMP%], .notification-banner-error[_ngcontent-%COMP%]{background-color:#d4351c;border:5px solid #d4351c}.notification-banner-warning[_ngcontent-%COMP%]{background-color:#912b88;border:5px solid #912b88}.notification-banner-success[_ngcontent-%COMP%]{background-color:#006435;border:5px solid #006435}"] });
996
+ } }, dependencies: [i5.NgClass, i5.NgIf, i5.NgSwitch, i5.NgSwitchCase], styles: [".govuk-notification-banner[_ngcontent-%COMP%] .govuk-notification-banner__content[_ngcontent-%COMP%] .govuk-notification-banner__heading[_ngcontent-%COMP%]{margin-left:0;max-width:fit-content}.govuk-notification-banner[_ngcontent-%COMP%] .govuk-notification-banner__content[_ngcontent-%COMP%] .govuk-notification-banner__heading[_ngcontent-%COMP%] .govuk-notification-banner__link[_ngcontent-%COMP%]{margin-left:10px}.notification-banner-information[_ngcontent-%COMP%], .notification-banner-error[_ngcontent-%COMP%]{background-color:#d4351c;border:5px solid #d4351c}.notification-banner-warning[_ngcontent-%COMP%]{background-color:#912b88;border:5px solid #912b88}.notification-banner-success[_ngcontent-%COMP%]{background-color:#006435;border:5px solid #006435}"] });
997
997
  }
998
998
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NotificationBannerComponent, [{
999
999
  type: Component,
1000
- args: [{ selector: 'ccd-notification-banner', standalone: false, template: "<div *ngIf=\"notificationBannerConfig\"\n class=\"govuk-notification-banner\"\n [ngClass]=\"notificationBannerConfig.headerClass\"\n role=\"region\"\n aria-labelledby=\"govuk-notification-banner-title\"\n data-module=\"govuk-notification-banner\">\n\n <div class=\"govuk-notification-banner__header\">\n <h2 class=\"govuk-notification-banner__title\" id=\"govuk-notification-banner-title\">\n {{notificationBannerConfig.headingText}}\n </h2>\n </div>\n <div class=\"govuk-notification-banner__content\">\n <p class=\"govuk-notification-banner__heading\">\n <ng-container [ngSwitch]=\"notificationBannerConfig.bannerType\">\n <ng-container *ngSwitchCase=\"notificationBannerType.WARNING\">\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\"\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"36\" width=\"36\">\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\"></path>\n </svg>\n </ng-container>\n <ng-container *ngSwitchCase=\"notificationBannerType.ERROR\">\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\"\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"36\" width=\"36\">\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\"></path>\n </svg>\n </ng-container>\n <ng-container *ngSwitchCase=\"notificationBannerType.SUCCESS\">\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\"\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"36\" width=\"36\">\n <path d=\"M25,6.2L8.7,23.2L0,14.1l4-4.2l4.7,4.9L21,2L25,6.2z\"></path>\n </svg>\n </ng-container>\n <ng-container *ngSwitchCase=\"notificationBannerType.INFORMATION\">\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\"\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"36\" width=\"36\">\n <path d=\"M13.7,18.5h-2.4v-2.4h2.4V18.5z M12.5,13.7c-0.7,0-1.2-0.5-1.2-1.2V7.7c0-0.7,0.5-1.2,1.2-1.2s1.2,0.5,1.2,1.2v4.8\n C13.7,13.2,13.2,13.7,12.5,13.7z M12.5,0.5c-6.6,0-12,5.4-12,12s5.4,12,12,12s12-5.4,12-12S19.1,0.5,12.5,0.5z\"></path>\n </svg>\n </ng-container>\n </ng-container>\n {{notificationBannerConfig.description}}\n <a *ngIf=\"notificationBannerConfig.showLink && !notificationBannerConfig.triggerOutputEvent\"\n class=\"govuk-notification-banner__link\"\n href=\"{{notificationBannerConfig.linkUrl}}\">{{notificationBannerConfig.linkText}}</a>\n <a *ngIf=\"notificationBannerConfig.showLink && notificationBannerConfig.triggerOutputEvent\"\n class=\"govuk-notification-banner__link\"\n href=\"#\"\n (click)=\"onLinkClick(notificationBannerConfig.triggerOutputEventText); $event.preventDefault()\">{{notificationBannerConfig.linkText}}</a>\n </p>\n </div>\n</div>\n", styles: [".govuk-notification-banner .govuk-notification-banner__content .govuk-notification-banner__heading{margin-left:0;max-width:900px}.govuk-notification-banner .govuk-notification-banner__content .govuk-notification-banner__heading .govuk-notification-banner__link{margin-left:10px}.notification-banner-information,.notification-banner-error{background-color:#d4351c;border:5px solid #d4351c}.notification-banner-warning{background-color:#912b88;border:5px solid #912b88}.notification-banner-success{background-color:#006435;border:5px solid #006435}\n"] }]
1000
+ args: [{ selector: 'ccd-notification-banner', standalone: false, template: "<div *ngIf=\"notificationBannerConfig\"\n class=\"govuk-notification-banner\"\n [ngClass]=\"notificationBannerConfig.headerClass\"\n role=\"region\"\n aria-labelledby=\"govuk-notification-banner-title\"\n data-module=\"govuk-notification-banner\">\n\n <div class=\"govuk-notification-banner__header\">\n <h2 class=\"govuk-notification-banner__title\" id=\"govuk-notification-banner-title\">\n {{notificationBannerConfig.headingText}}\n </h2>\n </div>\n <div class=\"govuk-notification-banner__content\">\n <p class=\"govuk-notification-banner__heading\">\n <ng-container [ngSwitch]=\"notificationBannerConfig.bannerType\">\n <ng-container *ngSwitchCase=\"notificationBannerType.WARNING\">\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\"\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"36\" width=\"36\">\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\"></path>\n </svg>\n </ng-container>\n <ng-container *ngSwitchCase=\"notificationBannerType.ERROR\">\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\"\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"36\" width=\"36\">\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\"></path>\n </svg>\n </ng-container>\n <ng-container *ngSwitchCase=\"notificationBannerType.SUCCESS\">\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\"\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"36\" width=\"36\">\n <path d=\"M25,6.2L8.7,23.2L0,14.1l4-4.2l4.7,4.9L21,2L25,6.2z\"></path>\n </svg>\n </ng-container>\n <ng-container *ngSwitchCase=\"notificationBannerType.INFORMATION\">\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\"\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"36\" width=\"36\">\n <path d=\"M13.7,18.5h-2.4v-2.4h2.4V18.5z M12.5,13.7c-0.7,0-1.2-0.5-1.2-1.2V7.7c0-0.7,0.5-1.2,1.2-1.2s1.2,0.5,1.2,1.2v4.8\n C13.7,13.2,13.2,13.7,12.5,13.7z M12.5,0.5c-6.6,0-12,5.4-12,12s5.4,12,12,12s12-5.4,12-12S19.1,0.5,12.5,0.5z\"></path>\n </svg>\n </ng-container>\n </ng-container>\n {{notificationBannerConfig.description}}\n <a *ngIf=\"notificationBannerConfig.showLink && !notificationBannerConfig.triggerOutputEvent\"\n class=\"govuk-notification-banner__link\"\n href=\"{{notificationBannerConfig.linkUrl}}\">{{notificationBannerConfig.linkText}}</a>\n <a *ngIf=\"notificationBannerConfig.showLink && notificationBannerConfig.triggerOutputEvent\"\n class=\"govuk-notification-banner__link\"\n href=\"#\"\n (click)=\"onLinkClick(notificationBannerConfig.triggerOutputEventText); $event.preventDefault()\">{{notificationBannerConfig.linkText}}</a>\n </p>\n </div>\n</div>\n", styles: [".govuk-notification-banner .govuk-notification-banner__content .govuk-notification-banner__heading{margin-left:0;max-width:fit-content}.govuk-notification-banner .govuk-notification-banner__content .govuk-notification-banner__heading .govuk-notification-banner__link{margin-left:10px}.notification-banner-information,.notification-banner-error{background-color:#d4351c;border:5px solid #d4351c}.notification-banner-warning{background-color:#912b88;border:5px solid #912b88}.notification-banner-success{background-color:#006435;border:5px solid #006435}\n"] }]
1001
1001
  }], null, { notificationBannerConfig: [{
1002
1002
  type: Input
1003
1003
  }], linkClicked: [{
@@ -9837,6 +9837,11 @@ class CaseEditComponent {
9837
9837
  const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9838
9838
  const [task, taskToBeCompleted] = userTask ? [userTask.task_data, userTask.complete_task] : [null, false];
9839
9839
  const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true';
9840
+ if (this.caseDetails && (this.caseDetails.case_id !== task?.case_id)) {
9841
+ this.abstractConfig.logMessage(`postCompleteTaskIfRequired: task in session storage with taskId ${task?.id} has caseId: ${task?.case_id} which does not match case details case id ${this.caseDetails.case_id}, NOT completing task and clearing client context`);
9842
+ this.sessionStorageService.removeItem(CaseEditComponent.CLIENT_CONTEXT);
9843
+ return of(true);
9844
+ }
9840
9845
  if (task && assignNeeded && taskToBeCompleted) {
9841
9846
  this.abstractConfig.logMessage(`postCompleteTaskIfRequired with assignNeeded: taskId ${task.id} and event name ${this.eventTrigger?.name}`);
9842
9847
  return this.workAllocationService.assignAndCompleteTask(task.id, this.eventTrigger.name);
@@ -35865,6 +35870,99 @@ class DialogsModule {
35865
35870
  SaveOrDiscardDialogComponent,
35866
35871
  RemoveDialogComponent] }); })();
35867
35872
 
35873
+ const PVP_FLAG_CODE = 'PF0021';
35874
+ const PVP_DISPLAY_TEXT = 'POTENTIALLY VIOLENT PERSON';
35875
+ function isPvpFlag(flagDetail) {
35876
+ return flagDetail?.flagCode === PVP_FLAG_CODE;
35877
+ }
35878
+ function hasPvpFlag(flagsWithFormGroupPath) {
35879
+ return !!flagsWithFormGroupPath?.flags?.details?.some(isPvpFlag);
35880
+ }
35881
+ function isActivePvpFlag(flagDetail) {
35882
+ return isPvpFlag(flagDetail) && flagDetail?.status === CaseFlagStatus.ACTIVE;
35883
+ }
35884
+ function hasActivePvpFlag(flagsWithFormGroupPath) {
35885
+ return !!flagsWithFormGroupPath?.flags?.details?.some(isActivePvpFlag);
35886
+ }
35887
+ function prioritisePvpFlags(flagDetails = []) {
35888
+ const activePvpFlags = [];
35889
+ const remainingFlags = [];
35890
+ flagDetails.forEach((flagDetail) => {
35891
+ if (isActivePvpFlag(flagDetail)) {
35892
+ activePvpFlags.push(flagDetail);
35893
+ }
35894
+ else {
35895
+ remainingFlags.push(flagDetail);
35896
+ }
35897
+ });
35898
+ return [...activePvpFlags, ...remainingFlags];
35899
+ }
35900
+ function prioritisePvpParties(partyFlagsData = []) {
35901
+ const pvpParties = [];
35902
+ const nonPvpParties = [];
35903
+ partyFlagsData.forEach((partyFlags) => {
35904
+ const prioritisedPartyFlags = {
35905
+ ...partyFlags,
35906
+ flags: {
35907
+ ...partyFlags.flags,
35908
+ details: partyFlags?.flags?.details ? prioritisePvpFlags(partyFlags.flags.details) : partyFlags?.flags?.details
35909
+ }
35910
+ };
35911
+ if (hasActivePvpFlag(prioritisedPartyFlags)) {
35912
+ pvpParties.push(prioritisedPartyFlags);
35913
+ }
35914
+ else {
35915
+ nonPvpParties.push(prioritisedPartyFlags);
35916
+ }
35917
+ });
35918
+ return [...pvpParties, ...nonPvpParties];
35919
+ }
35920
+ function hasActivePvpFlagInCaseFields(caseFields = []) {
35921
+ return caseFields
35922
+ .filter((caseField) => !FieldsUtils.isFlagLauncherCaseField(caseField) && caseField.value)
35923
+ .some((caseField) => hasActivePvpFlagInCaseField(caseField));
35924
+ }
35925
+ function hasActivePvpFlagInCaseField(caseField, currentValue) {
35926
+ const fieldType = caseField?.field_type;
35927
+ const value = caseField?.value ? caseField.value : currentValue;
35928
+ if (fieldType?.type === 'Complex') {
35929
+ return hasActivePvpFlagInComplexField(caseField, value);
35930
+ }
35931
+ if (fieldType?.type === 'Collection') {
35932
+ return hasActivePvpFlagInCollectionField(caseField, value);
35933
+ }
35934
+ return false;
35935
+ }
35936
+ function hasActivePvpFlagInComplexField(caseField, value) {
35937
+ if (FieldsUtils.isFlagsCaseField(caseField)) {
35938
+ return hasActivePvpFlagInFlagsValue(value);
35939
+ }
35940
+ const complexFields = caseField?.field_type?.complex_fields;
35941
+ if (!complexFields || !value || !FieldsUtils.isNonEmptyObject(value)) {
35942
+ return false;
35943
+ }
35944
+ return complexFields.some((subField) => hasActivePvpFlagInCaseField(subField, value[subField.id]));
35945
+ }
35946
+ function hasActivePvpFlagInCollectionField(caseField, value) {
35947
+ if (!value || !Array.isArray(value)) {
35948
+ return false;
35949
+ }
35950
+ const collectionFieldType = caseField?.field_type?.collection_field_type;
35951
+ if (FieldsUtils.isFlagsFieldType(collectionFieldType)) {
35952
+ return value.some((item) => hasActivePvpFlagInFlagsValue(item?.value));
35953
+ }
35954
+ if (collectionFieldType?.type !== 'Complex' || !collectionFieldType.complex_fields) {
35955
+ return false;
35956
+ }
35957
+ return value.some((item) => collectionFieldType.complex_fields.some((subField) => hasActivePvpFlagInCaseField(subField, item?.value?.[subField.id])));
35958
+ }
35959
+ function hasActivePvpFlagInFlagsValue(value) {
35960
+ if (!value || !FieldsUtils.isNonEmptyObject(value) || !value.details || !Array.isArray(value.details)) {
35961
+ return false;
35962
+ }
35963
+ return value.details.some((detail) => isActivePvpFlag(detail?.value ?? detail));
35964
+ }
35965
+
35868
35966
  const _c0$c = ["tabGroup"];
35869
35967
  const _c1$3 = (a0, a1) => [a0, false, undefined, true, a1];
35870
35968
  function CaseFullAccessViewComponent_div_0_Template(rf, ctx) { if (rf & 1) {
@@ -36168,6 +36266,7 @@ class CaseFullAccessViewComponent {
36168
36266
  activeCaseFlags = false;
36169
36267
  caseFlagsExternalUser = false;
36170
36268
  caseFlagsReadExternalMode = '#ARGUMENT(READ,EXTERNAL)';
36269
+ potentiallyViolentPersonFlagPrefix = `${PVP_DISPLAY_TEXT}.`;
36171
36270
  subs = [];
36172
36271
  eventId;
36173
36272
  isEventButtonClicked = false;
@@ -36472,9 +36571,7 @@ class CaseFullAccessViewComponent {
36472
36571
  }
36473
36572
  hasActiveCaseFlags() {
36474
36573
  // Determine which tab contains the FlagLauncher CaseField type, from the CaseView object in the snapshot data
36475
- const caseFlagsTab = this.caseDetails?.tabs
36476
- ? (this.caseDetails.tabs).filter((tab) => tab.fields && tab.fields.some((caseField) => FieldsUtils.isFlagLauncherCaseField(caseField)))[0]
36477
- : null;
36574
+ const caseFlagsTab = this.caseDetails?.tabs?.find((tab) => tab.fields?.some((caseField) => FieldsUtils.isFlagLauncherCaseField(caseField))) ?? null;
36478
36575
  if (caseFlagsTab) {
36479
36576
  // Check whether the FlagLauncher CaseField is in external mode or not; the notification banner should not be
36480
36577
  // displayed for external users
@@ -36489,8 +36586,12 @@ class CaseFullAccessViewComponent {
36489
36586
  return FieldsUtils.countActiveFlagsInCaseField(active, caseFlag);
36490
36587
  }, 0);
36491
36588
  if (activeCaseFlags > 0) {
36492
- const description = activeCaseFlags > 1
36589
+ const hasActivePotentiallyViolentPersonFlag = this.hasActivePotentiallyViolentPersonFlag(caseFlagsTab.fields);
36590
+ const baseDescription = activeCaseFlags > 1
36493
36591
  ? `There are ${activeCaseFlags} active flags on this case.` : 'There is 1 active flag on this case.';
36592
+ const description = hasActivePotentiallyViolentPersonFlag
36593
+ ? `${this.potentiallyViolentPersonFlagPrefix} ${baseDescription}`
36594
+ : baseDescription;
36494
36595
  // Initialise and display notification banner
36495
36596
  this.notificationBannerConfig = {
36496
36597
  bannerType: NotificationBannerType.INFORMATION,
@@ -36507,6 +36608,9 @@ class CaseFullAccessViewComponent {
36507
36608
  }
36508
36609
  return false;
36509
36610
  }
36611
+ hasActivePotentiallyViolentPersonFlag(caseFields) {
36612
+ return hasActivePvpFlagInCaseFields(caseFields);
36613
+ }
36510
36614
  /**
36511
36615
  * Indicates that a CaseField is to be displayed without a label, as is expected for all ComponentLauncher-type
36512
36616
  * fields.
@@ -36528,7 +36632,10 @@ class CaseFullAccessViewComponent {
36528
36632
  }
36529
36633
  }
36530
36634
  sortTabFieldsAndFilterTabs(tabs) {
36531
- return tabs?.map((tab) => Object.assign({}, tab, { fields: this.orderService.sort(tab.fields) }))
36635
+ return tabs?.map((tab) => ({
36636
+ ...tab,
36637
+ fields: this.orderService.sort(tab.fields)
36638
+ }))
36532
36639
  .filter((tab) => ShowCondition.getInstance(tab.show_condition).matchByContextFields(this.caseFields));
36533
36640
  }
36534
36641
  getTabFields() {
@@ -36618,7 +36725,7 @@ class CaseFullAccessViewComponent {
36618
36725
  type: ViewChild,
36619
36726
  args: ['tabGroup', { static: false }]
36620
36727
  }] }); })();
36621
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseFullAccessViewComponent, { className: "CaseFullAccessViewComponent", filePath: "lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.ts", lineNumber: 47 }); })();
36728
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseFullAccessViewComponent, { className: "CaseFullAccessViewComponent", filePath: "lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.ts", lineNumber: 48 }); })();
36622
36729
 
36623
36730
  class PrintUrlPipe {
36624
36731
  appConfig;