@hmcts/rpx-xui-common-lib 1.7.18-caa-case-share-ui-changes-6 → 1.7.19-create-booking

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 (32) hide show
  1. package/bundles/hmcts-rpx-xui-common-lib.umd.js +28 -100
  2. package/bundles/hmcts-rpx-xui-common-lib.umd.js.map +1 -1
  3. package/bundles/hmcts-rpx-xui-common-lib.umd.min.js +1 -1
  4. package/bundles/hmcts-rpx-xui-common-lib.umd.min.js.map +1 -1
  5. package/esm2015/hmcts-rpx-xui-common-lib.js +2 -2
  6. package/esm2015/lib/components/search-location/search-location.component.js +2 -3
  7. package/esm2015/lib/components/selected-case/selected-case.component.js +7 -1
  8. package/esm2015/lib/components/share-case/share-case.component.js +14 -88
  9. package/esm2015/lib/models/case-share.model.js +1 -7
  10. package/esm2015/lib/models/index.js +2 -2
  11. package/esm2015/lib/models/person.model.js +1 -3
  12. package/esm2015/lib/services/case-sharing-state/case-sharing-state.service.js +6 -8
  13. package/esm2015/public-api.js +2 -2
  14. package/esm5/hmcts-rpx-xui-common-lib.js +2 -2
  15. package/esm5/lib/components/search-location/search-location.component.js +2 -3
  16. package/esm5/lib/components/selected-case/selected-case.component.js +10 -1
  17. package/esm5/lib/components/share-case/share-case.component.js +14 -97
  18. package/esm5/lib/models/case-share.model.js +1 -7
  19. package/esm5/lib/models/index.js +2 -2
  20. package/esm5/lib/models/person.model.js +1 -3
  21. package/esm5/lib/services/case-sharing-state/case-sharing-state.service.js +6 -8
  22. package/esm5/public-api.js +2 -2
  23. package/fesm2015/hmcts-rpx-xui-common-lib.js +33 -86
  24. package/fesm2015/hmcts-rpx-xui-common-lib.js.map +1 -1
  25. package/fesm5/hmcts-rpx-xui-common-lib.js +37 -96
  26. package/fesm5/hmcts-rpx-xui-common-lib.js.map +1 -1
  27. package/hmcts-rpx-xui-common-lib.metadata.json +1 -1
  28. package/lib/components/selected-case/selected-case.component.d.ts +1 -0
  29. package/lib/components/share-case/share-case.component.d.ts +2 -22
  30. package/lib/models/case-share.model.d.ts +0 -4
  31. package/lib/models/person.model.d.ts +0 -2
  32. package/package.json +1 -1
@@ -2066,13 +2066,11 @@
2066
2066
  * @return {?}
2067
2067
  */
2068
2068
  function (caseId) {
2069
- if (this.caseState.length > 1) {
2070
- for (var i = 0, l = this.caseState.length; i < l; i++) {
2071
- if (this.caseState[i].caseId === caseId) {
2072
- this.caseState.splice(i, 1);
2073
- this.subject.next(this.caseState);
2074
- return;
2075
- }
2069
+ for (var i = 0, l = this.caseState.length; i < l; i++) {
2070
+ if (this.caseState[i].caseId === caseId) {
2071
+ this.caseState.splice(i, 1);
2072
+ this.subject.next(this.caseState);
2073
+ return;
2076
2074
  }
2077
2075
  }
2078
2076
  };
@@ -2303,6 +2301,15 @@
2303
2301
  this.combinedSortedShares = this.combineAndSortShares(sharedWith, pendingShares);
2304
2302
  }
2305
2303
  };
2304
+ /**
2305
+ * @return {?}
2306
+ */
2307
+ SelectedCaseComponent.prototype.onUnselect = /**
2308
+ * @return {?}
2309
+ */
2310
+ function () {
2311
+ this.unselect.emit(this.sharedCase);
2312
+ };
2306
2313
  /**
2307
2314
  * @param {?} c
2308
2315
  * @return {?}
@@ -2935,17 +2942,6 @@
2935
2942
  return ShareCaseConfirmComponent;
2936
2943
  }());
2937
2944
 
2938
- /**
2939
- * @fileoverview added by tsickle
2940
- * Generated from: lib/models/case-share.model.ts
2941
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2942
- */
2943
- /** @enum {string} */
2944
- var SharedCaseErrorMessages = {
2945
- OneCaseMustBeSelected: "At least one case must be selected",
2946
- NoChangesRequested: "You have not requested any changes to case sharing",
2947
- };
2948
-
2949
2945
  /**
2950
2946
  * @fileoverview added by tsickle
2951
2947
  * Generated from: lib/components/user-select/user-select.component.ts
@@ -3067,22 +3063,16 @@
3067
3063
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3068
3064
  */
