diff --git a/Gruntfile.js b/Gruntfile.js
index 31e66cf..b0edda9 100755
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -17,6 +17,8 @@ module.exports = function(grunt) {
'build': {
files: {
"dist/xapiwrapper.min.js": [
+ "lib/promise.polyfill.min.js",
+ "lib/fetch.umd.js",
"lib/cryptojs_v3.1.2.js",
"lib/utf8-text-encoding.js",
"src/activitytypes.js",
@@ -36,7 +38,7 @@ module.exports = function(grunt) {
// Load the plugins.
grunt.loadNpmTasks('grunt-bump');
- grunt.loadNpmTasks('grunt-contrib-uglify');
+ grunt.loadNpmTasks('grunt-contrib-uglify-es');
grunt.loadNpmTasks('grunt-exec');
// Default task(s).
diff --git a/README.md b/README.md
index f39da51..0abf596 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Check out the [Reference Documentation Here](https://adlnet.github.io/xAPIWrappe
### xapiwrapper.js
-Javascript Experience API wrapper.
+Javascript Experience API wrapper.
This javascript file can be included to web based xAPI clients to
simplify the process of connecting and communicating to an LRS. It
is enclosed in an ADL object like the
@@ -32,10 +32,10 @@ in your pages if you're not using `xapiwrapper.min.js`.
In the past we used the below libraries for the same purpose. You may continue to use them
for current systems, but the CryptoJS compilation is recommended.
-* base64.js - https://code.google.com/p/javascriptbase64/downloads/list
+* base64.js - https://code.google.com/p/javascriptbase64/downloads/list
* 2.5.3-crypto-sha1.js - https://code.google.com/p/crypto-js/downloads/detail?name=2.5.3-crypto-sha1.js&can=4&q=
-For [IE/Edge support](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder#Browser_compatibility) you
+For [IE/Edge support](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder#Browser_compatibility) you
will need to include a `TextEncoder` and `TextDecoder` shim if you're not using `xapiwrapper.min.js`
``` html
@@ -128,7 +128,7 @@ Alternatively, use the minified version:
The wrapper at a minimum needs to know the url of the LRS, though
most cases will also require the authorization information as well.
-This wrapper provides two options for configuration. You may:
+This wrapper provides two options for configuration. You may:
* Edit the configuration object (`Config`) in the xapiwrapper.js file
```JavaScript
@@ -155,7 +155,7 @@ var Config = function()
// conf["strictCallbacks"] = false; // Strict error-first callbacks
return conf
}();
-```
+```
* Create your own configuration object and pass it to the xapiwrapper object
```JavaScript
@@ -164,9 +164,9 @@ var conf = {
"auth" : "Basic " + toBase64('tom:1234'),
};
ADL.XAPIWrapper.changeConfig(conf);
-```
+```
Optionally, auth credentials can be updated by user and password properties on the
-configuration object:
+configuration object:
```JavaScript
var conf = {
@@ -175,8 +175,8 @@ var conf = {
"password" : "1234",
};
ADL.XAPIWrapper.changeConfig(conf);
-```
-or
+```
+or
```JavaScript
var creds = {
@@ -184,7 +184,7 @@ var creds = {
"password" : "1234",
};
ADL.XAPIWrapper.updateAuth(ADL.XAPIWrapper.lrs, creds.user, creds.password);
-```
+```
The script automatically runs, creating or adding to an ADL object an
instantiated xAPI Wrapper object. The object is created using the
@@ -199,14 +199,14 @@ ADL.XAPIWrapper.testConfig();
#### Launch Parameters
The configuration will also look for url query parameters and use those
name - value pairs in the XAPIWrapper's internal configuration. That means
-that `http://localhost:8000/content/example.html?actor={"mbox":"mailto:tom@example.com"}`
+that `http://localhost:8000/content/example.html?actor={"mbox":"mailto:tom@example.com"}`
(not url encoded for illustrative purposes) would be parsed for an actor,
-which would automatically be included in the wrapper configuration.
+which would automatically be included in the wrapper configuration.
__NOTE:__ endpoint, auth, actor, registration, activity_id, grouping, and activity_platform
are keywords that if found are used in send statement requests. See below for
usage examples.
-#### Logging
+#### Logging
The wrapper comes with a logging function (`ADL.XAPIWrapper.log(message)`)
which attempts to write a message to console.log. This can be configured
to not write messages by setting `log.debug = false;`.
@@ -215,11 +215,13 @@ to not write messages by setting `log.debug = false;`.
The xAPI Wrapper supports [ADL's xAPI Launch](https://github.com/adlnet/xapi-launch).
This allows configuration - agent info, lrs endpoint info - to be sent to the wrapper,
instead of using hard-coded configurations. See [Using the xAPI-Launch library](https://github.com/adlnet/xapi-launch#using-the-xapi-launch-library) for
-more details.
+more details.
-If you are using the src files, include xapi-launch.js.
+If you are using the src files, include xapi-launch.js.
``` html
+
+
@@ -234,9 +236,9 @@ Alternatively, use the minified xapiwrapper version, which includes xapi-launch:
``` html
-```
+```
-To use, construct and ADL.launch object passing in a callback.
+To use, construct and ADL.launch object passing in a callback.
``` javascript
var wrapper;
@@ -255,7 +257,7 @@ ADL.launch(function(err, launchdata, xAPIWrapper) {
}
$('#endpoint').text(wrapper.lrs.endpoint);
}, true);
-```
+```
### Use
@@ -374,7 +376,7 @@ XAPIWrapper.prototype.prepareStatement = function(stmt)
if (!stmt.context.contextActivities) {
stmt.context.contextActivities = {};
}
-
+
if (!Array.isArray(stmt.context.contextActivities.grouping)) {
stmt.context.contextActivities.grouping = [{ id : this.lrs.grouping }];
} else {
@@ -442,12 +444,12 @@ var stmt = ADL.XAPIStatement(myactor, ADL.verbs.launched, myactivity);
```
##### Send Statement
-`function sendStatement(statement, callback, [attachments])`
+`function sendStatement(statement, callback, [attachments])`
Sends a single Statement to the LRS using a PUT request. This
method will automatically create the Statement ID. Providing a
function to call after the send Statement request will make
the request happen asynchronously, otherwise Send Statement
-will block until it receives the response from the LRS.
+will block until it receives the response from the LRS.
###### Send Statement without Callback
```JavaScript
@@ -456,7 +458,7 @@ var stmt = {"actor" : {"mbox" : "mailto:tom@example.com"},
"display" : {"en-US" : "answered"}},
"object" : {"id" : "http://adlnet.gov/expapi/activities/question"}};
var resp_obj = ADL.XAPIWrapper.sendStatement(stmt);
-ADL.XAPIWrapper.log("[" + resp_obj.id + "]: " + resp_obj.xhr.status + " - " + resp_obj.xhr.statusText);
+ADL.XAPIWrapper.log("[" + resp_obj.id + "]: " + resp_obj.response.status + " - " + resp_obj.response.statusText);
>> [3e616d1c-5394-42dc-a3aa-29414f8f0dfe]: 200 - OK
```
###### Send Statement with Callback
@@ -466,7 +468,7 @@ var stmt = {"actor" : {"mbox" : "mailto:tom@example.com"},
"verb" : {"id" : "http://adlnet.gov/expapi/verbs/answered",
"display" : {"en-US" : "answered"}},
"object" : {"id" : "http://adlnet.gov/expapi/activities/question"}};
-ADL.XAPIWrapper.sendStatement(stmt, function(resp, obj){
+ADL.XAPIWrapper.sendStatement(stmt, function(resp, obj){
ADL.XAPIWrapper.log("[" + obj.id + "]: " + resp.status + " - " + resp.statusText);});
>> [4edfe763-8b84-41f1-a355-78b7601a6fe8]: 200 - OK
```
@@ -517,9 +519,9 @@ ADL.XAPIWrapper.sendStatement(stmt,callback,[attachment]);
The wrapper looks for URL query string values to include in
its internal configuration. If certain keys
("endpoint","auth","actor","registration","activity_id", "grouping", "activity_platform")
-are found, the values are included in a Statement.
-_URL_
-` http://localhost:8000/content/example.html?registration=51a6f860-1997-11e3-8ffd-0800200c9a66 `
+are found, the values are included in a Statement.
+_URL_
+` http://localhost:8000/content/example.html?registration=51a6f860-1997-11e3-8ffd-0800200c9a66 `
_Client Calls_
```JavaScript
@@ -542,10 +544,10 @@ ADL.XAPIWrapper.getStatements({"statementId":resp_obj.id});
###### Send Statement with ADL xAPI Verbs
ADL also has collected the [ADL xAPI Verbs](https://github.com/adlnet/xAPIVerbs)
-into a Javascript object to easily include. To use...
-_Include verbs.js_
-``
-_Client Calls_
+into a Javascript object to easily include. To use...
+_Include verbs.js_
+``
+_Client Calls_
```JavaScript
var stmt = {"actor" : {"mbox" : "mailto:tom@example.com"},
@@ -585,11 +587,11 @@ ADL.XAPIWrapper.getStatements({"statementId": stmt.id});
```
##### Send Statements
-`function sendStatements(statementArray, callback)`
+`function sendStatements(statementArray, callback)`
Sends a list of Statements to the LRS in one batch. It
accepts the list of Statements and a callback function as
-arguments and returns the XHR request object if no callback
-is supplied. The response of the XHR request upon success will
+arguments and returns the response object.
+The response upon success will
contain a list of Statement IDs.
###### Send Statements without callback
@@ -645,7 +647,7 @@ ADL.XAPIWrapper.sendStatements(stmts, function(err, res, body) {
```
##### Get Statements
-`function getStatements(searchParams, more, callback)`
+`function getStatements(searchParams, more, callback)`
Get a single or collection of Statements based on
search parameters or a StatementResult more value.
@@ -726,7 +728,7 @@ search['verb'] = ADL.verbs.answered.id;
var res = ADL.XAPIWrapper.getStatements(search);
ADL.XAPIWrapper.log(res.statements);
>>
-```
+```
```JavaScript
var search = ADL.XAPIWrapper.searchParams();
@@ -777,8 +779,8 @@ ADL.XAPIWrapper.getActivities("http://adlnet.gov/expapi/activities/question", fu
##### Activity State
-`function sendState(activityid, agent, stateid, registration, statevalue, matchHash, noneMatchHash, callback)`
-`function getState(activityid, agent, stateid, registration, since, callback)`
+`function sendState(activityid, agent, stateid, registration, statevalue, matchHash, noneMatchHash, callback)`
+`function getState(activityid, agent, stateid, registration, since, callback)`
`function deleteState(activityid, agent, stateid, registration, matchHash, noneMatchHash, callback)`
Save / Retrieve / Delete activity state information for a particular agent, and optional registration.
@@ -866,9 +868,9 @@ ADL.XAPIWrapper.getState("http://adlnet.gov/expapi/activities/question",
```
##### Activity Profile
-`function sendActivityProfile(activityid, profileid, profilevalue, matchHash, noneMatchHash, callback)`
-`function getActivityProfile(activityid, profileid, since, callback)`
-`function deleteActivityProfile(activityid, profileid, matchHash, noneMatchHash, callback)`
+`function sendActivityProfile(activityid, profileid, profilevalue, matchHash, noneMatchHash, callback)`
+`function getActivityProfile(activityid, profileid, since, callback)`
+`function deleteActivityProfile(activityid, profileid, matchHash, noneMatchHash, callback)`
Allows for the storage, retrieval and deletion of data about an Activity.
###### Send / Retrieve New Activity Profile
@@ -958,7 +960,7 @@ ADL.XAPIWrapper.getActivityProfile("http://adlnet.gov/expapi/activities/question
#### Agents
##### Get Agent
-`function getAgents(agent, callback)`
+`function getAgents(agent, callback)`
Gets a special Person object containing all the values
of an Agent the LRS knows about. The Person object's
identifying properties are arrays and it may have more
@@ -996,9 +998,9 @@ ADL.XAPIWrapper.getAgents({"mbox":"mailto:tom@example.com"}, function(err, res,
```
##### Agent Profile
-`function sendAgentProfile(agent, profileid, profilevalue, matchHash, noneMatchHash, callback)`
-`function getAgentProfile(agent, profileid, since, callback)`
-`function deleteAgentProfile(agent, profileid, matchHash, noneMatchHash, callback)`
+`function sendAgentProfile(agent, profileid, profilevalue, matchHash, noneMatchHash, callback)`
+`function getAgentProfile(agent, profileid, since, callback)`
+`function deleteAgentProfile(agent, profileid, matchHash, noneMatchHash, callback)`
Allows for the storage, retrieval and deletion of data about an Agent.
###### Send / Retrieve New Agent Profile
diff --git a/dist/xapiwrapper.min.js b/dist/xapiwrapper.min.js
index 9136494..7958a17 100755
--- a/dist/xapiwrapper.min.js
+++ b/dist/xapiwrapper.min.js
@@ -1,4 +1,4 @@
-/*! xAPIWrapper v 1.11.0 | Built on 2020-01-29 13:51:08-0500 */
+/*! xAPIWrapper v 1.11.0 | Built on 2020-09-30 01:25:48-0500 */
-var CryptoJS=(CryptoJS=CryptoJS||function(l){var t={},e=t.lib={},i=e.Base={extend:function(t){n.prototype=this;var e=new n;return t&&e.mixIn(t),e.hasOwnProperty("init")||(e.init=function(){e.$super.init.apply(this,arguments)}),(e.init.prototype=e).$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}};function n(){}var u=e.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||o).stringify(this)},concat:function(t){var e=this.words,i=t.words,n=this.sigBytes,r=t.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;e[n+o>>>2]|=s<<24-(n+o)%4*8}else if(65535>>2]=i[o>>>2];else e.push.apply(e,i);return this.sigBytes+=r,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=l.ceil(e/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],i=0;i>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new u.init(i,e/2)}},s=r.Latin1={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new u.init(i,e)}},a=r.Utf8={stringify:function(t){try{return decodeURIComponent(escape(s.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return s.parse(unescape(encodeURIComponent(t)))}},p=(r.Base64={stringify:function(t){var e=t.words,i=t.sigBytes,n=this._map;t.clamp();for(var r=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var p=n.charAt(64);if(p)for(;r.length%4;)r.push(p);return r.join("")},parse:function(t){var e=t.length,i=this._map,n=i.charAt(64);if(n){var r=t.indexOf(n);-1!=r&&(e=r)}for(var o=[],s=0,a=0;a>>6-a%4*2;o[s>>>2]|=(p|c)<<24-s%4*8,s++}return u.create(o,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=a.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e=this._data,i=e.words,n=e.sigBytes,r=this.blockSize,o=n/(4*r),s=(o=t?l.ceil(o):l.max((0|o)-this._minBufferSize,0))*r,a=l.min(4*s,n);if(s){for(var p=0;p>>31}var l=(n<<5|n>>>27)+a+h[p];l+=p<20?1518500249+(r&o|~r&s):p<40?1859775393+(r^o^s):p<60?(r&o|r&s|o&s)-1894007588:(r^o^s)-899497514,a=s,s=o,o=r<<30|r>>>2,r=n,n=l}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+s|0,i[4]=i[4]+a|0},_doFinalize:function(){var t=this._data,e=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(64+n>>>9<<4)]=l.floor(i/4294967296),e[15+(64+n>>>9<<4)]=i,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=c.clone.call(this);return t._hash=this._hash.clone(),t}});return t.SHA1=c._createHelper(f),t.HmacSHA1=c._createHmacHelper(f),t}(Math))||function(a){function i(){}var t={},e=t.lib={},n=e.Base={extend:function(t){i.prototype=this;var e=new i;return t&&e.mixIn(t),e.hasOwnProperty("init")||(e.init=function(){e.$super.init.apply(this,arguments)}),(e.init.prototype=e).$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},p=e.WordArray=n.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||o).stringify(this)},concat:function(t){var e=this.words,i=t.words,n=this.sigBytes;if(t=t.sigBytes,this.clamp(),n%4)for(var r=0;r>>2]|=(i[r>>>2]>>>24-r%4*8&255)<<24-(n+r)%4*8;else if(65535>>2]=i[r>>>2];else e.push.apply(e,i);return this.sigBytes+=t,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=a.ceil(e/4)},clone:function(){var t=n.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],i=0;i>>2]>>>24-n%4*8&255;i.push((r>>>4).toString(16)),i.push((15&r).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new p.init(i,e/2)}},s=r.Latin1={stringify:function(t){var e=t.words;t=t.sigBytes;for(var i=[],n=0;n>>2]>>>24-n%4*8&255));return i.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new p.init(i,e)}},c=r.Utf8={stringify:function(t){try{return decodeURIComponent(escape(s.stringify(t)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(t){return s.parse(unescape(encodeURIComponent(t)))}},l=e.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=new p.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e=this._data,i=e.words,n=e.sigBytes,r=this.blockSize,o=n/(4*r);if(t=(o=t?a.ceil(o):a.max((0|o)-this._minBufferSize,0))*r,n=a.min(4*t,n),t){for(var s=0;s>>7)^(d<<14|d>>>18)^d>>>3)+g[u-7]+((h<<15|h>>>17)^(h<<13|h>>>19)^h>>>10)+g[u-16]}d=l+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&p^~a&c)+f[u]+g[u],h=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&r^n&o^r&o),l=c,c=p,p=a,a=s+d|0,s=o,o=r,r=n,n=d+h|0}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+s|0,i[4]=i[4]+a|0,i[5]=i[5]+p|0,i[6]=i[6]+c|0,i[7]=i[7]+l|0},_doFinalize:function(){var t=this._data,e=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(64+n>>>9<<4)]=r.floor(i/4294967296),e[15+(64+n>>>9<<4)]=i,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=n._createHelper(o),e.HmacSHA256=n._createHmacHelper(o)}(Math),function(){var c=CryptoJS.enc.Utf8;CryptoJS.algo.HMAC=CryptoJS.lib.Base.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=c.parse(e));var i=t.blockSize,n=4*i;e.sigBytes>n&&(e=t.finalize(e)),e.clamp();for(var r=this._oKey=e.clone(),o=this._iKey=e.clone(),s=r.words,a=o.words,p=0;p>s,s-=6;0<=s;)e[i+=1]=128|o>>s&63,s-=6;r+=65536<=o?2:1}return e.subarray(0,i+1)},t.TextEncoder=e}if(void 0===t.TextDecoder){function a(t){if(String.fromCodePoint)return String.fromCodePoint(t);for(var e=[],i="",n=0,r=arguments.length;n!==r;++n){var o=+arguments[n];if(!(o<1114111&&o>>>0===o))throw RangeError("Invalid code point: "+o);16383<=(o<=65535?e.push(o):(o-=65536,e.push(55296+(o>>10),o%1024+56320)))&&(i+=String.fromCharCode.apply(null,e),e.length=0)}return i+String.fromCharCode.apply(null,e)}function i(t){switch(t=t||"utf8"){case"utf-8":case"utf8":break;default:throw"TextDecoder only supports utf8"}}i.prototype.decode=function(t){for(var e="",i=0;i";i=i.replace("",encodeURIComponent(t));var n=_.XHR_request(this.lrs,i,"GET",null,this.lrs.auth,e,null,!0,null,this.withCredentials,this.strictCallbacks);if(void 0===n||404==n.status)return null;try{return JSON.parse(n.response)}catch(t){return n.response}}},t.prototype.sendState=function(t,e,i,n,r,o,s,a){if(this.testConfig()){var p=this.lrs.endpoint+"activities/state?activityId=&agent=&stateId=";p=(p=(p=p.replace("",encodeURIComponent(t))).replace("",encodeURIComponent(JSON.stringify(e)))).replace("",encodeURIComponent(i)),n&&(p+="®istration="+encodeURIComponent(n));var c=null;o&&s?u("Can't have both If-Match and If-None-Match"):o?c={"If-Match":_.formatHash(o)}:s&&(c={"If-None-Match":_.formatHash(s)});var l="PUT";if(!r)return this.log("No activity state was included."),!1;r instanceof Array?(r=JSON.stringify(r),(c=c||{})["Content-Type"]="application/json"):r instanceof Object?(r=JSON.stringify(r),(c=c||{})["Content-Type"]="application/json",l="POST"):(c=c||{})["Content-Type"]="application/octet-stream",_.XHR_request(this.lrs,p,l,r,this.lrs.auth,a,null,null,c,this.withCredentials,this.strictCallbacks)}},t.prototype.getState=function(t,e,i,n,r,o){if(this.testConfig()){var s=this.lrs.endpoint+"activities/state?activityId=&agent=";s=(s=s.replace("",encodeURIComponent(t))).replace("",encodeURIComponent(JSON.stringify(e))),i&&(s+="&stateId="+encodeURIComponent(i)),n&&(s+="®istration="+encodeURIComponent(n)),r&&null!=(r=isDate(r))&&(s+="&since="+encodeURIComponent(r.toISOString()));var a=_.XHR_request(this.lrs,s,"GET",null,this.lrs.auth,o,null,!0,null,this.withCredentials,this.strictCallbacks);if(void 0===a||404==a.status)return null;try{return JSON.parse(a.response)}catch(t){return a.response}}},t.prototype.deleteState=function(t,e,i,n,r,o,s){if(this.testConfig()){var a=this.lrs.endpoint+"activities/state?activityId=&agent=&stateId=";a=(a=(a=a.replace("",encodeURIComponent(t))).replace("",encodeURIComponent(JSON.stringify(e)))).replace("",encodeURIComponent(i)),n&&(a+="®istration="+encodeURIComponent(n));var p=null;r&&o?u("Can't have both If-Match and If-None-Match"):r?p={"If-Match":_.formatHash(r)}:o&&(p={"If-None-Match":_.formatHash(o)});var c=_.XHR_request(this.lrs,a,"DELETE",null,this.lrs.auth,s,null,!1,p,this.withCredentials,this.strictCallbacks);if(void 0===c||404==c.status)return null;try{return JSON.parse(c.response)}catch(t){return c}}},t.prototype.sendActivityProfile=function(t,e,i,n,r,o){if(this.testConfig()){var s=this.lrs.endpoint+"activities/profile?activityId=&profileId=";s=(s=s.replace("",encodeURIComponent(t))).replace("",encodeURIComponent(e));var a=null;n&&r?u("Can't have both If-Match and If-None-Match"):n?a={"If-Match":_.formatHash(n)}:r&&(a={"If-None-Match":_.formatHash(r)});var p="PUT";if(!i)return this.log("No activity profile was included."),!1;i instanceof Array?(i=JSON.stringify(i),(a=a||{})["Content-Type"]="application/json"):i instanceof Object?(i=JSON.stringify(i),(a=a||{})["Content-Type"]="application/json",p="POST"):(a=a||{})["Content-Type"]="application/octet-stream",_.XHR_request(this.lrs,s,p,i,this.lrs.auth,o,null,!1,a,this.withCredentials,this.strictCallbacks)}},t.prototype.getActivityProfile=function(t,e,i,n){if(this.testConfig()){var r=this.lrs.endpoint+"activities/profile?activityId=";r=r.replace("",encodeURIComponent(t)),e&&(r+="&profileId="+encodeURIComponent(e)),i&&null!=(i=isDate(i))&&(r+="&since="+encodeURIComponent(i.toISOString()));var o=_.XHR_request(this.lrs,r,"GET",null,this.lrs.auth,n,null,!0,null,this.withCredentials,this.strictCallbacks);if(void 0===o||404==o.status)return null;try{return JSON.parse(o.response)}catch(t){return o.response}}},t.prototype.deleteActivityProfile=function(t,e,i,n,r){if(this.testConfig()){var o=this.lrs.endpoint+"activities/profile?activityId=&profileId=";o=(o=o.replace("",encodeURIComponent(t))).replace("",encodeURIComponent(e));var s=null;i&&n?u("Can't have both If-Match and If-None-Match"):i?s={"If-Match":_.formatHash(i)}:n&&(s={"If-None-Match":_.formatHash(n)});var a=_.XHR_request(this.lrs,o,"DELETE",null,this.lrs.auth,r,null,!1,s,this.withCredentials,this.strictCallbacks);if(void 0===a||404==a.status)return null;try{return JSON.parse(a.response)}catch(t){return a}}},t.prototype.getAgents=function(t,e){if(this.testConfig()){var i=this.lrs.endpoint+"agents?agent=";i=i.replace("",encodeURIComponent(JSON.stringify(t)));var n=_.XHR_request(this.lrs,i,"GET",null,this.lrs.auth,e,null,!0,null,this.withCredentials,this.strictCallbacks);if(void 0===n||404==n.status)return null;try{return JSON.parse(n.response)}catch(t){return n.response}}},t.prototype.sendAgentProfile=function(t,e,i,n,r,o){if(this.testConfig()){var s=this.lrs.endpoint+"agents/profile?agent=&profileId=";s=(s=s.replace("",encodeURIComponent(JSON.stringify(t)))).replace("",encodeURIComponent(e));var a=null;n&&r?u("Can't have both If-Match and If-None-Match"):n?a={"If-Match":_.formatHash(n)}:r&&(a={"If-None-Match":_.formatHash(r)});var p="PUT";if(!i)return this.log("No agent profile was included."),!1;i instanceof Array?(i=JSON.stringify(i),(a=a||{})["Content-Type"]="application/json"):i instanceof Object?(i=JSON.stringify(i),(a=a||{})["Content-Type"]="application/json",p="POST"):(a=a||{})["Content-Type"]="application/octet-stream",_.XHR_request(this.lrs,s,p,i,this.lrs.auth,o,null,!1,a,this.withCredentials,this.strictCallbacks)}},t.prototype.getAgentProfile=function(t,e,i,n){if(this.testConfig()){var r=this.lrs.endpoint+"agents/profile?agent=";r=(r=r.replace("",encodeURIComponent(JSON.stringify(t)))).replace("",encodeURIComponent(e)),e&&(r+="&profileId="+encodeURIComponent(e)),i&&null!=(i=isDate(i))&&(r+="&since="+encodeURIComponent(i.toISOString()));var o=_.XHR_request(this.lrs,r,"GET",null,this.lrs.auth,n,null,!0,null,this.withCredentials,this.strictCallbacks);if(void 0===o||404==o.status)return null;try{return JSON.parse(o.response)}catch(t){return o.response}}},t.prototype.deleteAgentProfile=function(t,e,i,n,r){if(this.testConfig()){var o=this.lrs.endpoint+"agents/profile?agent=&profileId=";o=(o=o.replace("",encodeURIComponent(JSON.stringify(t)))).replace("",encodeURIComponent(e));var s=null;i&&n?u("Can't have both If-Match and If-None-Match"):i?s={"If-Match":_.formatHash(i)}:n&&(s={"If-None-Match":_.formatHash(n)});var a=_.XHR_request(this.lrs,o,"DELETE",null,this.lrs.auth,r,null,!1,s,this.withCredentials,this.strictCallbacks);if(void 0===a||404==a.status)return null;try{return JSON.parse(a.response)}catch(t){return a}}},_.ruuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})},_.dateFromISOString=function(t){var e=t.match(new RegExp("([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T| ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?")),i=0,n=new Date(e[1],0,1);e[3]&&n.setMonth(e[3]-1),e[5]&&n.setDate(e[5]),e[7]&&n.setHours(e[7]),e[8]&&n.setMinutes(e[8]),e[10]&&n.setSeconds(e[10]),e[12]&&n.setMilliseconds(1e3*Number("0."+e[12])),e[14]&&(i=60*Number(e[16])+Number(e[17]),i*="-"==e[15]?1:-1),i-=n.getTimezoneOffset(),time=Number(n)+60*i*1e3;var r=new Date;return r.setTime(Number(time)),r},_.XHR_request=function(t,n,r,e,i,o,s,a,p,c,l){"use strict";var u,d,h,f,g,v,y=!1,m=!1,S=!1,b=n.toLowerCase().match(/^(.+):\/\/([^:\/]*):?(\d+)?(\/.*)?$/),w=window.location,x={"Content-Type":"application/json"};if(x.Authorization=i,x["X-Experience-API-Version"]=_.XAPIWrapper.xapiVersion,null!==p)for(var C in p)p.hasOwnProperty(C)&&(x[C]=p[C]);if(m=(m=w.protocol.toLowerCase()!==b[1]||w.hostname.toLowerCase()!==b[2])||(null===b[3]?"http"===b[1]?"80":"443":b[3])===w.port,null!==t&&void 0!==t.extended){for(g in f=new Array,t.extended)f.push(g+"="+encodeURIComponent(t.extended[g]));0-1};function o(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function s(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n.iterable&&(e[Symbol.iterator]=function(){return e}),e}function c(t){this.map={},t instanceof c?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function u(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function l(t){var e=new FileReader,n=u(e);return e.readAsArrayBuffer(t),n}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:n.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():n.arrayBuffer&&n.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||r(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=p(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(l)}),this.text=function(){var t,e,n,i=p(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=u(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),i=0;i-1?i:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function v(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(r))}}),e}function g(t,e){if(!(this instanceof g))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"",this.headers=new c(e.headers),this.url=e.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},h.call(y.prototype),h.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];g.redirect=function(t,e){if(-1===m.indexOf(e))throw new RangeError("Invalid status code");return new g(null,{status:e,headers:{location:t}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function b(i,r){return new Promise(function(o,a){var p=new y(i,r);if(p.signal&&p.signal.aborted)return a(new t.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function l(){u.abort()}u.onload=function(){var t,e,n={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new c,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var n=t.split(":"),i=n.shift().trim();if(i){var r=n.join(":").trim();e.append(i,r)}}),e)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;setTimeout(function(){o(new g(i,n))},0)},u.onerror=function(){setTimeout(function(){a(new TypeError("Network request failed"))},0)},u.ontimeout=function(){setTimeout(function(){a(new TypeError("Network request failed"))},0)},u.onabort=function(){setTimeout(function(){a(new t.DOMException("Aborted","AbortError"))},0)},u.open(p.method,function(t){try{return""===t&&e.location.href?e.location.href:t}catch(e){return t}}(p.url),!0),"include"===p.credentials?u.withCredentials=!0:"omit"===p.credentials&&(u.withCredentials=!1),"responseType"in u&&(n.blob?u.responseType="blob":n.arrayBuffer&&p.headers.get("Content-Type")&&-1!==p.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!r||"object"!=typeof r.headers||r.headers instanceof c?p.headers.forEach(function(t,e){u.setRequestHeader(e,t)}):Object.getOwnPropertyNames(r.headers).forEach(function(t){u.setRequestHeader(t,s(r.headers[t]))}),p.signal&&(p.signal.addEventListener("abort",l),u.onreadystatechange=function(){4===u.readyState&&p.signal.removeEventListener("abort",l)}),u.send(void 0===p._bodyInit?null:p._bodyInit)})}b.polyfill=!0,e.fetch||(e.fetch=b,e.Headers=c,e.Request=y,e.Response=g),t.Headers=c,t.Request=y,t.Response=g,t.fetch=b,Object.defineProperty(t,"__esModule",{value:!0})});var CryptoJS=(CryptoJS=CryptoJS||function(t,e){var n={},i=n.lib={},r=i.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=i.WordArray=r.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=void 0!=e?e:4*t.length},toString:function(t){return(t||a).stringify(this)},concat:function(t){var e=this.words,n=t.words,i=this.sigBytes,r=t.sigBytes;if(this.clamp(),i%4)for(var o=0;o>>2]>>>24-o%4*8&255;e[i+o>>>2]|=s<<24-(i+o)%4*8}else if(n.length>65535)for(o=0;o>>2]=n[o>>>2];else e.push.apply(e,n);return this.sigBytes+=r,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=r.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n=[],i=0;i>>2]>>>24-r%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,n=[],i=0;i>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new o.init(n,e/2)}},c=s.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,i=[],r=0;r>>2]>>>24-r%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,n=[],i=0;i>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new o.init(n,e)}},p=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},u=(s.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,i=this._map;t.clamp();for(var r=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var c=i.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(t){var e=t.length,n=this._map,i=n.charAt(64);if(i){var r=t.indexOf(i);-1!=r&&(e=r)}for(var s=[],a=0,c=0;c>>6-c%4*2;s[a>>>2]|=(p|u)<<24-a%4*8,a++}return o.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,i=n.words,r=n.sigBytes,s=this.blockSize,a=r/(4*s),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,p=t.min(4*c,r);if(c){for(var u=0;u>>31}var u=(i<<5|i>>>27)+a+h[c];u+=c<20?1518500249+(r&o|~r&s):c<40?1859775393+(r^o^s):c<60?(r&o|r&s|o&s)-1894007588:(r^o^s)-899497514,a=s,s=o,o=r<<30|r>>>2,r=i,i=u}n[0]=n[0]+i|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0},_doFinalize:function(){var e=this._data,n=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=t.floor(i/4294967296),n[15+(r+64>>>9<<4)]=i,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=l.clone.call(this);return t._hash=this._hash.clone(),t}});return n.SHA1=l._createHelper(f),n.HmacSHA1=l._createHmacHelper(f),n}(Math))||function(t,e){var n={},i=n.lib={},r=function(){},o=i.Base={extend:function(t){r.prototype=this;var e=new r;return t&&e.mixIn(t),e.hasOwnProperty("init")||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},s=i.WordArray=o.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=void 0!=e?e:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,n=t.words,i=this.sigBytes;if(t=t.sigBytes,this.clamp(),i%4)for(var r=0;r>>2]|=(n[r>>>2]>>>24-r%4*8&255)<<24-(i+r)%4*8;else if(65535>>2]=n[r>>>2];else e.push.apply(e,n);return this.sigBytes+=t,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n=[],i=0;i>>2]>>>24-i%4*8&255;n.push((r>>>4).toString(16)),n.push((15&r).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,n=[],i=0;i>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new s.init(n,e/2)}},p=a.Latin1={stringify:function(t){var e=t.words;t=t.sigBytes;for(var n=[],i=0;i>>2]>>>24-i%4*8&255));return n.join("")},parse:function(t){for(var e=t.length,n=[],i=0;i>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new s.init(n,e)}},u=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(p.stringify(t)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(t){return p.parse(unescape(encodeURIComponent(t)))}},l=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=u.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,i=n.words,r=n.sigBytes,o=this.blockSize,a=r/(4*o);if(e=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*o,r=t.min(4*e,r),e){for(var c=0;cp;){var u;t:{u=c;for(var l=t.sqrt(u),d=2;d<=l;d++)if(!(u%d)){u=!1;break t}u=!0}u&&(8>p&&(o[p]=a(t.pow(c,.5))),s[p]=a(t.pow(c,1/3)),p++),c++}var h=[];r=r.SHA256=i.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,i=n[0],r=n[1],o=n[2],a=n[3],c=n[4],p=n[5],u=n[6],l=n[7],d=0;64>d;d++){if(16>d)h[d]=0|t[e+d];else{var f=h[d-15],y=h[d-2];h[d]=((f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3)+h[d-7]+((y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10)+h[d-16]}f=l+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&p^~c&u)+s[d]+h[d],y=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&r^i&o^r&o),l=u,u=p,p=c,c=a+f|0,a=o,o=r,r=i,i=f+y|0}n[0]=n[0]+i|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+a|0,n[4]=n[4]+c|0,n[5]=n[5]+p|0,n[6]=n[6]+u|0,n[7]=n[7]+l|0},_doFinalize:function(){var e=this._data,n=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=t.floor(i/4294967296),n[15+(r+64>>>9<<4)]=i,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(r),e.HmacSHA256=i._createHmacHelper(r)}(Math),function(){var t=CryptoJS,e=t.enc.Utf8;t.algo.HMAC=t.lib.Base.extend({init:function(t,n){t=this._hasher=new t.init,"string"==typeof n&&(n=e.parse(n));var i=t.blockSize,r=4*i;n.sigBytes>r&&(n=t.finalize(n)),n.clamp();for(var o=this._oKey=n.clone(),s=this._iKey=n.clone(),a=o.words,c=s.words,p=0;p=n)){var r,o=t.charCodeAt(i);return o>=55296&&o<=56319&&n>i+1&&(r=t.charCodeAt(i+1))>=56320&&r<=57343?1024*(o-55296)+r-56320+65536:o}}function n(t){switch(t||(t="utf8"),t){case"utf-8":case"utf8":break;default:throw"TextEncoder only supports utf8"}}n.prototype.encode=function(t){for(var n=new Uint8Array(3*t.length),i=-1,r=t.length,o=0;o>a,a-=6;a>=0;)n[i+=1]=128|s>>a&63,a-=6;o+=s>=65536?2:1}return n.subarray(0,i+1)},t.TextEncoder=n}if(void 0===t.TextDecoder){function i(t){if(String.fromCodePoint)return String.fromCodePoint(t);for(var e=[],n=0,i="",r=0,o=arguments.length;r!==o;++r){var s=+arguments[r];if(!(s<1114111&&s>>>0===s))throw RangeError("Invalid code point: "+s);s<=65535?n=e.push(s):(s-=65536,n=e.push(55296+(s>>10),s%1024+56320)),n>=16383&&(i+=String.fromCharCode.apply(null,e),e.length=0)}return i+String.fromCharCode.apply(null,e)}function r(t){switch(t||(t="utf8"),t){case"utf-8":case"utf8":break;default:throw"TextDecoder only supports utf8"}}r.prototype.decode=function(t){for(var e="",n=0;n0)for(var a=0;a0&&(s={},o=this.buildMultipartPost(e,i,s));var a=await t.send_request(this.lrs,this.lrs.endpoint+"statements","POST",o,this.lrs.auth,n,{id:r},null,s,this.withCredentials,this.strictCallbacks);if(!n)return{response:a,id:r}}},i.prototype.stringToArrayBuffer=function(e,n){return n=n||t.XAPIWrapper.defaultEncoding,new TextEncoder(n).encode(e).buffer},i.prototype.stringFromArrayBuffer=function(e,n){return n=n||t.XAPIWrapper.defaultEncoding,new TextDecoder(n).decode(e)},i.prototype.buildMultipartPost=function(t,e,n){t.attachments=[];for(var i=0;i0&&(r=r+"?"+o.join("&"))}var c=t.send_request(this.lrs,r,"GET",null,this.lrs.auth,i,null,!1,null,this.withCredentials,this.strictCallbacks);if(void 0===c||404==c.status)return null;try{return JSON.parse(c.response)}catch(t){return c.response}}},i.prototype.getActivities=function(e,n){if(this.testConfig()){var i=this.lrs.endpoint+"activities?activityId=";i=i.replace("",encodeURIComponent(e));var r=t.send_request(this.lrs,i,"GET",null,this.lrs.auth,n,null,!0,null,this.withCredentials,this.strictCallbacks);if(void 0===r||404==r.status)return null;try{return JSON.parse(r.response)}catch(t){return r.response}}},i.prototype.sendState=function(e,n,i,r,s,a,c,p){if(this.testConfig()){var u=this.lrs.endpoint+"activities/state?activityId=&agent=&stateId=";u=(u=(u=u.replace("",encodeURIComponent(e))).replace("",encodeURIComponent(JSON.stringify(n)))).replace("",encodeURIComponent(i)),r&&(u+="®istration="+encodeURIComponent(r));var l=null;a&&c?o("Can't have both If-Match and If-None-Match"):a?l={"If-Match":t.formatHash(a)}:c&&(l={"If-None-Match":t.formatHash(c)});var d="PUT";if(!s)return this.log("No activity state was included."),!1;s instanceof Array?(s=JSON.stringify(s),(l=l||{})["Content-Type"]="application/json"):s instanceof Object?(s=JSON.stringify(s),(l=l||{})["Content-Type"]="application/json",d="POST"):(l=l||{})["Content-Type"]="application/octet-stream",t.send_request(this.lrs,u,d,s,this.lrs.auth,p,null,null,l,this.withCredentials,this.strictCallbacks)}},i.prototype.getState=function(e,n,i,r,o,s){if(this.testConfig()){var a=this.lrs.endpoint+"activities/state?activityId=&agent=";a=(a=a.replace("",encodeURIComponent(e))).replace("",encodeURIComponent(JSON.stringify(n))),i&&(a+="&stateId="+encodeURIComponent(i)),r&&(a+="®istration="+encodeURIComponent(r)),o&&null!=(o=isDate(o))&&(a+="&since="+encodeURIComponent(o.toISOString()));var c=t.send_request(this.lrs,a,"GET",null,this.lrs.auth,s,null,!0,null,this.withCredentials,this.strictCallbacks);if(void 0===c||404==c.status)return null;try{return JSON.parse(c.response)}catch(t){return c.response}}},i.prototype.deleteState=function(e,n,i,r,s,a,c){if(this.testConfig()){var p=this.lrs.endpoint+"activities/state?activityId=&agent=&stateId=";p=(p=(p=p.replace("",encodeURIComponent(e))).replace("",encodeURIComponent(JSON.stringify(n)))).replace("",encodeURIComponent(i)),r&&(p+="®istration="+encodeURIComponent(r));var u=null;s&&a?o("Can't have both If-Match and If-None-Match"):s?u={"If-Match":t.formatHash(s)}:a&&(u={"If-None-Match":t.formatHash(a)});var l=t.send_request(this.lrs,p,"DELETE",null,this.lrs.auth,c,null,!1,u,this.withCredentials,this.strictCallbacks);if(void 0===l||404==l.status)return null;try{return JSON.parse(l.response)}catch(t){return l}}},i.prototype.sendActivityProfile=function(e,n,i,r,s,a){if(this.testConfig()){var c=this.lrs.endpoint+"activities/profile?activityId=&profileId=";c=(c=c.replace("",encodeURIComponent(e))).replace("",encodeURIComponent(n));var p=null;r&&s?o("Can't have both If-Match and If-None-Match"):r?p={"If-Match":t.formatHash(r)}:s&&(p={"If-None-Match":t.formatHash(s)});var u="PUT";if(!i)return this.log("No activity profile was included."),!1;i instanceof Array?(i=JSON.stringify(i),(p=p||{})["Content-Type"]="application/json"):i instanceof Object?(i=JSON.stringify(i),(p=p||{})["Content-Type"]="application/json",u="POST"):(p=p||{})["Content-Type"]="application/octet-stream",t.send_request(this.lrs,c,u,i,this.lrs.auth,a,null,!1,p,this.withCredentials,this.strictCallbacks)}},i.prototype.getActivityProfile=function(e,n,i,r){if(this.testConfig()){var o=this.lrs.endpoint+"activities/profile?activityId=";o=o.replace("",encodeURIComponent(e)),n&&(o+="&profileId="+encodeURIComponent(n)),i&&null!=(i=isDate(i))&&(o+="&since="+encodeURIComponent(i.toISOString()));var s=t.send_request(this.lrs,o,"GET",null,this.lrs.auth,r,null,!0,null,this.withCredentials,this.strictCallbacks);if(void 0===s||404==s.status)return null;try{return JSON.parse(s.response)}catch(t){return s.response}}},i.prototype.deleteActivityProfile=function(e,n,i,r,s){if(this.testConfig()){var a=this.lrs.endpoint+"activities/profile?activityId=&profileId=";a=(a=a.replace("",encodeURIComponent(e))).replace("",encodeURIComponent(n));var c=null;i&&r?o("Can't have both If-Match and If-None-Match"):i?c={"If-Match":t.formatHash(i)}:r&&(c={"If-None-Match":t.formatHash(r)});var p=t.send_request(this.lrs,a,"DELETE",null,this.lrs.auth,s,null,!1,c,this.withCredentials,this.strictCallbacks);if(void 0===p||404==p.status)return null;try{return JSON.parse(p.response)}catch(t){return p}}},i.prototype.getAgents=function(e,n){if(this.testConfig()){var i=this.lrs.endpoint+"agents?agent=";i=i.replace("",encodeURIComponent(JSON.stringify(e)));var r=t.send_request(this.lrs,i,"GET",null,this.lrs.auth,n,null,!0,null,this.withCredentials,this.strictCallbacks);if(void 0===r||404==r.status)return null;try{return JSON.parse(r.response)}catch(t){return r.response}}},i.prototype.sendAgentProfile=function(e,n,i,r,s,a){if(this.testConfig()){var c=this.lrs.endpoint+"agents/profile?agent=&profileId=";c=(c=c.replace("",encodeURIComponent(JSON.stringify(e)))).replace("",encodeURIComponent(n));var p=null;r&&s?o("Can't have both If-Match and If-None-Match"):r?p={"If-Match":t.formatHash(r)}:s&&(p={"If-None-Match":t.formatHash(s)});var u="PUT";if(!i)return this.log("No agent profile was included."),!1;i instanceof Array?(i=JSON.stringify(i),(p=p||{})["Content-Type"]="application/json"):i instanceof Object?(i=JSON.stringify(i),(p=p||{})["Content-Type"]="application/json",u="POST"):(p=p||{})["Content-Type"]="application/octet-stream",t.send_request(this.lrs,c,u,i,this.lrs.auth,a,null,!1,p,this.withCredentials,this.strictCallbacks)}},i.prototype.getAgentProfile=function(e,n,i,r){if(this.testConfig()){var o=this.lrs.endpoint+"agents/profile?agent=";o=(o=o.replace("",encodeURIComponent(JSON.stringify(e)))).replace("",encodeURIComponent(n)),n&&(o+="&profileId="+encodeURIComponent(n)),i&&null!=(i=isDate(i))&&(o+="&since="+encodeURIComponent(i.toISOString()));var s=t.send_request(this.lrs,o,"GET",null,this.lrs.auth,r,null,!0,null,this.withCredentials,this.strictCallbacks);if(void 0===s||404==s.status)return null;try{return JSON.parse(s.response)}catch(t){return s.response}}},i.prototype.deleteAgentProfile=function(e,n,i,r,s){if(this.testConfig()){var a=this.lrs.endpoint+"agents/profile?agent=&profileId=";a=(a=a.replace("",encodeURIComponent(JSON.stringify(e)))).replace("",encodeURIComponent(n));var c=null;i&&r?o("Can't have both If-Match and If-None-Match"):i?c={"If-Match":t.formatHash(i)}:r&&(c={"If-None-Match":t.formatHash(r)});var p=t.send_request(this.lrs,a,"DELETE",null,this.lrs.auth,s,null,!1,c,this.withCredentials,this.strictCallbacks);if(void 0===p||404==p.status)return null;try{return JSON.parse(p.response)}catch(t){return p}}},t.ruuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})},t.dateFromISOString=function(t){var e=t.match(new RegExp("([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T| ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?")),n=0,i=new Date(e[1],0,1);e[3]&&i.setMonth(e[3]-1),e[5]&&i.setDate(e[5]),e[7]&&i.setHours(e[7]),e[8]&&i.setMinutes(e[8]),e[10]&&i.setSeconds(e[10]),e[12]&&i.setMilliseconds(1e3*Number("0."+e[12])),e[14]&&(n=60*Number(e[16])+Number(e[17]),n*="-"==e[15]?1:-1),n-=i.getTimezoneOffset(),time=Number(i)+60*n*1e3;var r=new Date;return r.setTime(Number(time)),r},t.send_request=async function(e,n,i,r,o,s,a,c,p,u,l){"use strict";var d,h,f=n.toLowerCase().match(/^(.+):\/\/([^:\/]*):?(\d+)?(\/.*)?$/),y=window.location,v={"Content-Type":"application/json"};if(v.Authorization=o,v["X-Experience-API-Version"]=t.XAPIWrapper.xapiVersion,null!==p)for(var g in p)p.hasOwnProperty(g)&&(v[g]=p[g]);if(y.protocol.toLowerCase()!==f[1]||y.hostname.toLowerCase()!==f[2]||(null===f[3]?"http"===f[1]?"80":"443":f[3])===y.port,null!==e&&void 0!==e.extended){for(h in d=new Array,e.extended)d.push(h+"="+encodeURIComponent(e.extended[h]));d.length>0&&(n+=(n.indexOf("?")>-1?"&":"?")+d.join("&"))}try{var m=await fetch(n,{method:i,mode:"cors",cache:"no-cache",credentials:u?"include":"same-origin",headers:v,body:r}),b=!c&&404===m.status,w=(m.status<200||m.status>400)&&404!==m.status;if(void 0===m.status||w||b)throw new Error(m.statusText);var S=await m.json();return s&&(a?l?s(null,m,a):s(m,a):l?s(null,m,S):s(m,S)),m}catch(e){var x;try{x="There was a problem communicating with the Learning Record Store. ( "+m.status+" | "+m.statusText+" )"+n}catch(t){x=t.toString()}t.XAPIWrapper.log(x),t.errorOnRequest(m,s,a,l)}},t.errorOnRequest=function(t,e,n,i){if(e&&i){var r,o=t?t.status:void 0;if(r=o?new Error("Request error: "+t.status):0===o||null===o?new Error("Request error: aborted"):new Error("Reqeust error: unknown"),n)e(r,t,n);else{var s;try{s=JSON.parse(t.statusText)}catch(e){s=t.statusText}e(r,t,s)}}},t.formatHash=function(t){return"*"===t?t:'"'+t+'"'},t.XAPIWrapper=new i(n,!1)}(window.ADL=window.ADL||{}),function(t){function e(t,n){var i=n.split("."),r=i[0];return n=i.slice(1).join("."),t[r]||(/\[\]$/.test(r)?(r=r.slice(0,-2),Array.isArray(t[r])||(t[r]=[])):t[r]={}),n?e(t[r],n):t[r]}var n=function(e,n,p,u){if(e&&e.actor&&e.verb&&e.object){var l=e;for(var d in l)"actor"!=d&&"verb"!=d&&"object"!=d&&(this[d]=l[d]);e=l.actor,n=l.verb,p=l.object}e?e instanceof i?this.actor=e:"Agent"!==e.objectType&&e.objectType?"Group"===e.objectType&&(this.actor=new r(e)):this.actor=new i(e):this.actor=null,this.verb=n?n instanceof o?n:new o(n):null,p?"Activity"!==p.objectType&&p.objectType?"Agent"===p.objectType?this.object=p instanceof i?p:new i(p):"Group"===p.objectType?this.object=p instanceof r?p:new r(p):"StatementRef"===p.objectType?this.object=p instanceof a?p:new a(p):"SubStatement"===p.objectType?this.object=p instanceof c?p:new c(p):this.object=null:this.object=p instanceof s?p:new s(p):this.object=null,u&&(this.result=u),this.generateId=function(){this.id=t.ruuid()}};n.prototype.toString=function(){return this.actor.toString()+" "+this.verb.toString()+" "+this.object.toString()+" "+this.result.toString()},n.prototype.isValid=function(){return this.actor&&this.actor.isValid()&&this.verb&&this.verb.isValid()&&this.object&&this.object.isValid()&&this.result&&this.result.isValid()},n.prototype.generateRegistration=function(){e(this,"context").registration=t.ruuid()},n.prototype.addParentActivity=function(t){e(this,"context.contextActivities.parent[]").push(new s(t))},n.prototype.addGroupingActivity=function(t){e(this,"context.contextActivities.grouping[]").push(new s(t))},n.prototype.addOtherContextActivity=function(t){e(this,"context.contextActivities.other[]").push(new s(t))};var i=function(t,e){if(this.objectType="Agent",this.name=e,t&&(t.mbox||t.mbox_sha1sum||t.openid||t.account))for(var n in t)this[n]=t[n];else/^mailto:/.test(t)?this.mbox=t:/^[0-9a-f]{40}$/i.test(t)?this.mbox_sha1sum=t:/^http[s]?:/.test(t)?this.openid=t:t&&t.homePage&&t.name&&(this.account=t)};i.prototype.toString=function(){return this.name||this.mbox||this.openid||this.mbox_sha1sum||this.account.name},i.prototype.isValid=function(){return this.mbox||this.mbox_sha1sum||this.openid||this.account.homePage&&this.account.name||"Group"===this.objectType&&this.member};var r=function(t,e,n){i.call(this,t,n),this.member=e,this.objectType="Group"};r.prototype=new i;var o=function(t,e){if(t&&t.id)for(var n in t)this[n]=t[n];else this.id=t,e&&("string"==typeof e||e instanceof String?this.display={"en-US":e}:this.display=e)};o.prototype.toString=function(){return this.display&&(this.display["en-US"]||this.display.en)?this.display["en-US"]||this.display.en:this.id},o.prototype.isValid=function(){return this.id};var s=function(t,e,n){if(t&&t.id){var i=t;for(var r in i)this[r]=i[r]}else this.objectType="Activity",this.id=t,(e||n)&&(this.definition={},"string"==typeof e||e instanceof String?this.definition.name={"en-US":e}:e&&(this.definition.name=e),"string"==typeof n||n instanceof String?this.definition.description={"en-US":n}:n&&(this.definition.description=n))};s.prototype.toString=function(){return this.definition&&this.definition.name&&(this.definition.name["en-US"]||this.definition.name.en)?this.definition.name["en-US"]||this.definition.name.en:this.id},s.prototype.isValid=function(){return this.id&&(!this.objectType||"Activity"===this.objectType)};var a=function(t){if(t&&t.id)for(var e in t)this[e]=t[e];else this.objectType="StatementRef",this.id=t};a.prototype.toString=function(){return"statement("+this.id+")"},a.prototype.isValid=function(){return this.id&&this.objectType&&"StatementRef"===this.objectType};var c=function(t,e,i){n.call(this,t,e,i),this.objectType="SubStatement",delete this.id,delete this.stored,delete this.version,delete this.authority};c.prototype=new n,c.prototype.toString=function(){return'"'+c.prototype.prototype.toString.call(this)+'"'},n.Agent=i,n.Group=r,n.Verb=o,n.Activity=s,n.StatementRef=a,n.SubStatement=c,t.XAPIStatement=n}(window.ADL=window.ADL||{}),function(t){var e=t,n=!1;"undefined"!=typeof window&&(e=window.ADL=t.ADL||{},n=!0);var i=function(t){if("SubStatement"===t.objectType&&("SubStatement"!==t.object.objectType&&!(t.id||t.stored||t.version||t.authority)))return e.xapiutil.getActorId(t.actor)+":"+e.xapiutil.getVerbDisplay(t.verb)+":"+e.xapiutil.getObjectId(t.object)};e.xapiutil={},e.xapiutil.getLang=function(){var t;if("undefined"!=typeof navigator)t=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;else if("undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.LANG){var e=process.env.LANG;t=(t=e.slice(0,e.indexOf("."))).replace(/_/,"-")}return t||"en-US"},e.xapiutil.getLangVal=function(t){if(t&&0!=Object.keys(t).length){var n,i=e.xapiutil.getLang(),r=!1;do{t[i]?(n=t[i],r=!0):i.indexOf("-")&&(i=i.substring(0,i.lastIndexOf("-")))}while(!r&&""!==i);return n}},e.xapiutil.getMoreStatements=function(t,i,r){if(!n)throw new Error("Node not supported.");var o=[];e.XAPIWrapper.getStatements(r,null,function n(s){if(s&&s.response){var a=JSON.parse(s.response);a.statements&&(o=o.concat(a.statements),t--<=0?i(o):a.more&&""!==a.more?e.XAPIWrapper.getStatements(r,a.more,n):""===a.more&&i(o))}})},e.xapiutil.getActorId=function(t){return t.mbox||t.openid||t.mbox_sha1sum||t.account},e.xapiutil.getActorIdString=function(t){var e=t.mbox||t.openid||t.mbox_sha1sum;return e||(e=t.account?t.account.homePage+":"+t.account.name:t.member?"Anon Group "+t.member:"unknown"),e},e.xapiutil.getActorDisplay=function(t){return t.name||e.xapiutil.getActorIdString(t)},e.xapiutil.getVerbDisplay=function(t){if(t)return t.display&&e.xapiutil.getLangVal(t.display)||t.id},e.xapiutil.getObjectType=function(t){return t.objectType||(t.id?"Activity":"Agent")},e.xapiutil.getObjectId=function(t){if(t.id)return t.id;var n=e.xapiutil.getObjectType(t);return"Agent"===n||"Group"===n?e.xapiutil.getActorId(t):void 0},e.xapiutil.getObjectIdString=function(t){if(!t)return"unknown";if(t.id)return t.id;var n=e.xapiutil.getObjectType(t);return"Agent"===n||"Group"===n?e.xapiutil.getActorIdString(t):"SubStatement"==n?i(t):"unknown"},e.xapiutil.getObjectDisplay=function(t){if(!t)return"unknown";var n=function(t){if(t.definition&&t.definition.name)return e.xapiutil.getLangVal(t.definition.name)}(t)||t.name||t.id;if(!n){var r=e.xapiutil.getObjectType(t);"Agent"===r||"Group"==r?n=e.xapiutil.getActorDisplay(t):"SubStatement"==r&&(n=i(t))}return n}}(this),function(t){var e=window.ADL=window.ADL||{};function n(t){for(var e=window.location.search.substring(1).split("&"),n=0;n-1?o+"&"+e:o+"?"+e,r.href=o)}}e.launch=async function t(r,o,s){r=function(t){return function(){var e=arguments;window.setTimeout(function(){for(var n=[],i=0;ixAPIWrapper 1.11.0 Reference
getAgentProfile
deleteAgentProfile
testConfig
- ie_request
ruuid
dateFromISOString
- XHR_request
- xhrRequestOnError
+ send_request
+ errorOnRequest
@@ -1114,7 +1113,7 @@ XAPIWrapper (config, verifyxa
if (verifyxapiversion && testConfig.call(this))
{
- window.ADL.XHR_request(this.lrs, this.lrs.endpoint+"about", "GET", null, null,
+ window.ADL.send_request(this.lrs, this.lrs.endpoint+"about", "GET", null, null,
function(r){
if(r.status == 200)
{
@@ -1260,7 +1259,7 @@ prepareStatement (stmt)<
if (!stmt.context.contextActivities) {
stmt.context.contextActivities = {};
}
-
+
// PR from brian-learningpool to resolve context overwriting
if (!Array.isArray(stmt.context.contextActivities.grouping)) {
stmt.context.contextActivities.grouping = [{ id : this.lrs.grouping }];
@@ -1336,7 +1335,7 @@
Returns
object
-
object containing xhr object and id of statement
+ object containing response object and id of statement
-
-
-
-
-
-
-
// Sorry, no example available.
-
-
-
function ie_request(method, url, headers, data)
-{
- var newUrl = url;
-
- //Everything that was on query string goes into form vars
- var formData = new Array();
- var qsIndex = newUrl.indexOf('?');
- if(qsIndex > 0){
- formData.push(newUrl.substr(qsIndex+1));
- newUrl = newUrl.substr(0, qsIndex);
- }
-
- //Method has to go on querystring, and nothing else
- newUrl = newUrl + '?method=' + method;
-
- //Headers
- if(headers !== null){
- for (var headerName in headers) {
- if (headers.hasOwnProperty(headerName))
- formData.push(headerName + "=" + encodeURIComponent(headers[headerName]));
- }
- }
-
- //The original data is repackaged as "content" form var
- if(data !== null){
- formData.push('content=' + encodeURIComponent(data));
- }
-
- return {
- "method":"POST",
- "url":newUrl,
- "headers":{},
- "data":formData.join("&")
- };
-}
-
-
-
-
-
-
-
-
-
-
-
- XHR_request (lrs, url, method, data, auth, callback, callbackargs, ignore404, extraHeaders, withCredentials, strictCallbacks)
+ send_request (lrs, url, method, data, auth, callback, callbackargs, ignore404, extraHeaders, withCredentials, strictCallbacks)
@@ -3523,7 +3399,7 @@
Returns
object
-
xhr response object
+
response object
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/testState.html b/test/testState.html
index 6890350..41b02e3 100644
--- a/test/testState.html
+++ b/test/testState.html
@@ -19,6 +19,8 @@
+
+
diff --git a/test/testUtil.html b/test/testUtil.html
index 86860d8..128acc8 100644
--- a/test/testUtil.html
+++ b/test/testUtil.html
@@ -20,10 +20,12 @@
+
+
-
+
diff --git a/test/tests/test.attachments.js b/test/tests/test.attachments.js
index 02dd8b0..1302edc 100644
--- a/test/tests/test.attachments.js
+++ b/test/tests/test.attachments.js
@@ -40,9 +40,9 @@ describe('testing xAPI attachments', function () {
type:attachmentMetadata
}
- ADL.XAPIWrapper.sendStatement(statement, function (xhr) {
- xhr.should.be.type('object');
- xhr.status.should.eql(200);
+ ADL.XAPIWrapper.sendStatement(statement, function (response) {
+ response.should.be.type('object');
+ response.status.should.eql(200);
done();
}, [attachment]);
});
diff --git a/test/tests/test.state.js b/test/tests/test.state.js
index ca8b157..d4fd512 100644
--- a/test/tests/test.state.js
+++ b/test/tests/test.state.js
@@ -24,15 +24,15 @@ describe('testing xAPI attachments', function () {
var agent = {"mbox":"mailto:tom@example.com"};
var stateval = {"info":"the state info"};
- ADL.XAPIWrapper.sendState(activityId, agent, activityState, null, stateval, null, null, function(xhr, body){
+ ADL.XAPIWrapper.sendState(activityId, agent, activityState, null, stateval, null, null, function(response, body){
- xhr.should.be.type('object');
- xhr.status.should.eql(204);
+ response.should.be.type('object');
+ response.status.should.eql(204);
- ADL.XAPIWrapper.getState(activityId, agent, activityState, null, null, function(xhr, body){
+ ADL.XAPIWrapper.getState(activityId, agent, activityState, null, null, function(response, body){
- xhr.should.be.type('object');
- xhr.status.should.eql(200);
+ response.should.be.type('object');
+ response.status.should.eql(200);
body.info.should.eql(stateval.info);
done();
}
@@ -40,4 +40,4 @@ describe('testing xAPI attachments', function () {
}
);
});
-});
\ No newline at end of file
+});