@icure/form 3.0.25 → 3.0.28

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 (72) hide show
  1. package/.yarn/cache/@lit-reactive-element-npm-2.1.0-77512b732b-fb36e9f64b.zip +0 -0
  2. package/.yarn/cache/@lit-task-npm-1.0.2-01d3dd32e9-22e1265a62.zip +0 -0
  3. package/.yarn/install-state.gz +0 -0
  4. package/components/common/field-with-options.d.ts +2 -2
  5. package/components/common/field-with-options.js.map +1 -1
  6. package/components/common/field.d.ts +9 -3
  7. package/components/common/field.js +16 -0
  8. package/components/common/field.js.map +1 -1
  9. package/components/icure-button-group/index.d.ts +5 -3
  10. package/components/icure-button-group/index.js +3 -3
  11. package/components/icure-button-group/index.js.map +1 -1
  12. package/components/icure-date-picker/index.d.ts +4 -1
  13. package/components/icure-date-picker/index.js +5 -5
  14. package/components/icure-date-picker/index.js.map +1 -1
  15. package/components/icure-dropdown-field/index.d.ts +5 -2
  16. package/components/icure-dropdown-field/index.js +6 -6
  17. package/components/icure-dropdown-field/index.js.map +1 -1
  18. package/components/icure-form/fields/button-group/checkbox.d.ts +2 -1
  19. package/components/icure-form/fields/button-group/checkbox.js +1 -1
  20. package/components/icure-form/fields/button-group/checkbox.js.map +1 -1
  21. package/components/icure-form/fields/button-group/radio-button.d.ts +2 -1
  22. package/components/icure-form/fields/button-group/radio-button.js +1 -1
  23. package/components/icure-form/fields/button-group/radio-button.js.map +1 -1
  24. package/components/icure-form/fields/date-picker/date-picker.d.ts +2 -1
  25. package/components/icure-form/fields/date-picker/date-picker.js +1 -1
  26. package/components/icure-form/fields/date-picker/date-picker.js.map +1 -1
  27. package/components/icure-form/fields/date-picker/date-time-picker.d.ts +2 -1
  28. package/components/icure-form/fields/date-picker/date-time-picker.js +1 -1
  29. package/components/icure-form/fields/date-picker/date-time-picker.js.map +1 -1
  30. package/components/icure-form/fields/date-picker/time-picker.d.ts +2 -1
  31. package/components/icure-form/fields/date-picker/time-picker.js +1 -1
  32. package/components/icure-form/fields/date-picker/time-picker.js.map +1 -1
  33. package/components/icure-form/fields/dropdown/dropdown-field.d.ts +1 -1
  34. package/components/icure-form/fields/dropdown/dropdown-field.js +1 -1
  35. package/components/icure-form/fields/dropdown/dropdown-field.js.map +1 -1
  36. package/components/icure-form/fields/items-list-field/items-list-field.d.ts +2 -1
  37. package/components/icure-form/fields/items-list-field/items-list-field.js +1 -1
  38. package/components/icure-form/fields/items-list-field/items-list-field.js.map +1 -1
  39. package/components/icure-form/fields/measure-field/measure-field.d.ts +2 -1
  40. package/components/icure-form/fields/measure-field/measure-field.js +1 -1
  41. package/components/icure-form/fields/measure-field/measure-field.js.map +1 -1
  42. package/components/icure-form/fields/number-field/number-field.d.ts +2 -1
  43. package/components/icure-form/fields/number-field/number-field.js +1 -1
  44. package/components/icure-form/fields/number-field/number-field.js.map +1 -1
  45. package/components/icure-form/fields/text-field/text-field.d.ts +2 -1
  46. package/components/icure-form/fields/text-field/text-field.js +1 -1
  47. package/components/icure-form/fields/text-field/text-field.js.map +1 -1
  48. package/components/icure-form/fields/token-field/token-field.d.ts +2 -1
  49. package/components/icure-form/fields/token-field/token-field.js +1 -1
  50. package/components/icure-form/fields/token-field/token-field.js.map +1 -1
  51. package/components/icure-form/index.d.ts +4 -2
  52. package/components/icure-form/index.js +39 -17
  53. package/components/icure-form/index.js.map +1 -1
  54. package/components/icure-form/renderer/form/form.js +180 -142
  55. package/components/icure-form/renderer/form/form.js.map +1 -1
  56. package/components/icure-form/renderer/index.d.ts +1 -1
  57. package/components/icure-form/renderer/index.js.map +1 -1
  58. package/components/icure-text-field/index.d.ts +4 -2
  59. package/components/icure-text-field/index.js +12 -12
  60. package/components/icure-text-field/index.js.map +1 -1
  61. package/generic/model.d.ts +3 -3
  62. package/generic/model.js.map +1 -1
  63. package/icure/form-values-container.d.ts +9 -8
  64. package/icure/form-values-container.js +167 -138
  65. package/icure/form-values-container.js.map +1 -1
  66. package/package.json +2 -1
  67. package/utils/fields-values-provider.d.ts +1 -1
  68. package/utils/fields-values-provider.js +12 -4
  69. package/utils/fields-values-provider.js.map +1 -1
  70. package/utils/interpreter.d.ts +1 -1
  71. package/utils/interpreter.js +11 -2
  72. package/utils/interpreter.js.map +1 -1