3069
3065
  var ShareCaseComponent = /** @class */ (function () {
3070
- function ShareCaseComponent(stateService, router) {
3066
+ function ShareCaseComponent(stateService) {
3071
3067
  this.stateService = stateService;
3072
- this.router = router;
3073
3068
  this.shareCases = []; // cases selected for sharing
3074
- this.continueAllowed = false;
3069
+ // cases selected for sharing
3075
3070
  this.removeUserFromCaseToggleOn = false;
3076
3071
  this.users = []; // users of this organisation the cases can be shared with
3077
3072
  // users of this organisation the cases can be shared with
3078
3073
  this.confirmLink = '';
3079
- this.cancelLink = '';
3080
- this.showRemoveUsers = false;
3081
- this.fnTitle = '';
3082
- this.title = '';
3083
3074
  this.unselect = new i0.EventEmitter();
3084
3075
  this.synchronizeStore = new i0.EventEmitter();
3085
- this.validationErrors = [];
3086
3076
  }
3087
3077
  /**
3088
3078
  * @return {?}
@@ -3098,16 +3088,8 @@
3098
3088
  */function (shareCases) {
3099
3089
  _this.shareCases = shareCases;
3100
3090
  _this.stateService.setCases(shareCases);
3101
- // Set the config to be used by the xuilib-gov-uk-error-message component, in particular the element ID to
3102
- // which the error message is associated
3103
- if (shareCases) {
3104
- _this.selectedCasesErrorMessageConfig = {
3105
- id: shareCases.length > 0 ? 'cases' : 'noCaseDisplay'
3106
- };
3107
- }
3108
3091
  }));
3109
3092
  this.shareCases$ = this.stateService.state;
3110
- this.shareCaseErrorMessage = { isInvalid: false, messages: [] };
3111
3093
  };
3112
3094
  /**
3113
3095
  * @param {?} c
@@ -3118,16 +3100,8 @@
3118
3100
  * @return {?}
3119
3101
  */
3120
3102
  function (c) {
3121
- this.validationErrors = [];
3122
- if (this.stateService.getCases().length === 1) {
3123
- this.validationErrors.push({ id: 'cases', message: SharedCaseErrorMessages.OneCaseMustBeSelected });
3124
- this.shareCaseErrorMessage = { isInvalid: true, messages: [SharedCaseErrorMessages.OneCaseMustBeSelected] };
3125
- window.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
3126
- }
3127
- else {
3128
- this.unselect.emit(c);
3129
- this.stateService.removeCase(c.caseId);
3130
- }
3103
+ this.unselect.emit(c);
3104
+ this.stateService.removeCase(c.caseId);
3131
3105
  };
3132
3106
  /**
3133
3107
  * @param {?} event
@@ -3176,25 +3150,14 @@
3176
3150
  return this.selectedUser === null || this.shareCases.length === 0;
3177
3151
  };
3178
3152
  /**
3179
- * Function originally used to set disabled state of "Continue" button, now called by the button click handler to
3180
- * control whether navigation to the confirmation page is allowed. It is prevented if no changes have been made
3181
- */
3182
- /**
3183
- * Function originally used to set disabled state of "Continue" button, now called by the button click handler to
3184
- * control whether navigation to the confirmation page is allowed. It is prevented if no changes have been made
3185
3153
  * @return {?}
3186
3154
  */
3187
- ShareCaseComponent.prototype.setContinueAllowed = /**
3188
- * Function originally used to set disabled state of "Continue" button, now called by the button click handler to
3189
- * control whether navigation to the confirmation page is allowed. It is prevented if no changes have been made
3155
+ ShareCaseComponent.prototype.isDisabledContinue = /**
3190
3156
  * @return {?}
3191
3157
  */
