2022-10-27 07:39:33 +00:00
|
|
|
/***
|
2022-11-25 11:19:32 +00:00
|
|
|
* Injects two functions and a handler for use globally:
|
|
|
|
* - $licenseHandler
|
|
|
|
* A class holding some helper methods to do with licenses and no state of it own.
|
2023-03-28 14:40:58 +00:00
|
|
|
* - $hasFeature(FEATURE_STRING, OPTIONAL_WORKSPACE_ID) -> bool
|
|
|
|
* Returns if the current user has access to the feature instance-wide if no workspace
|
|
|
|
* is supplied otherwise for the workspace if an id is provided.
|
2022-10-27 07:39:33 +00:00
|
|
|
* - $highestLicenseType() -> LicenseType or null
|
|
|
|
* Returns the highest instance wide license the user has active or null if they
|
|
|
|
* do not have one.
|
|
|
|
*/
|
2022-11-25 11:19:32 +00:00
|
|
|
import { LicenseHandler } from '@baserow_premium/handlers/license'
|
2022-10-27 07:39:33 +00:00
|
|
|
|
2022-11-25 11:19:32 +00:00
|
|
|
export default function ({ app }, inject) {
|
|
|
|
const licenseHandler = new LicenseHandler(app)
|
|
|
|
licenseHandler.listenToBusEvents()
|
|
|
|
inject('licenseHandler', licenseHandler)
|
|
|
|
inject(
|
|
|
|
'highestLicenseType',
|
|
|
|
licenseHandler.highestInstanceWideLicenseType.bind(licenseHandler)
|
|
|
|
)
|
2022-10-27 07:39:33 +00:00
|
|
|
}
|