@hmcts/ccd-case-ui-toolkit 6.16.2-ccpay-5.2.8 → 6.18.0-restricted-case-access
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/bundles/hmcts-ccd-case-ui-toolkit.umd.js +233 -112
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
- package/esm2015/lib/shared/components/case-editor/case-edit/case-edit.component.js +12 -14
- package/esm2015/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.js +24 -12
- package/esm2015/lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.js +19 -17
- package/esm2015/lib/shared/components/case-viewer/services/case.resolver.js +10 -6
- package/esm2015/lib/shared/services/fields/fields.utils.js +22 -1
- package/esm2015/lib/shared/services/form/form-value.service.js +37 -43
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js +118 -87
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
- package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts +12 -3
- package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.d.ts.map +1 -1
- package/lib/shared/components/case-viewer/services/case.resolver.d.ts.map +1 -1
- package/lib/shared/services/fields/fields.utils.d.ts +16 -0
- package/lib/shared/services/fields/fields.utils.d.ts.map +1 -1
- package/lib/shared/services/form/form-value.service.d.ts +14 -13
- package/lib/shared/services/form/form-value.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -481,7 +481,7 @@
|
|
|
481
481
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
482
482
|
PERFORMANCE OF THIS SOFTWARE.
|
|
483
483
|
***************************************************************************** */
|
|
484
|
-
/* global Reflect, Promise */
|
|
484
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
485
485
|
var extendStatics = function (d, b) {
|
|
486
486
|
extendStatics = Object.setPrototypeOf ||
|
|
487
487
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -560,11 +560,11 @@
|
|
|
560
560
|
if (_ = accept(result.set))
|
|
561
561
|
descriptor.set = _;
|
|
562
562
|
if (_ = accept(result.init))
|
|
563
|
-
initializers.
|
|
563
|
+
initializers.unshift(_);
|
|
564
564
|
}
|
|
565
565
|
else if (_ = accept(result)) {
|
|
566
566
|
if (kind === "field")
|
|
567
|
-
initializers.
|
|
567
|
+
initializers.unshift(_);
|
|
568
568
|
else
|
|
569
569
|
descriptor[key] = _;
|
|
570
570
|
}
|
|
@@ -851,6 +851,85 @@
|
|
|
851
851
|
throw new TypeError("Cannot use 'in' operator on non-object");
|
|
852
852
|
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
853
853
|
}
|
|
854
|
+
function __addDisposableResource(env, value, async) {
|
|
855
|
+
if (value !== null && value !== void 0) {
|
|
856
|
+
if (typeof value !== "object")
|
|
857
|
+
throw new TypeError("Object expected.");
|
|
858
|
+
var dispose;
|
|
859
|
+
if (async) {
|
|
860
|
+
if (!Symbol.asyncDispose)
|
|
861
|
+
throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
862
|
+
dispose = value[Symbol.asyncDispose];
|
|
863
|
+
}
|
|
864
|
+
if (dispose === void 0) {
|
|
865
|
+
if (!Symbol.dispose)
|
|
866
|
+
throw new TypeError("Symbol.dispose is not defined.");
|
|
867
|
+
dispose = value[Symbol.dispose];
|
|
868
|
+
}
|
|
869
|
+
if (typeof dispose !== "function")
|
|
870
|
+
throw new TypeError("Object not disposable.");
|
|
871
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
872
|
+
}
|
|
873
|
+
else if (async) {
|
|
874
|
+
env.stack.push({ async: true });
|
|
875
|
+
}
|
|
876
|
+
return value;
|
|
877
|
+
}
|
|
878
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
879
|
+
var e = new Error(message);
|
|
880
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
881
|
+
};
|
|
882
|
+
function __disposeResources(env) {
|
|
883
|
+
function fail(e) {
|
|
884
|
+
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
885
|
+
env.hasError = true;
|
|
886
|
+
}
|
|
887
|
+
function next() {
|
|
888
|
+
while (env.stack.length) {
|
|
889
|
+
var rec = env.stack.pop();
|
|
890
|
+
try {
|
|
891
|
+
var result = rec.dispose && rec.dispose.call(rec.value);
|
|
892
|
+
if (rec.async)
|
|
893
|
+
return Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
|
|
894
|
+
}
|
|
895
|
+
catch (e) {
|
|
896
|
+
fail(e);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
if (env.hasError)
|
|
900
|
+
throw env.error;
|
|
901
|
+
}
|
|
902
|
+
return next();
|
|
903
|
+
}
|
|
904
|
+
var tslib_es6 = {
|
|
905
|
+
__extends: __extends,
|
|
906
|
+
__assign: __assign,
|
|
907
|
+
__rest: __rest,
|
|
908
|
+
__decorate: __decorate,
|
|
909
|
+
__param: __param,
|
|
910
|
+
__metadata: __metadata,
|
|
911
|
+
__awaiter: __awaiter,
|
|
912
|
+
__generator: __generator,
|
|
913
|
+
__createBinding: __createBinding,
|
|
914
|
+
__exportStar: __exportStar,
|
|
915
|
+
__values: __values,
|
|
916
|
+
__read: __read,
|
|
917
|
+
__spread: __spread,
|
|
918
|
+
__spreadArrays: __spreadArrays,
|
|
919
|
+
__spreadArray: __spreadArray,
|
|
920
|
+
__await: __await,
|
|
921
|
+
__asyncGenerator: __asyncGenerator,
|
|
922
|
+
__asyncDelegator: __asyncDelegator,
|
|
923
|
+
__asyncValues: __asyncValues,
|
|
924
|
+
__makeTemplateObject: __makeTemplateObject,
|
|
925
|
+
__importStar: __importStar,
|
|
926
|
+
__importDefault: __importDefault,
|
|
927
|
+
__classPrivateFieldGet: __classPrivateFieldGet,
|
|
928
|
+
__classPrivateFieldSet: __classPrivateFieldSet,
|
|
929
|
+
__classPrivateFieldIn: __classPrivateFieldIn,
|
|
930
|
+
__addDisposableResource: __addDisposableResource,
|
|
931
|
+
__disposeResources: __disposeResources,
|
|
932
|
+
};
|
|
854
933
|
|
|
855
934
|
var _c0$X = function (a0) { return { "govuk-input--error": a0 }; };
|
|
856
935
|
function DateInputComponent_div_16_Template(rf, ctx) {
|
|
@@ -4124,18 +4203,39 @@
|
|
|
4124
4203
|
}
|
|
4125
4204
|
return this.isFlagsFieldType(caseField.field_type);
|
|
4126
4205
|
};
|
|
4206
|
+
/**
|
|
4207
|
+
* @deprecated Use {@link isCaseFieldOfType} instead, passing 'FlagLauncher' as the single type in the `types` array
|
|
4208
|
+
*/
|
|
4127
4209
|
FieldsUtils.isFlagLauncherCaseField = function (caseField) {
|
|
4128
4210
|
if (!caseField) {
|
|
4129
4211
|
return false;
|
|
4130
4212
|
}
|
|
4131
4213
|
return caseField.field_type.type === 'FlagLauncher';
|
|
4132
4214
|
};
|
|
4215
|
+
/**
|
|
4216
|
+
* @deprecated Use {@link isCaseFieldOfType} instead, passing 'ComponentLauncher' as the single type in the `types`
|
|
4217
|
+
* array
|
|
4218
|
+
*/
|
|
4133
4219
|
FieldsUtils.isComponentLauncherCaseField = function (caseField) {
|
|
4134
4220
|
if (!caseField) {
|
|
4135
4221
|
return false;
|
|
4136
4222
|
}
|
|
4137
4223
|
return caseField.field_type.type === 'ComponentLauncher';
|
|
4138
4224
|
};
|
|
4225
|
+
/**
|
|
4226
|
+
* Checks if a {@link CaseField} is of one of the given field types.
|
|
4227
|
+
*
|
|
4228
|
+
* @param caseField The `CaseField` to check
|
|
4229
|
+
* @param types An array of one or more field types
|
|
4230
|
+
* @returns `true` if the `CaseField` type is one of those in the array of types to check against; `false`
|
|
4231
|
+
* otherwise or if `caseField` or `types` are falsy
|
|
4232
|
+
*/
|
|
4233
|
+
FieldsUtils.isCaseFieldOfType = function (caseField, types) {
|
|
4234
|
+
if (!caseField || !types) {
|
|
4235
|
+
return false;
|
|
4236
|
+
}
|
|
4237
|
+
return types.some(function (type) { return type === caseField.field_type.type; });
|
|
4238
|
+
};
|
|
4139
4239
|
FieldsUtils.isLinkedCasesCaseField = function (caseField) {
|
|
4140
4240
|
return FieldsUtils.isComponentLauncherCaseField(caseField) &&
|
|
4141
4241
|
caseField.id === 'LinkedCasesComponentLauncher';
|
|
@@ -6323,65 +6423,70 @@
|
|
|
6323
6423
|
}
|
|
6324
6424
|
};
|
|
6325
6425
|
/**
|
|
6326
|
-
* Remove the
|
|
6426
|
+
* Remove from the top level of the form data any case fields of a given type or types that are not intended to be
|
|
6427
|
+
* persisted. This function is intended to remove "special" case field types from the data, such as FlagLauncher or
|
|
6428
|
+
* ComponentLauncher fields.
|
|
6327
6429
|
*
|
|
6328
|
-
* @param data The object tree of form values on which to perform the removal
|
|
6430
|
+
* @param data The object tree of form values on which to perform the removal at the top level only
|
|
6329
6431
|
* @param caseFields The list of underlying {@link CaseField} domain model objects for each field
|
|
6432
|
+
* @param types An array of one or more field types
|
|
6330
6433
|
*/
|
|
6331
|
-
FormValueService.prototype.
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6434
|
+
FormValueService.prototype.removeCaseFieldsOfType = function (data, caseFields, types) {
|
|
6435
|
+
var e_12, _a;
|
|
6436
|
+
if (data && caseFields && caseFields.length > 0 && types.length > 0) {
|
|
6437
|
+
var caseFieldsToRemove = caseFields.filter(function (caseField) { return FieldsUtils.isCaseFieldOfType(caseField, types); });
|
|
6438
|
+
try {
|
|
6439
|
+
for (var caseFieldsToRemove_1 = __values(caseFieldsToRemove), caseFieldsToRemove_1_1 = caseFieldsToRemove_1.next(); !caseFieldsToRemove_1_1.done; caseFieldsToRemove_1_1 = caseFieldsToRemove_1.next()) {
|
|
6440
|
+
var caseField = caseFieldsToRemove_1_1.value;
|
|
6441
|
+
delete data[caseField.id];
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
6445
|
+
finally {
|
|
6446
|
+
try {
|
|
6447
|
+
if (caseFieldsToRemove_1_1 && !caseFieldsToRemove_1_1.done && (_a = caseFieldsToRemove_1.return)) _a.call(caseFieldsToRemove_1);
|
|
6448
|
+
}
|
|
6449
|
+
finally { if (e_12) throw e_12.error; }
|
|
6337
6450
|
}
|
|
6338
6451
|
}
|
|
6339
6452
|
};
|
|
6340
6453
|
/**
|
|
6341
|
-
*
|
|
6454
|
+
* Re-populate the form data from the values held in the case fields. This is necessary in order to pick up, for
|
|
6455
|
+
* each `Flags` field, any flag details data not currently present.
|
|
6456
|
+
*
|
|
6457
|
+
* `Flags` fields may be contained in other `CaseField` instances, either as a sub-field of a Complex field, or
|
|
6458
|
+
* fields in a collection (or sub-fields of Complex fields in a collection). Therefore, it is necessary to
|
|
6459
|
+
* iterate through all `CaseField`s.
|
|
6342
6460
|
*
|
|
6343
6461
|
* @param data The object tree of form values on which to perform the data population
|
|
6344
6462
|
* @param caseFields The list of underlying {@link CaseField} domain model objects for each field
|
|
6345
6463
|
*/
|
|
6346
|
-
FormValueService.prototype.
|
|
6347
|
-
if (data && caseFields && caseFields.length > 0
|
|
6348
|
-
|
|
6349
|
-
//
|
|
6350
|
-
|
|
6351
|
-
caseFields.filter(function (caseField) { return !FieldsUtils.isFlagLauncherCaseField(caseField); })
|
|
6464
|
+
FormValueService.prototype.repopulateFormDataFromCaseFieldValues = function (data, caseFields) {
|
|
6465
|
+
if (data && caseFields && caseFields.length > 0 &&
|
|
6466
|
+
caseFields.findIndex(function (caseField) { return FieldsUtils.isCaseFieldOfType(caseField, ['FlagLauncher']); }) > -1) {
|
|
6467
|
+
// Ignore the FlagLauncher CaseField because it does not hold any values
|
|
6468
|
+
caseFields.filter(function (caseField) { return !FieldsUtils.isCaseFieldOfType(caseField, ['FlagLauncher']); })
|
|
6352
6469
|
.forEach(function (caseField) {
|
|
6353
|
-
// Ensure that the data object is populated for all
|
|
6354
|
-
//
|
|
6470
|
+
// Ensure that the data object is populated for all CaseField keys it contains, even if for a given
|
|
6471
|
+
// CaseField key, the data object has a falsy value (hence the use of hasOwnProperty() for the check below)
|
|
6472
|
+
// See https://tools.hmcts.net/jira/browse/EUI-7377
|
|
6355
6473
|
if (data.hasOwnProperty(caseField.id) && caseField.value) {
|
|
6356
|
-
// Create new object for the
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
Object.keys(data[caseField.id]).forEach(function (key) {
|
|
6361
|
-
if (caseField.value.hasOwnProperty(key)) {
|
|
6362
|
-
data[caseField.id][key] = caseField.value[key];
|
|
6363
|
-
}
|
|
6364
|
-
});
|
|
6474
|
+
// Create new object for the CaseField ID within the data object, if necessary (i.e. if the current value
|
|
6475
|
+
// is falsy)
|
|
6476
|
+
if (!data[caseField.id]) {
|
|
6477
|
+
data[caseField.id] = {};
|
|
6365
6478
|
}
|
|
6479
|
+
// Copy all values from the corresponding CaseField; this ensures all nested flag data (for example, a
|
|
6480
|
+
// Flags field within a Complex field or a collection of Complex fields) is copied across
|
|
6481
|
+
Object.keys(data[caseField.id]).forEach(function (key) {
|
|
6482
|
+
if (caseField.value.hasOwnProperty(key)) {
|
|
6483
|
+
data[caseField.id][key] = caseField.value[key];
|
|
6484
|
+
}
|
|
6485
|
+
});
|
|
6366
6486
|
}
|
|
6367
6487
|
});
|
|
6368
6488
|
}
|
|
6369
6489
|
};
|
|
6370
|
-
/**
|
|
6371
|
-
* Remove the ComponentLauncher case field, which is not intended to be persisted.
|
|
6372
|
-
*
|
|
6373
|
-
* @param data The object tree of form values on which to perform the removal
|
|
6374
|
-
* @param caseFields The list of underlying {@link CaseField} domain model objects for each field
|
|
6375
|
-
*/
|
|
6376
|
-
FormValueService.prototype.removeComponentLauncherField = function (data, caseFields) {
|
|
6377
|
-
if (data && caseFields && caseFields.length > 0) {
|
|
6378
|
-
var componentLauncherCaseField = caseFields.filter(function (caseField) { return FieldsUtils.isComponentLauncherCaseField(caseField); });
|
|
6379
|
-
if (componentLauncherCaseField.length > 0) {
|
|
6380
|
-
// There should be only one ComponentLauncher case field
|
|
6381
|
-
delete data[componentLauncherCaseField[0].id];
|
|
6382
|
-
}
|
|
6383
|
-
}
|
|
6384
|
-
};
|
|
6385
6490
|
/**
|
|
6386
6491
|
* Populate the linked cases from the data held in its corresponding CaseField.
|
|
6387
6492
|
*
|
|
@@ -6390,7 +6495,7 @@
|
|
|
6390
6495
|
*/
|
|
6391
6496
|
FormValueService.prototype.populateLinkedCasesDetailsFromCaseFields = function (data, caseFields) {
|
|
6392
6497
|
if (data && caseFields && caseFields.length > 0) {
|
|
6393
|
-
caseFields.filter(function (caseField) { return !FieldsUtils.
|
|
6498
|
+
caseFields.filter(function (caseField) { return !FieldsUtils.isCaseFieldOfType(caseField, ['ComponentLauncher']); })
|
|
6394
6499
|
.forEach(function (caseField) {
|
|
6395
6500
|
if (data.hasOwnProperty('caseLinks') && caseField.value) {
|
|
6396
6501
|
data[caseField.id] = caseField.value;
|
|
@@ -9614,7 +9719,9 @@
|
|
|
9614
9719
|
form: this.form,
|
|
9615
9720
|
});
|
|
9616
9721
|
/* istanbul ignore else */
|
|
9617
|
-
if (!nextPage &&
|
|
9722
|
+
if (!nextPage &&
|
|
9723
|
+
!(this.eventTrigger.show_summary || this.eventTrigger.show_summary === null) &&
|
|
9724
|
+
!this.eventTrigger.show_event_notes) {
|
|
9618
9725
|
this.submitForm({
|
|
9619
9726
|
eventTrigger: this.eventTrigger,
|
|
9620
9727
|
form: this.form,
|
|
@@ -9706,16 +9813,13 @@
|
|
|
9706
9813
|
// Remove collection fields that have "min" validation of greater than zero set on the FieldType but are empty;
|
|
9707
9814
|
// these will fail validation
|
|
9708
9815
|
this.formValueService.removeEmptyCollectionsWithMinValidation(caseEventData.data, eventTrigger.case_fields);
|
|
9709
|
-
//
|
|
9710
|
-
//
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
this.formValueService.populateLinkedCasesDetailsFromCaseFields(caseEventData.data, eventTrigger.case_fields);
|
|
9717
|
-
this.formValueService.removeComponentLauncherField(caseEventData.data, eventTrigger.case_fields);
|
|
9718
|
-
}
|
|
9816
|
+
// For Case Flag submissions (where a FlagLauncher field is present in the event trigger), the flag details data
|
|
9817
|
+
// needs populating for each Flags field, then the FlagLauncher field needs removing
|
|
9818
|
+
this.formValueService.repopulateFormDataFromCaseFieldValues(caseEventData.data, eventTrigger.case_fields);
|
|
9819
|
+
// Data population step required for Linked Cases
|
|
9820
|
+
this.formValueService.populateLinkedCasesDetailsFromCaseFields(caseEventData.data, eventTrigger.case_fields);
|
|
9821
|
+
// Remove "Launcher"-type fields (these have no values and are not intended to be persisted)
|
|
9822
|
+
this.formValueService.removeCaseFieldsOfType(caseEventData.data, eventTrigger.case_fields, ['FlagLauncher', 'ComponentLauncher']);
|
|
9719
9823
|
caseEventData.event_token = eventTrigger.event_token;
|
|
9720
9824
|
caseEventData.ignore_warning = this.ignoreWarning;
|
|
9721
9825
|
if (this.confirmation) {
|
|
@@ -9837,8 +9941,7 @@
|
|
|
9837
9941
|
_this.sessionStorageService.removeItem('eventUrl');
|
|
9838
9942
|
var confirmation = _this.buildConfirmation(response);
|
|
9839
9943
|
if (confirmation && (confirmation.getHeader() || confirmation.getBody())) {
|
|
9840
|
-
|
|
9841
|
-
_this.confirm(confirmation).finally();
|
|
9944
|
+
_this.confirm(confirmation);
|
|
9842
9945
|
}
|
|
9843
9946
|
else {
|
|
9844
9947
|
_this.emitSubmitted(response);
|
|
@@ -10599,7 +10702,7 @@
|
|
|
10599
10702
|
this.wizard = this.caseEdit.wizard;
|
|
10600
10703
|
this.caseFields = this.getCaseFields();
|
|
10601
10704
|
this.syncCaseEditDataService();
|
|
10602
|
-
this.route.params
|
|
10705
|
+
this.routeParamsSub = this.route.params
|
|
10603
10706
|
.subscribe(function (params) {
|
|
10604
10707
|
var _a, _b;
|
|
10605
10708
|
var pageId = params['page'];
|
|
@@ -10621,13 +10724,14 @@
|
|
|
10621
10724
|
}
|
|
10622
10725
|
});
|
|
10623
10726
|
CaseEditPageComponent.setFocusToTop();
|
|
10624
|
-
this.caseEditDataService.caseEditForm$.subscribe({
|
|
10727
|
+
this.caseEditFormSub = this.caseEditDataService.caseEditForm$.subscribe({
|
|
10625
10728
|
next: function (editForm) { return _this.editForm = editForm; }
|
|
10626
10729
|
});
|
|
10627
|
-
this.
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10730
|
+
this.caseIsLinkedCasesJourneyAtFinalStepSub =
|
|
10731
|
+
this.caseEditDataService.caseIsLinkedCasesJourneyAtFinalStep$.subscribe({
|
|
10732
|
+
next: function (isLinkedCasesJourneyAtFinalStep) { return _this.isLinkedCasesJourneyAtFinalStep = isLinkedCasesJourneyAtFinalStep; }
|
|
10733
|
+
});
|
|
10734
|
+
this.caseTriggerSubmitEventSub = this.caseEditDataService.caseTriggerSubmitEvent$.subscribe({
|
|
10631
10735
|
next: function (state) {
|
|
10632
10736
|
if (state) {
|
|
10633
10737
|
_this.caseEditDataService.setTriggerSubmitEvent(false);
|
|
@@ -10640,6 +10744,17 @@
|
|
|
10640
10744
|
CaseEditPageComponent.prototype.ngAfterViewChecked = function () {
|
|
10641
10745
|
this.cdRef.detectChanges();
|
|
10642
10746
|
};
|
|
10747
|
+
CaseEditPageComponent.prototype.ngOnDestroy = function () {
|
|
10748
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10749
|
+
(_a = this.routeParamsSub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
10750
|
+
(_b = this.caseEditFormSub) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
10751
|
+
(_c = this.caseIsLinkedCasesJourneyAtFinalStepSub) === null || _c === void 0 ? void 0 : _c.unsubscribe();
|
|
10752
|
+
(_d = this.caseTriggerSubmitEventSub) === null || _d === void 0 ? void 0 : _d.unsubscribe();
|
|
10753
|
+
(_e = this.validateSub) === null || _e === void 0 ? void 0 : _e.unsubscribe();
|
|
10754
|
+
(_f = this.dialogRefAfterClosedSub) === null || _f === void 0 ? void 0 : _f.unsubscribe();
|
|
10755
|
+
(_g = this.saveDraftSub) === null || _g === void 0 ? void 0 : _g.unsubscribe();
|
|
10756
|
+
(_h = this.caseFormValidationErrorsSub) === null || _h === void 0 ? void 0 : _h.unsubscribe();
|
|
10757
|
+
};
|
|
10643
10758
|
CaseEditPageComponent.prototype.applyValuesChanged = function (valuesChanged) {
|
|
10644
10759
|
this.formValuesChanged = valuesChanged;
|
|
10645
10760
|
};
|
|
@@ -10714,7 +10829,7 @@
|
|
|
10714
10829
|
_this.generateErrorMessage(casefield.field_type.collection_field_type.complex_fields, c.get('value'), id_1);
|
|
10715
10830
|
});
|
|
10716
10831
|
}
|
|
10717
|
-
else if (FieldsUtils.
|
|
10832
|
+
else if (FieldsUtils.isCaseFieldOfType(casefield, ['FlagLauncher'])) {
|
|
10718
10833
|
// Check whether the case field DisplayContextParameter is signalling "create" mode or "update" mode
|
|
10719
10834
|
// (expected always to be one of the two), to set the correct error message
|
|
10720
10835
|
var action = '';
|
|
@@ -10769,7 +10884,7 @@
|
|
|
10769
10884
|
this.caseEdit.error = null;
|
|
10770
10885
|
var caseEventData = this.buildCaseEventData();
|
|
10771
10886
|
var loadingSpinnerToken_1 = this.loadingService.register();
|
|
10772
|
-
this.caseEdit.validate(caseEventData, this.currentPage.id)
|
|
10887
|
+
this.validateSub = this.caseEdit.validate(caseEventData, this.currentPage.id)
|
|
10773
10888
|
.pipe(operators.finalize(function () {
|
|
10774
10889
|
_this.loadingService.unregister(loadingSpinnerToken_1);
|
|
10775
10890
|
}))
|
|
@@ -10788,10 +10903,10 @@
|
|
|
10788
10903
|
CaseEditPageComponent.setFocusToTop();
|
|
10789
10904
|
};
|
|
10790
10905
|
CaseEditPageComponent.prototype.updateFormData = function (jsonData) {
|
|
10791
|
-
var e_1,
|
|
10906
|
+
var e_1, _j;
|
|
10792
10907
|
try {
|
|
10793
|
-
for (var
|
|
10794
|
-
var caseFieldId =
|
|
10908
|
+
for (var _k = __values(Object.keys(jsonData.data)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
10909
|
+
var caseFieldId = _l.value;
|
|
10795
10910
|
/* istanbul ignore else */
|
|
10796
10911
|
if (this.pageWithFieldExists(caseFieldId)) {
|
|
10797
10912
|
this.updateEventTriggerCaseFields(caseFieldId, jsonData, this.caseEdit.eventTrigger);
|
|
@@ -10802,7 +10917,7 @@
|
|
|
10802
10917
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
10803
10918
|
finally {
|
|
10804
10919
|
try {
|
|
10805
|
-
if (
|
|
10920
|
+
if (_l && !_l.done && (_j = _k.return)) _j.call(_k);
|
|
10806
10921
|
}
|
|
10807
10922
|
finally { if (e_1) throw e_1.error; }
|
|
10808
10923
|
}
|
|
@@ -10831,12 +10946,12 @@
|
|
|
10831
10946
|
CaseEditPageComponent.prototype.updateJsonDataObject = function (caseFieldId, jsonData, element) {
|
|
10832
10947
|
var _this = this;
|
|
10833
10948
|
return Object.keys(jsonData.data[caseFieldId]).reduce(function (acc, key) {
|
|
10834
|
-
var
|
|
10949
|
+
var _j;
|
|
10835
10950
|
var elementValue = element.value[key];
|
|
10836
10951
|
var jsonDataValue = jsonData.data[caseFieldId][key];
|
|
10837
10952
|
var hasElementGotValueProperty = _this.isAnObject(elementValue) && elementValue.value !== undefined;
|
|
10838
10953
|
var jsonDataOrElementValue = (jsonDataValue === null || jsonDataValue === void 0 ? void 0 : jsonDataValue.value) !== null && (jsonDataValue === null || jsonDataValue === void 0 ? void 0 : jsonDataValue.value) !== undefined ? jsonDataValue : elementValue;
|
|
10839
|
-
return Object.assign(Object.assign({}, acc), (
|
|
10954
|
+
return Object.assign(Object.assign({}, acc), (_j = {}, _j["" + key] = hasElementGotValueProperty ? jsonDataOrElementValue : jsonDataValue, _j));
|
|
10840
10955
|
}, {});
|
|
10841
10956
|
};
|
|
10842
10957
|
CaseEditPageComponent.prototype.isAnObject = function (property) {
|
|
@@ -10884,7 +10999,7 @@
|
|
|
10884
10999
|
if (this.eventTrigger.can_save_draft) {
|
|
10885
11000
|
if (this.formValuesChanged) {
|
|
10886
11001
|
var dialogRef = this.dialog.open(SaveOrDiscardDialogComponent, this.dialogConfig);
|
|
10887
|
-
dialogRef.afterClosed().subscribe(function (result) {
|
|
11002
|
+
this.dialogRefAfterClosedSub = dialogRef.afterClosed().subscribe(function (result) {
|
|
10888
11003
|
if (result === 'Discard') {
|
|
10889
11004
|
_this.discard();
|
|
10890
11005
|
}
|
|
@@ -10971,7 +11086,7 @@
|
|
|
10971
11086
|
var draftCaseEventData = this.formValueService.sanitise(this.editForm.value);
|
|
10972
11087
|
draftCaseEventData.event_token = this.eventTrigger.event_token;
|
|
10973
11088
|
draftCaseEventData.ignore_warning = this.caseEdit.ignoreWarning;
|
|
10974
|
-
this.caseEdit.saveDraft(draftCaseEventData).subscribe(function (draft) { return _this.eventTrigger.case_id = DRAFT_PREFIX + draft.id; }, function (error) { return _this.handleError(error); });
|
|
11089
|
+
this.saveDraftSub = this.caseEdit.saveDraft(draftCaseEventData).subscribe(function (draft) { return _this.eventTrigger.case_id = DRAFT_PREFIX + draft.id; }, function (error) { return _this.handleError(error); });
|
|
10975
11090
|
}
|
|
10976
11091
|
};
|
|
10977
11092
|
CaseEditPageComponent.prototype.getCaseFields = function () {
|
|
@@ -11039,7 +11154,7 @@
|
|
|
11039
11154
|
this.caseEditDataService.setCaseEventTriggerName(this.eventTrigger.name);
|
|
11040
11155
|
this.caseEditDataService.setCaseTitle(this.getCaseTitle());
|
|
11041
11156
|
this.caseEditDataService.setCaseEditForm(this.editForm);
|
|
11042
|
-
this.caseEditDataService.caseFormValidationErrors$.subscribe({
|
|
11157
|
+
this.caseFormValidationErrorsSub = this.caseEditDataService.caseFormValidationErrors$.subscribe({
|
|
11043
11158
|
next: function (validationErrors) { return _this.validationErrors = validationErrors; }
|
|
11044
11159
|
});
|
|
11045
11160
|
};
|
|
@@ -26788,9 +26903,10 @@
|
|
|
26788
26903
|
this.contextFields = this.getCaseFields();
|
|
26789
26904
|
// Indicates if the submission is for a Case Flag, as opposed to a "regular" form submission, by the presence of
|
|
26790
26905
|
// a FlagLauncher field in the event trigger
|
|
26791
|
-
this.caseEdit.isCaseFlagSubmission =
|
|
26906
|
+
this.caseEdit.isCaseFlagSubmission =
|
|
26907
|
+
this.eventTrigger.case_fields.some(function (caseField) { return FieldsUtils.isCaseFieldOfType(caseField, ['FlagLauncher']); });
|
|
26792
26908
|
this.caseEdit.isLinkedCasesSubmission =
|
|
26793
|
-
this.eventTrigger.case_fields.some(function (caseField) { return FieldsUtils.
|
|
26909
|
+
this.eventTrigger.case_fields.some(function (caseField) { return FieldsUtils.isCaseFieldOfType(caseField, ['ComponentLauncher']); });
|
|
26794
26910
|
this.pageTitle = this.caseEdit.isCaseFlagSubmission ? 'Review flag details' : 'Check your answers';
|
|
26795
26911
|
};
|
|
26796
26912
|
CaseEditSubmitComponent.prototype.ngOnDestroy = function () {
|
|
@@ -26863,49 +26979,50 @@
|
|
|
26863
26979
|
CaseEditSubmitComponent.prototype.checkYourAnswerFieldsToDisplayExists = function () {
|
|
26864
26980
|
var e_1, _d, e_2, _e;
|
|
26865
26981
|
/* istanbul ignore else */
|
|
26866
|
-
if (
|
|
26867
|
-
|
|
26868
|
-
|
|
26869
|
-
|
|
26870
|
-
|
|
26871
|
-
|
|
26872
|
-
|
|
26873
|
-
|
|
26874
|
-
|
|
26875
|
-
|
|
26876
|
-
|
|
26877
|
-
|
|
26878
|
-
|
|
26879
|
-
|
|
26880
|
-
return true;
|
|
26982
|
+
if (this.eventTrigger.show_summary || this.eventTrigger.show_summary === null) {
|
|
26983
|
+
try {
|
|
26984
|
+
for (var _f = __values(this.wizard.pages), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
26985
|
+
var page = _g.value;
|
|
26986
|
+
/* istanbul ignore else */
|
|
26987
|
+
if (page.case_fields && this.isShown(page)) {
|
|
26988
|
+
try {
|
|
26989
|
+
for (var _h = (e_2 = void 0, __values(page.case_fields)), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
26990
|
+
var field = _j.value;
|
|
26991
|
+
/* istanbul ignore else */
|
|
26992
|
+
if (this.canShowFieldInCYA(field)) {
|
|
26993
|
+
// at least one field needs showing
|
|
26994
|
+
return true;
|
|
26995
|
+
}
|
|
26881
26996
|
}
|
|
26882
26997
|
}
|
|
26883
|
-
|
|
26884
|
-
|
|
26885
|
-
|
|
26886
|
-
|
|
26887
|
-
|
|
26998
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
26999
|
+
finally {
|
|
27000
|
+
try {
|
|
27001
|
+
if (_j && !_j.done && (_e = _h.return)) _e.call(_h);
|
|
27002
|
+
}
|
|
27003
|
+
finally { if (e_2) throw e_2.error; }
|
|
26888
27004
|
}
|
|
26889
|
-
finally { if (e_2) throw e_2.error; }
|
|
26890
27005
|
}
|
|
26891
27006
|
}
|
|
26892
27007
|
}
|
|
26893
|
-
|
|
26894
|
-
|
|
26895
|
-
|
|
26896
|
-
|
|
26897
|
-
|
|
27008
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
27009
|
+
finally {
|
|
27010
|
+
try {
|
|
27011
|
+
if (_g && !_g.done && (_d = _f.return)) _d.call(_f);
|
|
27012
|
+
}
|
|
27013
|
+
finally { if (e_1) throw e_1.error; }
|
|
26898
27014
|
}
|
|
26899
|
-
finally { if (e_1) throw e_1.error; }
|
|
26900
27015
|
}
|
|
26901
|
-
|
|
26902
|
-
|
|
27016
|
+
else {
|
|
27017
|
+
// found no fields to show in CYA summary page
|
|
27018
|
+
return false;
|
|
27019
|
+
}
|
|
26903
27020
|
};
|
|
26904
27021
|
CaseEditSubmitComponent.prototype.readOnlySummaryFieldsToDisplayExists = function () {
|
|
26905
27022
|
return this.eventTrigger.case_fields.some(function (field) { return field.show_summary_content_option >= 0; });
|
|
26906
27023
|
};
|
|
26907
27024
|
CaseEditSubmitComponent.prototype.showEventNotes = function () {
|
|
26908
|
-
return this.eventTrigger.show_event_notes
|
|
27025
|
+
return !!this.eventTrigger.show_event_notes;
|
|
26909
27026
|
};
|
|
26910
27027
|
CaseEditSubmitComponent.prototype.getLastPageShown = function () {
|
|
26911
27028
|
var _this = this;
|
|
@@ -29906,7 +30023,7 @@
|
|
|
29906
30023
|
}
|
|
29907
30024
|
else {
|
|
29908
30025
|
return this.caseNotifier.fetchAndRefresh(cid)
|
|
29909
|
-
.pipe(operators.catchError(function (error) { return _this.checkAuthorizationError(error); }))
|
|
30026
|
+
.pipe(operators.catchError(function (error) { return _this.checkAuthorizationError(error, cid); }))
|
|
29910
30027
|
.toPromise();
|
|
29911
30028
|
}
|
|
29912
30029
|
}
|
|
@@ -29919,20 +30036,24 @@
|
|
|
29919
30036
|
_this.caseNotifier.cachedCaseView = classTransformer.plainToClassFromExist(new CaseView(), caseView);
|
|
29920
30037
|
_this.caseNotifier.announceCase(_this.caseNotifier.cachedCaseView);
|
|
29921
30038
|
return _this.caseNotifier.cachedCaseView;
|
|
29922
|
-
}), operators.catchError(function (error) { return _this.checkAuthorizationError(error); })).toPromise();
|
|
30039
|
+
}), operators.catchError(function (error) { return _this.checkAuthorizationError(error, cid); })).toPromise();
|
|
29923
30040
|
};
|
|
29924
|
-
CaseResolver.prototype.checkAuthorizationError = function (error) {
|
|
30041
|
+
CaseResolver.prototype.checkAuthorizationError = function (error, caseReference) {
|
|
29925
30042
|
// TODO Should be logged to remote logging infrastructure
|
|
29926
30043
|
if (error.status === 400) {
|
|
29927
30044
|
this.router.navigate(['/search/noresults']);
|
|
29928
30045
|
return rxjs.of(null);
|
|
29929
30046
|
}
|
|
29930
|
-
console.error(error);
|
|
29931
30047
|
if (CaseResolver.EVENT_REGEX.test(this.previousUrl) && error.status === 404) {
|
|
29932
30048
|
this.router.navigate(['/list/case']);
|
|
29933
30049
|
return rxjs.of(null);
|
|
29934
30050
|
}
|
|
29935
|
-
|
|
30051
|
+
// Error 403, navigate to restricted case access page
|
|
30052
|
+
if (error.status === 403) {
|
|
30053
|
+
this.router.navigate(["/cases/restricted-case-access/" + caseReference]);
|
|
30054
|
+
return rxjs.of(null);
|
|
30055
|
+
}
|
|
30056
|
+
if (error.status !== 401) {
|
|
29936
30057
|
this.router.navigate(['/error']);
|
|
29937
30058
|
}
|
|
29938
30059
|
this.goToDefaultPage();
|