I know that I can save Add-In state per document using document.settings.
Is there a way to save state (e.g. active license) across documents for the same Add-In?
How you save user state depends on your needs.
If you want to track per-machine state you can save the data in HTML5 Local Storage.
If you want to track per-user state for signed-in users (no matter what machine or document they use), you should save their User ID and state on your database. For my own add-in, I implemented this design with Firebase:
function readUserStateAsync(customerId, callback){
var myUserReference = firebase.database().ref("myCustomers/" + customerId);
myUserReference.once('value').then(function(userState) {
callback(userState.val());
});
}
function writeUserStateAsync(customerId, userState, callback){
var myUserReference = firebase.database().ref("myCustomers");
myUserReference.child(customerId).set(userState, function(){ callback("success"); });
}
-Michael Saunders, program manager for Office add-ins