@@ -67,18 +67,23 @@ export class BridgedFormValuesContainer {
67
67
  console.log(`Creating bridge FVC (${contactFormValuesContainer.rootForm.formTemplateId}) with ${contactFormValuesContainer.children.length} children [${this._id}]`);
68
68
  //Before start to broadcast changes, we need to fill in the contactFormValuesContainer with the dependent values
69
69
  this.contactFormValuesContainer = contactFormValuesContainer;
70
- this.mutateAndNotify = (newContactFormValuesContainer) => {
70
+ this.mutateAndNotify = (newContactFormValuesContainer) => __awaiter(this, void 0, void 0, function* () {
71
71
  newContactFormValuesContainer.unregisterChangeListener(this.mutateAndNotify);
72
- const newBridgedFormValueContainer = new BridgedFormValuesContainer(this.responsible, newContactFormValuesContainer, this.interpreter, this.contact === this.contactFormValuesContainer.currentContact ? newContactFormValuesContainer.currentContact : this.contact, this.initialValuesProvider, this.dependentValuesProvider, this.validatorsProvider, this.language, this.changeListeners, this.interpreterContext);
72
+ const newBridgedFormValueContainer = yield new BridgedFormValuesContainer(this.responsible, newContactFormValuesContainer, this.interpreter, this.contact === this.contactFormValuesContainer.currentContact ? newContactFormValuesContainer.currentContact : this.contact, this.initialValuesProvider, this.dependentValuesProvider, this.validatorsProvider, this.language, this.changeListeners, this.interpreterContext).init();
73
73
  this.changeListeners.forEach((l) => notify(l, newBridgedFormValueContainer));
74
74
  return newBridgedFormValueContainer;
75
- };
75
+ });
76
76
  this.contactFormValuesContainer.registerChangeListener(this.mutateAndNotify);
77
77
  this.contact = contact !== null && contact !== void 0 ? contact : contactFormValuesContainer.currentContact;
78
- if (this.contactFormValuesContainer.mustBeInitialised()) {
79
- this.computeInitialValues();
80
- }
81
- this.computeDependentValues();
78
+ }
79
+ init() {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ if (this.contactFormValuesContainer.mustBeInitialised()) {
82
+ yield this.computeInitialValues();
83
+ }
84
+ yield this.computeDependentValues();
85
+ return this;
86
+ });
82
87
  }
