@yuuvis/client-core 3.2.2 → 3.3.0

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.
@@ -1423,8 +1423,9 @@ class LocalizationService {
1423
1423
  }));
1424
1424
  }
1425
1425
  getLocalizedResource(key) {
1426
+ // TODO: Fix return type to also include undefined
1426
1427
  const iso = this.#translate.getCurrentLang();
1427
- return { ...this.#i18n, ...this.#extension[iso] }[key] || key;
1428
+ return { ...this.#i18n, ...this.#extension[iso] }[key];
1428
1429
  }
1429
1430
  getLocalizedLabel(id) {
1430
1431
  return this.getLocalizedResource(`${id}_label`);
@@ -1669,7 +1670,13 @@ class SystemService {
1669
1670
  * @deprecated use LocalizationService.getLocalizedResource instead
1670
1671
  */
1671
1672
  getLocalizedResource(key) {
1672
- return this.#localization.getLocalizedResource(key);
1673
+ try {
1674
+ // return this.system!.i18n[key];
1675
+ return this.#localization.getLocalizedResource(key);
1676
+ }
1677
+ catch (error) {
1678
+ return key;
1679
+ }
1673
1680
  }
1674
1681
  /**
1675
1682
  * @deprecated use LocalizationService.getLocalizedResource instead
@@ -4345,7 +4352,11 @@ class CatalogService {
4345
4352
  #getCatalogs() {
4346
4353
  return this.#search.searchCmis(`SELECT * FROM ${SystemType.CATALOG}`, 1000).pipe(map$1((res) => res.items.map((item) => ({
4347
4354
  objectId: item.fields.get(BaseObjectTypeField.OBJECT_ID),
4348
- name: item.fields.get(CatalogTypeField.NATIVE_ID)
4355
+ name: item.fields.get(CatalogTypeField.NATIVE_ID),
4356
+ raw: Array.from(item.fields).reduce((acc, [key, wrapper]) => {
4357
+ acc[key] = wrapper;
4358
+ return acc;
4359
+ }, {})
4349
4360
  }))));
4350
4361
  }
4351
4362
  /** Loads the catalog list, sorts by name and publishes to the `catalogs` signal. */
@@ -4399,16 +4410,35 @@ class CatalogService {
4399
4410
  totalNumItems: response.totalNumItems
4400
4411
  };
4401
4412
  }
4413
+ #getEntryState(properties) {
4414
+ const validFrom = this.#prop(properties, CatalogTypeField.DATE_VALID_FROM);
4415
+ const validUntil = this.#prop(properties, CatalogTypeField.DATE_VALID_UNTIL);
4416
+ const now = new Date().toISOString();
4417
+ if (validFrom && now < validFrom) {
4418
+ return 'upcoming';
4419
+ }
4420
+ if (validUntil && now > validUntil) {
4421
+ return 'expired';
4422
+ }
4423
+ return 'active';
4424
+ }
4402
4425
  #mapEntry(apiObject) {
4403
4426
  const props = apiObject.properties;
4404
4427
  return {
4428
+ _state: this.#getEntryState(props),
4405
4429
  objectId: this.#prop(props, BaseObjectTypeField.OBJECT_ID),
4406
4430
  name: this.#prop(props, CatalogTypeField.NATIVE_ID),
4407
4431
  catalogName: this.#prop(props, CatalogTypeField.CATALOG_NATIVE_ID),
4408
4432
  localizations: this.#parseLocalization(props[CatalogTypeField.LOCALIZATION]),
4409
4433
  validFrom: this.#prop(props, CatalogTypeField.DATE_VALID_FROM),
4410
4434
  validUntil: this.#prop(props, CatalogTypeField.DATE_VALID_UNTIL),
4411
- properties: this.#extractCustomProperties(props)
4435
+ properties: this.#extractCustomProperties(props),
4436
+ raw: Object.entries(props).reduce((acc, [key, wrapper]) => {
4437
+ if (wrapper && typeof wrapper === 'object' && 'value' in wrapper) {
4438
+ acc[key] = wrapper.value;
4439
+ }
4440
+ return acc;
4441
+ }, {})
4412
4442
  };
4413
4443
  }
4414
4444
  #prop(properties, key) {