3192
3158
  function () {
3193
- var _this = this;
3194
- // Always start with continueAllowed = false. This covers the scenario where a user might add someone for sharing
3195
- // a case (so, continueAllowed = true), then removes the same user before trying to continue. This would
3196
- // erroneously leave continueAllowed as true
3197
- this.continueAllowed = false;
3159
+ /** @type {?} */
3160
+ var isDisabled = true;
3198
3161
  this.shareCases$.subscribe(( /**
3199
3162
  * @param {?} shareCases
3200
3163
  * @return {?}
@@ -3204,11 +3167,11 @@
3204
3167
  for (var shareCases_1 = __values(shareCases), shareCases_1_1 = shareCases_1.next(); !shareCases_1_1.done; shareCases_1_1 = shareCases_1.next()) {
3205
3168
  var caseState = shareCases_1_1.value;
3206
3169
  if (caseState.pendingShares && caseState.pendingShares.length > 0) {
3207
- _this.continueAllowed = true;
3170
+ isDisabled = false;
3208
3171
  break;
3209
3172
  }
3210
3173
  if (caseState.pendingUnshares && caseState.pendingUnshares.length > 0) {
3211
- _this.continueAllowed = true;
3174
+ isDisabled = false;
3212
3175
  break;
3213
3176
  }
3214
3177
  }
@@ -3227,6 +3190,7 @@
3227
3190
  }
3228
3191
  }
3229
3192
  }));
3193
+ return isDisabled;
3230
3194
  };
3231
3195
  /**
3232
3196
  * @param {?} sharedCase
@@ -3266,38 +3230,17 @@
3266
3230
  }
3267
3231
  this.stateService.setCases(this.shareCases);
3268
3232
  };
3269
- /**
3270
- * @return {?}
3271
- */
3272
- ShareCaseComponent.prototype.onContinue = /**
3273
- * @return {?}
3274
- */
3275
- function () {
3276
- this.setContinueAllowed();
3277
- // If continuation is not allowed, set an error message
3278
- if (!this.continueAllowed) {
3279
- this.validationErrors = [];
3280
- this.validationErrors.push({ id: 'cases', message: SharedCaseErrorMessages.NoChangesRequested });
3281
- this.shareCaseErrorMessage = { isInvalid: true, messages: [SharedCaseErrorMessages.NoChangesRequested] };
3282
- window.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
3283
- }
3284
- // Navigate to confirmation page only if allowed to continue
3285
- if (this.continueAllowed) {
3286
- this.router.navigate([this.confirmLink]);
3287
- }
3288
- };
3289
3233
  ShareCaseComponent.decorators = [
3290
3234
  { type: i0.Component, args: [{
3291
3235
  selector: 'xuilib-share-case',
3292
- template: "<xuilib-hmcts-error-summary\n [errorMessages]=\"validationErrors\"\n [header]=\"'There is a problem'\"\n></xuilib-hmcts-error-summary>\n<h1 *ngIf=\"title\" class=\"govuk-heading-xl govuk-!-margin-top-2\">\n <span *ngIf=\"fnTitle\" class=\"govuk-caption-xl\">{{fnTitle}}</span>\n {{title}}\n</h1>\n<div id=\"add-user\">\n <div class=\"govuk-form-group\">\n <label class=\"govuk-label govuk-!-font-weight-bold\" for=\"add-user-input\">{{addUserLabel}}</label>\n <span id=\"add-user-hint\" class=\"govuk-hint\">\n Search by name or email address. You can share access with as many people as you need.\n </span>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <xuilib-user-select\n id=\"add-user-input\"\n aria-describedby=\"add-user-hint\"\n [users]=\"users\"\n (selected)=\"onSelectedUser($event)\">\n </xuilib-user-select>\n </div>\n <div class=\"govuk-grid-column-one-thirds\">\n <button id=\"btn-add-user\" (click)=\"addUser()\" class=\"govuk-button govuk-button--secondary\" [disabled]=\"isDisabledAdd()\" title=\"Add user to selected cases\">Add</button>\n </div>\n </div>\n <details id=\"add-user-help\" class=\"govuk-details\" data-module=\"govuk-details\">\n <summary class=\"govuk-details__summary\">\n <span id=\"content-why-can-not-find-email\" class=\"govuk-details__summary-text\">\n Can't find an email address?\n </span>\n </summary>\n <div id=\"content-reason-can-not-find-email\" class=\"govuk-details__text\">\n If you can't find your colleague's email address, they will need to complete their registration. Contact your\n administrator for help.\n </div>\n </details>\n </div>\n <div class=\"govuk-form-group\" *ngIf=\"showRemoveUsers\">\n <label class=\"govuk-label govuk-!-font-weight-bold\" for=\"remove-user-input\">Remove a person from all cases</label>\n <span id=\"remove-user-hint\" class=\"govuk-hint\">\n Select a person to remove them from all selected cases.\n </span>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <select class=\"govuk-select\" id=\"remove-user-input\" aria-describedby=\"remove-user-hint\">\n <option value=\"{{user}}\" *ngFor=\"let user of users\">{{user.email}}</option>\n </select>\n </div>\n <div class=\"govuk-grid-column-one-thirds\">\n <button id=\"btn-remove-user\" class=\"govuk-button govuk-button--secondary\" title=\"Remove user from selected cases\">Remove</button>\n </div>\n </div>\n </div>\n</div>\n\n<div id=\"cases\" [ngClass]=\"{'govuk-form-group--error': shareCaseErrorMessage.messages && shareCaseErrorMessage.messages.length > 0}\">\n <h3 id=\"title-selected-cases\" class=\"govuk-heading-m\">Selected cases</h3>\n <xuilib-gov-uk-error-message [config]=\"selectedCasesErrorMessageConfig\" [errorMessage]=\"shareCaseErrorMessage\"></xuilib-gov-uk-error-message>\n <div *ngIf=\"shareCases && shareCases.length > 0\" class=\"govuk-accordion\" data-module=\"govuk-accordion\" id=\"accordion-with-summary-sections\">\n <xuilib-selected-case-list\n [shareCases$]=\"shareCases$\"\n [removeUserFromCaseToggleOn]=\"removeUserFromCaseToggleOn\"\n (unselect)=\"onUnselect($event)\"\n (synchronizeStore)=\"onSynchronizeStore($event)\"\n >\n </xuilib-selected-case-list>\n </div>\n\n <div id=\"noCaseDisplay\" *ngIf=\"shareCases && shareCases.length === 0\" class=\"govuk-hint\"\n [ngClass]=\"{'govuk-form-group--error': shareCaseErrorMessage.messages && shareCaseErrorMessage.messages.length > 0}\">\n No cases to display.\n </div>\n\n</div>\n\n<div id=\"share-case-nav\" class=\"govuk-button-group\">\n <button id=\"btn-continue\" class=\"govuk-button\" data-module=\"govuk-button\" (click)=\"onContinue()\" title=\"Continue\">Continue</button>\n <button id=\"btn-cancel\" class=\"govuk-button govuk-button--secondary\" data-module=\"govuk-button\" title=\"Cancel\" [routerLink]=\"cancelLink\">Cancel</button>\n</div>\n",
3293
- styles: ["select{width:100%}"]
3236
+ template: "<div id=\"add-user\">\n <label class=\"govuk-label govuk-!-font-weight-bold\" for=\"add-user-input\">Enter email address</label>\n <span id=\"add-user-hint\" class=\"govuk-hint\">\n Search by name or email address. You can only add people from your organisation individually - but you can add as many as you like.\n </span>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <xuilib-user-select\n id=\"add-user-input\"\n aria-describedby=\"add-user-hint\"\n [users]=\"users\"\n (selected)=\"onSelectedUser($event)\">\n </xuilib-user-select>\n </div>\n <div class=\"govuk-grid-column-one-thirds\">\n <button id=\"btn-add-user\" (click)=\"addUser()\" class=\"govuk-button\" [disabled]=\"isDisabledAdd()\" title=\"Add user to the case\">Add</button>\n </div>\n </div>\n <details id=\"add-user-help\" class=\"govuk-details\" data-module=\"govuk-details\">\n <summary class=\"govuk-details__summary\">\n <span id=\"content-why-can-not-find-email\" class=\"govuk-details__summary-text\">\n Can\u2019t find an email address?\n </span>\n </summary>\n <div id=\"content-reason-can-not-find-email\" class=\"govuk-details__text\">\n If you can\u2019t find your colleague\u2019s email address, they will need to complete their registration. Contact your\n administrator for help.\n </div>\n </details>\n</div>\n\n<div id=\"cases\">\n <h3 id=\"title-selected-cases\" class=\"govuk-heading-m\">Selected cases</h3>\n <div *ngIf=\"shareCases && shareCases.length > 0\" class=\"govuk-accordion\" data-module=\"govuk-accordion\" id=\"accordion-with-summary-sections\">\n <xuilib-selected-case-list\n [shareCases$]=\"shareCases$\"\n [removeUserFromCaseToggleOn]=\"removeUserFromCaseToggleOn\"\n (unselect)=\"onUnselect($event)\"\n (synchronizeStore)=\"onSynchronizeStore($event)\"\n >\n </xuilib-selected-case-list>\n </div>\n\n <div id=\"noCaseDisplay\" *ngIf=\"shareCases && shareCases.length === 0\" class=\"govuk-hint\">\n No cases to display.\n </div>\n\n</div>\n\n<div id=\"share-case-nav\">\n <button class=\"govuk-button\" [disabled]=\"isDisabledContinue()\" title=\"Continue\" [routerLink]=\"confirmLink\">Continue</button>\n</div>\n",
3237
+ styles: [""]
3294
3238
  }] }
3295
3239
  ];
3296
3240
  /** @nocollapse */
3297
3241
  ShareCaseComponent.ctorParameters = function () {
3298
3242
  return [
3299
- { type: CaseSharingStateService },
3300
- { type: i2$2.Router }
3243
+ { type: CaseSharingStateService }
3301
3244
  ];
3302
3245
  };
3303
3246
  ShareCaseComponent.propDecorators = {
@@ -3305,11 +3248,6 @@
3305
3248
  shareCases$: [{ type: i0.Input }],
3306
3249
  users: [{ type: i0.Input }],
3307
3250
  confirmLink: [{ type: i0.Input }],
3308
- cancelLink: [{ type: i0.Input }],
3309
- addUserLabel: [{ type: i0.Input }],
3310
- showRemoveUsers: [{ type: i0.Input }],
3311
- fnTitle: [{ type: i0.Input }],
3312
- title: [{ type: i0.Input }],
3313
3251
  unselect: [{ type: i0.Output }],
3314
3252
  synchronizeStore: [{ type: i0.Output }],
3315
3253
  userSelect: [{ type: i0.ViewChild, args: [UserSelectComponent,] }]
@@ -3895,7 +3833,6 @@
3895
3833
  JUDICIAL: "Judicial",
3896
3834
  CASEWORKER: "Legal Ops",
3897
3835
  ADMIN: "Admin",
3898
- CTSC: "CTSC User",
3899
3836
  ALL: "All",
3900
3837
  };
3901
3838
  /** @enum {string} */
@@ -3903,7 +3840,6 @@
3903
3840
  JUDICIAL: "JUDICIAL",
3904
3841
  CASEWORKER: "LEGAL_OPERATIONS",
3905
3842
  ADMIN: "ADMIN",
3906
- CTSC: "CTSC",
3907
3843
  ALL: "ALL",
3908
3844
  };
3909
3845
 
@@ -3918,12 +3854,6 @@
3918
3854
  return RadioFilterFieldConfig;
3919
3855
  }());
