lib/adaptive-v1.js
/**
 * Start the Trusteer gathering process.
 * 
 * Given a Trusteer JavaScript snippet ID, this function will inject that
 * snippet into the webpage, initiating the gathering process. During
 * gathering, two callback functions will be called; <code>getTCSID</code>, and
 * <code>getFlow</code>. The injected Trusteer snippets will call
 * <code>getTCSID</code> to indicate that we have been given a session ID. This
 * session ID should be used for subsequent requests to the Adaptive Proxy SDK.
 * The <code>getFlow</code> function will be called to indicate that the
 * gathering process has completed.
 * @param {string} host The host of the Trusteer JavaScript snippet to inject
 * into the webpage, e.g. <code>a1bcdefgh2ijkl.cloudfront.net</code>.
 * @param {int|string} snippetID The identifier of the Trusteer JavaScript snippet
 * to inject into the webpage, e.g. <code>123456</code>.
 */
Start the Trusteer gathering process.

Given a Trusteer JavaScript snippet ID, this function will inject that
snippet into the webpage, initiating the gathering process. During
gathering, two callback functions will be called; getTCSID, and
getFlow. The injected Trusteer snippets will call
getTCSID to indicate that we have been given a session ID. This
session ID should be used for subsequent requests to the Adaptive Proxy SDK.
The getFlow function will be called to indicate that the
gathering process has completed.
@param {string} host The host of the Trusteer JavaScript snippet to inject
into the webpage, e.g.
Start the Trusteer gathering process . Given a Trusteer JavaScript snippet ID this function will inject that snippet into the webpage initiating the gathering process . During gathering two callback functions will be called ; getTCSID and getFlow . The injected Trusteer snippets will call getTCSID to indicate that we have been given a session ID . This session ID should be used for subsequent requests to the Adaptive Proxy SDK . The getFlow function will be called to indicate that the gathering process has completed . @param { string } host The host of the Trusteer JavaScript snippet to inject into the webpage e . g .
function startAdaptiveV1(host, snippetID) {
  var cookie_value = null;
  try {
    cookie_value = document.cookie;
  } catch (e) { } if (cookie_value) {
    var re = new RegExp('(?:^| )(LSESSIONID=.[^;]+)', 'i'),
      matches = null;
    var result = null;
    if (cookie_value.length > 0) {
      matches = cookie_value.match(re);
      if (matches && matches.length == 2) {
        result = matches[1];
      }
    }
  }
  var url = `https://${host}/${snippetID}/aloads.js`;
  var s = document.createElement('script');
  s.type = 'text/javascript';
  s.async = true;
  var extra = ['dt=login&r=' + Math.random()];
  if (result) {
    extra.push(result);
  } s.src = [url, extra.join('&')].join('?');
  document.getElementsByTagName('head')[0].appendChild(s);
  console.log('CDN snippet loaded');
}
function startAdaptiveV1 ( host , snippetID ) { var cookie_value = null ; try { cookie_value = document . cookie ; } catch ( e ) { } if ( cookie_value ) { var re = new RegExp ( '(?:^| )(LSESSIONID=.[^;]+)' , 'i' ) , matches = null ; var result = null ; if ( cookie_value . length > 0 ) { matches = cookie_value . match ( re ) ; if ( matches && matches . length == 2 ) { result = matches [ 1 ] ; } } } var url = ` ${ host } ${ snippetID } ` ; var s = document . createElement ( 'script' ) ; s . type = 'text/javascript' ; s . async = true ; var extra = [ 'dt=login&r=' + Math . random ( ) ] ; if ( result ) { extra . push ( result ) ; } s . src = [ url , extra . join ( '&' ) ] . join ( '?' ) ; document . getElementsByTagName ( 'head' ) [ 0 ] . appendChild ( s ) ; console . log ( 'CDN snippet loaded' ) ; }
Start the Trusteer gathering process.
Start the Trusteer gathering process .