Skip to main content

Installing in a MadCap Flare site

You can install Command AI in a site generated by MadCap Flare without any code — woot!

  1. Open your project with MadCap Flare.
  2. Within your Project Organizer, navigate to the “Skins” folder/directory and open the HTML5 Skin Editor.
  3. Click on the “Toolbar” tab on the left-hand side.
  4. Click “Edit” Button under “Custom JavaScript to include in Toolbar page”.
  5. A window will open - paste the following code (make sure you are replacing the loggedInUserId placeholder) into the text field and click “OK”.
<script>
var o="<YOUR_ORG_ID>",n="https://api.command.ai",a=void 0,t=window;function r(o,n){void 0===n&&(n=!1),"complete"!==document.readyState&&window.addEventListener("load",r.bind(null,o,n),{capture:!1,once:!0});var a=document.createElement("script");a.type="text/javascript",a.async=n,a.src=o,document.head.appendChild(a)}function e(){var e;if(void 0===t.CommandBar){delete t.__CommandBarBootstrap__;var c=Symbol.for("CommandBar::configuration"),d=Symbol.for("CommandBar::disposed"),i=Symbol.for("CommandBar::isProxy"),m=Symbol.for("CommandBar::queue"),u=Symbol.for("CommandBar::unwrap"),s=Symbol.for("CommandBar::eventSubscriptions"),l=[],p=localStorage.getItem("commandbar.lc");p&&p.includes("local")&&(n="http://localhost:8000",a=void 0);var f=Object.assign(((e={})[c]={uuid:o,api:n,cdn:a},e[d]=!1,e[i]=!0,e[m]=new Array,e[u]=function(){return f},e[s]=void 0,e),t.CommandBar),v=["addCommand","boot","addEventSubscriber","addRecordAction","setFormFactor"],b=f;Object.assign(f,{shareCallbacks:function(){return{}},shareContext:function(){return{}}}),t.CommandBar=new Proxy(f,{get:function(o,n){return n in b?f[n]:"then"!==n?v.includes(n)?function(){var o=Array.prototype.slice.call(arguments);return new Promise((function(a,t){o.unshift(n,a,t),f[m].push(o)}))}:function(){var o=Array.prototype.slice.call(arguments);o.unshift(n),f[m].push(o)}:void 0}}),null!==p&&l.push("lc=".concat(p)),l.push("version=2"),a&&l.push("cdn=".concat(encodeURIComponent(a))),r("".concat(n,"/latest/").concat(o,"?").concat(l.join("&")),!0)}}e();
const loggedInUserId = '12345'; // example
window.CommandBar.boot(loggedInUserId);
</script>

That's it! Your changes will be reflected as soon as you build your output.

Notes

If you want to test the installation on your local machine, ensure that you are running your project on a local server (localhost) to avoid CORS policy issues. Command AI will not run properly if if you are simply opening your generated HTML5 file in a web browser.