3920
3856
 
3921
- /**
3922
- * @fileoverview added by tsickle
3923
- * Generated from: lib/models/index.ts
3924
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3925
- */
3926
-
3927
3857
  /**
3928
3858
  * @fileoverview added by tsickle
3929
3859
  * Generated from: lib/services/locations/location.service.ts
@@ -4268,8 +4198,7 @@
4268
4198
  bookingLocations = JSON.parse(this.sessionStorageService.getItem('bookingLocations'));
4269
4199
  }
4270
4200
  else if (this.bookingCheck === BookingCheckType.POSSIBLE_BOOKINGS) {
4271
- userLocations = JSON.parse(this.sessionStorageService.getItem('userLocations'));
4272
- this.serviceIds = JSON.parse(this.sessionStorageService.getItem('bookableServices'));
4201
+ this.serviceIds = this.serviceIds && this.serviceIds.length ? this.serviceIds : JSON.parse(this.sessionStorageService.getItem('bookableServices'));
4273
4202
  }
4274
4203
  return this.locationService.getAllLocations(this.serviceIds, this.locationType, term, userLocations, bookingLocations);
4275
4204
  };
@@ -7915,7 +7844,6 @@
7915
7844
  exports.dateValidator = dateValidator;
7916
7845
  exports.radioGroupValidator = radioGroupValidator;
7917
7846
  exports.HmctsSubNavigationComponent = HmctsSubNavigationComponent;
7918
- exports.SharedCaseErrorMessages = SharedCaseErrorMessages;
7919
7847
  exports.BadgeColour = BadgeColour;
7920
7848
  exports.DateBadgeColour = DateBadgeColour;
7921
7849
  exports.SECONDS_IN_A_DAY = SECONDS_IN_A_DAY;