83
88
  getLabel() {
84
89
  return this.contactFormValuesContainer.getLabel();
@@ -180,68 +185,72 @@ export class BridgedFormValuesContainer {
180
185
  }
181
186
  //This method mutates the BridgedFormValuesContainer but can only be called from the constructor
182
187
  computeInitialValues() {
183
- if (this.contactFormValuesContainer.rootForm.formTemplateId) {
184
- this.initialValuesProvider(this.contactFormValuesContainer.rootForm.descr, this.contactFormValuesContainer.rootForm.formTemplateId).forEach(({ metadata, revisionsFilter, formula }) => {
185
- var _a;
186
- try {
187
- const currentValue = this.getValues(revisionsFilter);
188
- if (!currentValue || !Object.keys(currentValue).length) {
189
- const newValue = this.convertRawValue(this.compute(formula));
190
- if (newValue !== undefined) {
191
- const lng = (_a = this.language) !== null && _a !== void 0 ? _a : 'en';
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ if (this.contactFormValuesContainer.rootForm.formTemplateId) {
190
+ yield Promise.all(this.initialValuesProvider(this.contactFormValuesContainer.rootForm.descr, this.contactFormValuesContainer.rootForm.formTemplateId).map((_a) => __awaiter(this, [_a], void 0, function* ({ metadata, revisionsFilter, formula }) {
191
+ var _b;
192
+ try {
193
+ const currentValue = this.getValues(revisionsFilter);
194
+ if (!currentValue || !Object.keys(currentValue).length) {
195
+ const newValue = this.convertRawValue((yield this.compute(formula)));
196
+ if (newValue !== undefined) {
197
+ const lng = (_b = this.language) !== null && _b !== void 0 ? _b : 'en';
198
+ if (newValue && !newValue.content[lng] && newValue.content['*']) {
199
+ newValue.content[lng] = newValue.content['*'];
200
+ }
201
+ if (newValue) {
202
+ delete newValue.content['*'];
203
+ }
204
+ setValueOnContactFormValuesContainer(this.contactFormValuesContainer, metadata.label, lng, newValue, undefined, metadata, (fvc) => {
205
+ const currentContact = this.contactFormValuesContainer.currentContact;
206
+ this.contactFormValuesContainer = fvc;
207
+ if (this.contact === currentContact) {
208
+ this.contact = fvc.currentContact;
209
+ }
210
+ });
211
+ }
212
+ }
213
+ }
214
+ catch (e) {
215
+ console.log(`Error while computing formula : ${formula}`, e);
216
+ }
217
+ })));
218
+ }
219
+ });
220
+ }
221
+ //This method mutates the BridgedFormValuesContainer but can only be called from the constructor
222
+ computeDependentValues() {
223
+ return __awaiter(this, void 0, void 0, function* () {
224
+ if (this.contactFormValuesContainer.rootForm.formTemplateId) {
225
+ yield Promise.all(this.dependentValuesProvider(this.contactFormValuesContainer.rootForm.descr, this.contactFormValuesContainer.rootForm.formTemplateId).map((_a) => __awaiter(this, [_a], void 0, function* ({ metadata, revisionsFilter, formula }) {
226
+ var _b;
227
+ try {
228
+ const currentValue = this.getValues(revisionsFilter);
229
+ const newValue = this.convertRawValue((yield this.compute(formula)));
230
+ if (newValue !== undefined || currentValue != undefined) {
231
+ const lng = (_b = this.language) !== null && _b !== void 0 ? _b : 'en';
192
232
  if (newValue && !newValue.content[lng] && newValue.content['*']) {
193
233
  newValue.content[lng] = newValue.content['*'];
194
234
  }
195
235
  if (newValue) {
196
236
  delete newValue.content['*'];
197
237
  }
198
- setValueOnContactFormValuesContainer(this.contactFormValuesContainer, metadata.label, lng, newValue, undefined, metadata, (fvc) => {
238
+ const interceptor = (fvc) => {
199
239
  const currentContact = this.contactFormValuesContainer.currentContact;
200
240
  this.contactFormValuesContainer = fvc;
201
241
  if (this.contact === currentContact) {
202
242
  this.contact = fvc.currentContact;
203
243
  }
204
- });
244
+ };
245
+ setValueOnContactFormValuesContainer(this.contactFormValuesContainer, metadata.label, lng, newValue, Object.keys(currentValue !== null && currentValue !== void 0 ? currentValue : {})[0], metadata, interceptor);
205
246
  }
206
247
  }
207
- }
208
- catch (e) {
209
- console.log(`Error while computing formula : ${formula}`, e);
210
- }
211
- });
212
- }
213
- }
214
- //This method mutates the BridgedFormValuesContainer but can only be called from the constructor
215
- computeDependentValues() {
216
- if (this.contactFormValuesContainer.rootForm.formTemplateId) {
217
- this.dependentValuesProvider(this.contactFormValuesContainer.rootForm.descr, this.contactFormValuesContainer.rootForm.formTemplateId).forEach(({ metadata, revisionsFilter, formula }) => {
218
- var _a;
219
- try {
220
- const currentValue = this.getValues(revisionsFilter);
221
- const newValue = this.convertRawValue(this.compute(formula));
222
- if (newValue !== undefined || currentValue != undefined) {
223
- const lng = (_a = this.language) !== null && _a !== void 0 ? _a : 'en';
224
- if (newValue && !newValue.content[lng] && newValue.content['*']) {
225
- newValue.content[lng] = newValue.content['*'];
226
- }
227
- if (newValue) {
228
- delete newValue.content['*'];
229
- }
230
- const interceptor = (fvc) => {
231
- const currentContact = this.contactFormValuesContainer.currentContact;
232
- this.contactFormValuesContainer = fvc;
233
- if (this.contact === currentContact) {
234
- this.contact = fvc.currentContact;
235
- }
236
- };
237
- setValueOnContactFormValuesContainer(this.contactFormValuesContainer, metadata.label, lng, newValue, Object.keys(currentValue !== null && currentValue !== void 0 ? currentValue : {})[0], metadata, interceptor);
248
+ catch (e) {
249
+ console.log(`Error while computing formula : ${formula}`, e);
238
250
  }
239
- }
240
- catch (e) {
241
- console.log(`Error while computing formula : ${formula}`, e);
242
- }
243
- });
244
- }
251
+ })));
252
+ }
253
+ });
245
254
  }
246
255
  setValue(label, language, fv, id, metadata) {
247
256
  setValueOnContactFormValuesContainer(this.contactFormValuesContainer, label, language, fv, id, metadata);
@@ -262,91 +271,99 @@ export class BridgedFormValuesContainer {
262
271
  return this.getValues((id, history) => { var _a, _b, _c; return (((_b = (_a = history === null || history === void 0 ? void 0 : history[0]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.label) && key === history[0].value.label ? [(_c = history === null || history === void 0 ? void 0 : history[0]) === null || _c === void 0 ? void 0 : _c.revision] : []); });
263
272
  }
264
273
  compute(formula, sandbox) {
265
- var _a;
266
- // noinspection JSUnusedGlobalSymbols
267
- const parseContent = (content) => {
268
- var _a, _b;
269
- if (!content) {
270
- return undefined;
271
- }
272
- const primitive = (_b = (_a = content[this.language]) !== null && _a !== void 0 ? _a : content['*']) !== null && _b !== void 0 ? _b : content[Object.keys(content)[0]];
273
- return primitive && parsePrimitive(primitive);
274
- };
275
- const log = console.log;
276
- const native = {
277
- parseInt: parseInt,
278
- parseFloat: parseFloat,
279
- Date: Date,
280
- Math: Math,
281
- Number: Number,
282
- String: String,
283
- Boolean: Boolean,
284
- Array: Array,
285
- Object: Object,
286
- hasOption: (it, option) => it && it.codes.some((c) => { var _a, _b; return c.id === option || ((_b = (_a = c.id) === null || _a === void 0 ? void 0 : _a.split('|')) === null || _b === void 0 ? void 0 : _b[1]) === option; }),
287
- score: (it) => {
288
- var _a;
289
- return it
290
- ? ((_a = it.codes) !== null && _a !== void 0 ? _a : []).reduce((acc, c) => {
291
- var _a, _b, _c;
292
- try {
293
- return acc + parseInt((_c = (_b = (_a = c.id) === null || _a === void 0 ? void 0 : _a.split('|')) === null || _b === void 0 ? void 0 : _b[1]) !== null && _c !== void 0 ? _c : '0');
294
- }
295
- catch (e) {
296
- return acc;
297
- }
298
- }, 0)
299
- : 0;
300
- },
301
- parseContent,
302
- validate: {
303
- notBlank: (self, label) => {
304
- var _a, _b, _c;
305
- const value = parseContent((_b = (_a = self[label]) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.content);
306
- return !!((_c = value === null || value === void 0 ? void 0 : value.trim()) === null || _c === void 0 ? void 0 : _c.length);
307
- },
308
- },
309
- log,
310
- };
311
- const proxy = new Proxy({}, {
312
- has: (target, key) => { var _a; return !!native[key] || key === 'self' || !!this.interpreterContext[key] || Object.keys((_a = this.getVersionedValuesForKey(key)) !== null && _a !== void 0 ? _a : {}).length > 0; },
313
- get: (target, key) => {
314
- if (key === 'undefined') {
274
+ return __awaiter(this, void 0, void 0, function* () {
275
+ var _a;
276
+ // noinspection JSUnusedGlobalSymbols
277
+ const parseContent = (content) => {
278
+ var _a, _b;
279
+ if (!content) {
315
280
  return undefined;
316
281
  }
317
- const nativeValue = native[key];
318
- if (!!nativeValue) {
319
- return nativeValue;
320
- }
321
- return key === 'self' ? proxy : this.interpreterContext[key] ? this.interpreterContext[key]() : Object.values(this.getVersionedValuesForKey(key)).map((v) => { var _a; return (_a = v[0]) === null || _a === void 0 ? void 0 : _a.value; });
322
- },
282
+ const primitive = (_b = (_a = content[this.language]) !== null && _a !== void 0 ? _a : content['*']) !== null && _b !== void 0 ? _b : content[Object.keys(content)[0]];
283
+ return primitive && parsePrimitive(primitive);
284
+ };
285
+ const log = console.log;
286
+ const native = {
287
+ parseInt: parseInt,
288
+ parseFloat: parseFloat,
289
+ Date: Date,
290
+ Math: Math,
291
+ Number: Number,
292
+ String: String,
293
+ Boolean: Boolean,
294
+ Array: Array,
295
+ Object: Object,
296
+ hasOption: (it, option) => { var _a; return it && ((_a = it.codes) === null || _a === void 0 ? void 0 : _a.some((c) => { var _a, _b; return c.id === option || ((_b = (_a = c.id) === null || _a === void 0 ? void 0 : _a.split('|')) === null || _b === void 0 ? void 0 : _b[1]) === option; })); },
297
+ score: (it) => {
298
+ var _a;
299
+ return it
300
+ ? ((_a = it.codes) !== null && _a !== void 0 ? _a : []).reduce((acc, c) => {
301
+ var _a, _b, _c;
302
+ try {
303
+ return acc + parseInt((_c = (_b = (_a = c.id) === null || _a === void 0 ? void 0 : _a.split('|')) === null || _b === void 0 ? void 0 : _b[1]) !== null && _c !== void 0 ? _c : '0');
304
+ }
305
+ catch (e) {
306
+ return acc;
307
+ }
308
+ }, 0)
309
+ : 0;
310
+ },
311
+ parseContent,
312
+ validate: {
313
+ notBlank: (self, label) => {
314
+ var _a, _b, _c;
315
+ const value = parseContent((_b = (_a = self[label]) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.content);
316
+ return !!((_c = value === null || value === void 0 ? void 0 : value.trim()) === null || _c === void 0 ? void 0 : _c.length);
317
+ },
318
+ },
319
+ log,
320
+ };
321
+ const proxy = new Proxy({}, {
322
+ has: (target, key) => { var _a; return !!native[key] || key === 'self' || !!this.interpreterContext[key] || Object.keys((_a = this.getVersionedValuesForKey(key)) !== null && _a !== void 0 ? _a : {}).length > 0; },
323
+ get: (target, key) => {
324
+ if (key === 'undefined') {
325
+ return undefined;
326
+ }
327
+ const nativeValue = native[key];
328
+ if (!!nativeValue) {
329
+ return nativeValue;
330
+ }
331
+ return key === 'self' ? proxy : this.interpreterContext[key] ? this.interpreterContext[key]() : Object.values(this.getVersionedValuesForKey(key)).map((v) => { var _a; return (_a = v[0]) === null || _a === void 0 ? void 0 : _a.value; });
332
+ },
333
+ });
334
+ return (_a = this.interpreter) === null || _a === void 0 ? void 0 : _a.call(this, formula, sandbox !== null && sandbox !== void 0 ? sandbox : proxy);
323
335
  });
324
- return (_a = this.interpreter) === null || _a === void 0 ? void 0 : _a.call(this, formula, sandbox !== null && sandbox !== void 0 ? sandbox : proxy);
325
336
  }
326
337
  getChildren() {
327
- const children = this.contactFormValuesContainer
328
- .getChildren()
329
- .map((fvc) => new BridgedFormValuesContainer(this.responsible, fvc, this.interpreter, this.contact, this.initialValuesProvider, this.dependentValuesProvider, this.validatorsProvider, this.language, [], this.interpreterContext));
330
- console.log(`${children.length} children found in ${this.contactFormValuesContainer.rootForm.formTemplateId} initialised with `, this.initialValuesProvider);
331
- return children;
338
+ return __awaiter(this, void 0, void 0, function* () {
339
+ const children = yield Promise.all((yield this.contactFormValuesContainer.getChildren()).map((fvc) => new BridgedFormValuesContainer(this.responsible, fvc, this.interpreter, this.contact, this.initialValuesProvider, this.dependentValuesProvider, this.validatorsProvider, this.language, [], this.interpreterContext).init()));
340
+ console.log(`${children.length} children found in ${this.contactFormValuesContainer.rootForm.formTemplateId} initialised with `, this.initialValuesProvider);
341
+ return children;
342
+ });
332
343
  }
333
344
  getValidationErrors() {
334
- if (this.contactFormValuesContainer.rootForm.formTemplateId) {
335
- return this.validatorsProvider(this.contactFormValuesContainer.rootForm.descr, this.contactFormValuesContainer.rootForm.formTemplateId).flatMap(({ metadata, validators }) => validators
336
- .map(({ validation, message }) => {
337
- try {
338
- return this.compute(validation) ? undefined : [metadata, message];
339
- }
340
- catch (e) {
341
- console.log(`Error while computing validation : ${validation}`, e);
342
- return undefined;
343
- }
344
- })
345
- .filter((x) => !!x));
346
- }
347
- else {
348
- return [];
349
- }
345
+ return __awaiter(this, void 0, void 0, function* () {
346
+ if (this.contactFormValuesContainer.rootForm.formTemplateId) {
347
+ // noinspection ES6MissingAwait
348
+ return yield this.validatorsProvider(this.contactFormValuesContainer.rootForm.descr, this.contactFormValuesContainer.rootForm.formTemplateId).reduce((resPromise_1, _a) => __awaiter(this, [resPromise_1, _a], void 0, function* (resPromise, { metadata, validators }) {
349
+ return yield validators.reduce((resPromise_2, _a) => __awaiter(this, [resPromise_2, _a], void 0, function* (resPromise, { validation, message }) {
350
+ const res = yield resPromise;
351
+ try {
352
+ if (!(yield this.compute(validation))) {
353
+ res.push([metadata, message]);
354
+ }
355
+ }
356
+ catch (e) {
357
+ console.log(`Error while computing validation : ${validation}`, e);
358
+ }
359
+ return res;
360
+ }), resPromise);
361
+ }), Promise.resolve([]));
362
+ }
363
+ else {
364
+ return [];
365
+ }
366
+ });
350
367
  }
351
368
  addChild(anchorId, templateId, label) {
352
369
  return __awaiter(this, void 0, void 0, function* () {
@@ -472,10 +489,14 @@ export class ContactFormValuesContainer {
472
489
  this.changeListeners = this.changeListeners.filter((l) => l !== listener);
473
490
  }
474
491
  getChildren() {
475
- return this.children;
492
+ return __awaiter(this, void 0, void 0, function* () {
493
+ return this.children;
494
+ });
476
495
  }
477
496
  getValidationErrors() {
478
- throw new Error('Validation not supported at contact level');
497
+ return __awaiter(this, void 0, void 0, function* () {
498
+ throw new Error('Validation not supported at contact level');
499
+ });
479
500
  }
480
501
  getValues(revisionsFilter) {
481
502
  return Object.entries(this.getServicesInHistory(revisionsFilter)).reduce((acc, [id, history]) => history.length
@@ -552,7 +573,10 @@ export class ContactFormValuesContainer {
552
573
  return sc;
553
574
  }
554
575
  })
555
- : ((_h = this.currentContact.subContacts) !== null && _h !== void 0 ? _h : []).concat(new DecryptedSubContact({ formId: this.rootForm.id, services: [{ serviceId: service.id }] })), services: ((_j = this.currentContact.services) !== null && _j !== void 0 ? _j : []).some((s) => s.id === service.id)
576
+ : ((_h = this.currentContact.subContacts) !== null && _h !== void 0 ? _h : []).concat(new DecryptedSubContact({
577
+ formId: this.rootForm.id,
578
+ services: [{ serviceId: service.id }],
579
+ })), services: ((_j = this.currentContact.services) !== null && _j !== void 0 ? _j : []).some((s) => s.id === service.id)
556
580
  ? ((_k = this.currentContact.services) !== null && _k !== void 0 ? _k : []).filter((s) => s.id !== service.id)
557
581
  : [...((_l = this.currentContact.services) !== null && _l !== void 0 ? _l : [])] });
558
582
  }
@@ -575,7 +599,10 @@ export class ContactFormValuesContainer {
575
599
  return sc;
576
600
  }
577
601
  })
578
- : ((_s = this.currentContact.subContacts) !== null && _s !== void 0 ? _s : []).concat(new DecryptedSubContact({ formId: this.rootForm.id, services: [{ serviceId: service.id }] })), services: ((_t = this.currentContact.services) !== null && _t !== void 0 ? _t : []).some((s) => s.id === service.id)
602
+ : ((_s = this.currentContact.subContacts) !== null && _s !== void 0 ? _s : []).concat(new DecryptedSubContact({
603
+ formId: this.rootForm.id,
604
+ services: [{ serviceId: service.id }],
605
+ })), services: ((_t = this.currentContact.services) !== null && _t !== void 0 ? _t : []).some((s) => s.id === service.id)
579
606
  ? ((_u = this.currentContact.services) !== null && _u !== void 0 ? _u : []).map((s) => (s.id === service.id ? newService : s))
580
607
  : [...((_v = this.currentContact.services) !== null && _v !== void 0 ? _v : []), newService] });
581
608
  }
@@ -594,7 +621,9 @@ export class ContactFormValuesContainer {
594
621
  }
595
622
  }
596
623
  compute() {
597
- throw new Error('Compute not supported at contact level');
624
+ return __awaiter(this, void 0, void 0, function* () {
625
+ throw new Error('Compute not supported at contact level');
626
+ });
598
627
  }
599
628
  /** returns all services in history that match a selector
600
629
  *