Unreleased checks from Cobalt JavaScript

How can I check for the current session being in Unreleased mode in JavaScript?

Best Answer

  • mtaylor
    Answer ✓
    IAC's should be used now in preference over the Release/UnReleased Feature Exposure check. If it is a simple change that you are just hoping to hide for an interation while some other code gets put into place or which you want to check in but not "release", then you can use the IAC capability without actually having the IAC defined formally by CM/AMS. Simply "code" to the IAC (create a name that will be used in the conditional like you normally would) and then use the manual step to add that IAC to your session when you want to test that code. Then, when you just want to release the code, you can simply remove the IAC conditional in your code, just like you would remove the "Release/Unreleased" conditional. That being said, I am not aware of how we are exposing IAC's to Javascript at this point. At least I am not aware of a mechanism (one thought might be to add an endpoint to WebSite that JS can call to get the list of IAC's that the user is eligible for in their session.

Answers

  • if (Cobalt.User.GetFeatureExposure() === Cobalt.FeatureExposure.Unreleased) { // Blah }
  • Note that IACs should now be used and not Unreleased.
  • Ron: Is that true in all scenarios? If so, is there a plan to retire the FeatureExposure flags? It seems to me like if, for example, if I'm working on some small feature/change that just needs to be held off for 1 iteration, then using the FeatureExposure would be much easier than the creating new IACs.
  • As MT's answer states: that is correct, we should not be using the FeatureExposure flag anymore. I do believe we have a website story to remove it from Website. We have not worked on coordinating this with the other modules. We'll look into getting that on all the radar for all modules.
  • Here's an example of how IACs can be checked in JavaScript: if (Cobalt.Master.Instance().IsInfrastructureAccessControlOn('iac-oldhighlightingoff')) {
  • For additional reference, here is Mark's original description on theHub:
    https://thehub.thomsonreuters.com/docs/DOC-496148
  • Note that `Cobalt.Master.Instance()` is generated on the page by Website MasterPages, thus certain pages/products that don't utilize the core MasterPages (e.g. NewsRoom) will not have access to the IACs unless they follow the same pattern to push those from the server-side of Website. I'd love to see this moved into a core part of Static Content in the future so that the functions are always there, and just have the actual IAC data it consumes pushed from Website -- MasterPages or otherwise.