(_license: License | null)
| 114 | export const STALE_ONLINE_LICENSE_WARNING_THRESHOLD_MS = 48 * 60 * 60 * 1000; |
| 115 | |
| 116 | const getValidOnlineLicense = (_license: License | null): License | null => { |
| 117 | if ( |
| 118 | _license && |
| 119 | _license.status && |
| 120 | ACTIVE_ONLINE_LICENSE_STATUSES.includes(_license.status as LicenseStatus) && |
| 121 | _license.lastSyncAt && |
| 122 | (Date.now() - _license.lastSyncAt.getTime()) <= STALE_ONLINE_LICENSE_THRESHOLD_MS && |
| 123 | _license.lastSyncErrorCode !== 'ACTIVATION_CODE_BOUND_TO_DIFFERENT_INSTANCE' |
| 124 | ) { |
| 125 | return _license; |
| 126 | } |
| 127 | |
| 128 | return null; |
| 129 | } |
| 130 | |
| 131 | export const isValidOfflineLicenseActive = (): boolean => { |
| 132 | return getValidOfflineLicense() !== null; |
no outgoing calls
no test coverage detected