File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
packages/web/src/features/entitlements Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,9 @@ import { SOURCEBOT_SUPPORT_EMAIL } from "@/lib/constants";
77const eeLicenseKeyPrefix = "sourcebot_ee_" ;
88
99const eeLicenseKeyPayloadSchema = z . object ( {
10+ id : z . string ( ) ,
1011 // ISO 8601 date string
11- expiryDate : z . string ( ) . datetime ( ) ,
12+ expiryDate : z . string ( ) . datetime ( ) . optional ( ) ,
1213} ) ;
1314
1415const decodeLicenseKeyPayload = ( payload : string ) => {
@@ -29,14 +30,15 @@ export const getPlan = (): Plan => {
2930 try {
3031 const { expiryDate } = decodeLicenseKeyPayload ( payload ) ;
3132
32- if ( new Date ( expiryDate ) . getTime ( ) < new Date ( ) . getTime ( ) ) {
33+ if ( expiryDate && new Date ( expiryDate ) . getTime ( ) < new Date ( ) . getTime ( ) ) {
3334 console . error ( `The provided license key has expired. Falling back to oss plan. Please contact ${ SOURCEBOT_SUPPORT_EMAIL } for support.` ) ;
3435 return "oss" ;
3536 }
3637
3738 return "self-hosted:enterprise" ;
3839 } catch ( error ) {
39- console . error ( `Failed to decode license key payload: ${ error } ` ) ;
40+ console . error ( `Failed to decode license key payload with error: ${ error } ` ) ;
41+ console . info ( 'Falling back to oss plan.' ) ;
4042 return "oss" ;
4143 }
4244 }
You can’t perform that action at this time.
0 commit comments