@hmcts/ccd-case-ui-toolkit 4.14.0-rc.2 → 4.14.0-rc.4

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.
package/dist/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @hmcts/ccd-case-ui-toolkit - Case UI Toolkit
3
- * @version v4.14.0-rc.2
3
+ * @version v4.14.0-rc.4
4
4
  * @link undefined
5
5
  * @license MIT
6
6
  */
@@ -19891,6 +19891,7 @@ var CaseEditSubmitComponent = /** @class */ (function () {
19891
19891
  */
19892
19892
  CaseEditSubmitComponent.prototype.submit = function () {
19893
19893
  this.isSubmitting = true;
19894
+ this.sessionStorageService.removeItem('caseDetails');
19894
19895
  // We have to run the event completion checks if task in session storage
19895
19896
  // and if the task is in session storage, then is it associated to the case
19896
19897
  var taskInSessionStorage;
@@ -25175,13 +25176,14 @@ var services_1 = __webpack_require__(65010);
25175
25176
  var class_transformer_1 = __webpack_require__(86631);
25176
25177
  var navigation_notifier_service_1 = __webpack_require__(75005);
25177
25178
  var CaseResolver = /** @class */ (function () {
25178
- function CaseResolver(caseNotifier, casesService, draftService, navigationNotifierService, router) {
25179
+ function CaseResolver(caseNotifier, casesService, draftService, navigationNotifierService, router, sessionStorageService) {
25179
25180
  var _this = this;
25180
25181
  this.caseNotifier = caseNotifier;
25181
25182
  this.casesService = casesService;
25182
25183
  this.draftService = draftService;
25183
25184
  this.navigationNotifierService = navigationNotifierService;
25184
25185
  this.router = router;
25186
+ this.sessionStorageService = sessionStorageService;
25185
25187
  router.events
25186
25188
  .filter(function (event) { return event instanceof router_1.NavigationEnd; })
25187
25189
  .subscribe(function (event) {
@@ -25215,9 +25217,10 @@ var CaseResolver = /** @class */ (function () {
25215
25217
  };
25216
25218
  CaseResolver.prototype.getAndCacheCaseView = function (cid) {
25217
25219
  var _this = this;
25218
- if (this.cachedCaseView && this.cachedCaseView.case_id && this.cachedCaseView.case_id === cid) {
25219
- this.caseNotifier.announceCase(this.cachedCaseView);
25220
- return rxjs_1.of(this.cachedCaseView).toPromise();
25220
+ var caseDetails = class_transformer_1.plainToClassFromExist(new domain_1.CaseView(), JSON.parse(this.sessionStorageService.getItem('caseDetails')));
25221
+ if (caseDetails && caseDetails.case_id && caseDetails.case_id === cid) {
25222
+ this.caseNotifier.announceCase(caseDetails);
25223
+ return rxjs_1.of(caseDetails).toPromise();
25221
25224
  }
25222
25225
  else {
25223
25226
  if (domain_1.Draft.isDraft(cid)) {
@@ -25227,6 +25230,7 @@ var CaseResolver = /** @class */ (function () {
25227
25230
  return this.casesService
25228
25231
  .getCaseViewV2(cid)
25229
25232
  .pipe(operators_1.map(function (caseView) {
25233
+ _this.sessionStorageService.setItem('caseDetails', JSON.stringify(caseView));
25230
25234
  _this.cachedCaseView = class_transformer_1.plainToClassFromExist(new domain_1.CaseView(), caseView);
25231
25235
  _this.caseNotifier.announceCase(_this.cachedCaseView);
25232
25236
  return _this.cachedCaseView;
@@ -25239,6 +25243,7 @@ var CaseResolver = /** @class */ (function () {
25239
25243
  return this.draftService
25240
25244
  .getDraft(cid)
25241
25245
  .pipe(operators_1.map(function (caseView) {
25246
+ _this.sessionStorageService.setItem('caseDetails', JSON.stringify(caseView));
25242
25247
  _this.cachedCaseView = class_transformer_1.plainToClassFromExist(new domain_1.CaseView(), caseView);
25243
25248
  _this.caseNotifier.announceCase(_this.cachedCaseView);
25244
25249
  return _this.cachedCaseView;
@@ -25266,7 +25271,8 @@ var CaseResolver = /** @class */ (function () {
25266
25271
  case_editor_1.CasesService,
25267
25272
  services_1.DraftService,
25268
25273
  navigation_notifier_service_1.NavigationNotifierService,
25269
- router_1.Router])
25274
+ router_1.Router,
25275
+ services_1.SessionStorageService])
25270
25276
  ], CaseResolver);
25271
25277
  return CaseResolver;
25272
25278
  }());