A lot of the code in this file seems to be copy/pasted from products.async.js (https://github.com/dimagi/commcare-hq/blob/master/corehq/apps/commtrack/static/commtrack/ko/products.async.js#L19). Since much of this code needs to be used in the same place, it should be moved to a place both of these have access to so there isn't duplication.