@gravitee/ui-particles-angular 9.5.2 → 9.6.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.
@@ -4819,22 +4819,27 @@ class GioLicenseService {
4819
4819
  return this.loadLicense$;
4820
4820
  }
4821
4821
  isMissingFeature$(licenseOptions) {
4822
- if (licenseOptions?.deployed === false) {
4823
- return of(true);
4824
- }
4825
- if (licenseOptions?.feature == null || licenseOptions?.deployed === true) {
4822
+ if (licenseOptions?.feature == null || !licenseOptions?.feature) {
4826
4823
  return of(false);
4827
4824
  }
4828
- return this.getLicense$().pipe(map(license => license == null || license.features.find(feat => feat === licenseOptions.feature) == null));
4825
+ return this.isExpired$().pipe(switchMap(isExpired => {
4826
+ if (isExpired) {
4827
+ return of(isExpired);
4828
+ }
4829
+ return this.getLicense$().pipe(map(license => license == null || !license.features.some(feat => feat === licenseOptions.feature)));
4830
+ }));
4829
4831
  }
4830
4832
  hasAllFeatures$(licenseOptions) {
4831
- if (!licenseOptions) {
4833
+ if (!licenseOptions || isEmpty(licenseOptions)) {
4832
4834
  return of(true);
4833
4835
  }
4834
- if (licenseOptions?.find(o => o.feature != null && o.deployed === false) != null) {
4835
- return of(false);
4836
- }
4837
- return this.getLicense$().pipe(map(license => license != null && licenseOptions?.every(o => license.features.find(feat => feat === o.feature) != null)));
4836
+ return this.isExpired$().pipe(switchMap(isExpired => {
4837
+ const featuresDefined = licenseOptions.some(o => !!o.feature);
4838
+ if (isExpired && featuresDefined) {
4839
+ return of(false);
4840
+ }
4841
+ return this.getLicense$().pipe(map(license => license != null && licenseOptions.every(o => license.features.some(feat => feat === o.feature))));
4842
+ }));
4838
4843
  }
4839
4844
  getFeatureInfo(licenseOptions) {
4840
4845
  if (!licenseOptions.feature) {
@@ -4879,6 +4884,9 @@ class GioLicenseService {
4879
4884
  getExpiresAt$() {
4880
4885
  return this.getLicense$().pipe(map(license => (license.expiresAt ? new Date(license.expiresAt) : undefined)));
4881
4886
  }
4887
+ isExpired$() {
4888
+ return this.getExpiresAt$().pipe(map(expiresAt => !!expiresAt && expiresAt.valueOf() < Date.now()));
4889
+ }
4882
4890
  }
4883
4891
  GioLicenseService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GioLicenseService, deps: [{ token: i4.HttpClient }, { token: 'LicenseConfiguration' }, { token: i1$3.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
4884
4892
  GioLicenseService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GioLicenseService, providedIn: 'root' });