| 13 | } |
| 14 | |
| 15 | export class ProductionRequirements implements Context { |
| 16 | private prodProperties = [ |
| 17 | Log.Context.toString(Log.Context.Custom.AppInfoId), |
| 18 | Log.Context.toString(Log.Context.Custom.AppInfoVersion), |
| 19 | Log.Context.toString(Log.Context.Custom.BrowserLanguage), |
| 20 | Log.Context.toString(Log.Context.Custom.ExtensionLifecycleId), |
| 21 | Log.Context.toString(Log.Context.Custom.ClipperType), |
| 22 | Log.Context.toString(Log.Context.Custom.DeviceInfoId), |
| 23 | Log.Context.toString(Log.Context.Custom.FlightInfo), |
| 24 | Log.Context.toString(Log.Context.Custom.InPrivateBrowsing) |
| 25 | ]; |
| 26 | |
| 27 | private requiredProperties: string[]; |
| 28 | |
| 29 | constructor(requiredProperties?: string[]) { |
| 30 | this.requiredProperties = requiredProperties ? requiredProperties : this.prodProperties; |
| 31 | } |
| 32 | |
| 33 | requirementsAreMet(contextProps: { [key: string]: string | number | boolean }): boolean { |
| 34 | if (ObjectUtils.isNullOrUndefined(contextProps)) { |
| 35 | return false; |
| 36 | } |
| 37 | for (let i = 0; i < this.requiredProperties.length; ++i) { |
| 38 | let prop = this.requiredProperties[i]; |
| 39 | if (!contextProps.hasOwnProperty(prop)) { |
| 40 | return false; |
| 41 | } |
| 42 | } |
| 43 | return true; |
| 44 | } |
| 45 | } |