This is an automated email from the ASF dual-hosted git repository.

poorejc pushed a commit to branch FLAGON-469
in repository https://gitbox.apache.org/repos/asf/incubator-flagon-useralejs.git


The following commit(s) were added to refs/heads/FLAGON-469 by this push:
     new c58360a  [FLAGON-478] Updated Example Page Instructions to Flex API & 
modified Gulp file to build UserALE in UMD format (was iife)
c58360a is described below

commit c58360ae13d12344b35efbfea0bf216c19f145f6
Author: poorejc <[email protected]>
AuthorDate: Fri Jan 10 10:48:25 2020 -0500

    [FLAGON-478] Updated Example Page Instructions to Flex API & modified Gulp 
file to build UserALE in UMD format (was iife)
---
 build/UserAleWebExtension/background.js |  4 ++--
 build/UserAleWebExtension/content.js    |  4 ++--
 build/UserAleWebExtension/options.js    |  4 ++--
 build/userale-2.1.0.js                  | 13 +++++++----
 build/userale-2.1.0.min.js              |  2 +-
 example/index.html                      | 41 ++++++++++++++++++++++-----------
 example/{aleAPI.js => index.js}         |  7 +++---
 gulpfile.js                             |  2 +-
 src/UserALEWebExtension/globals.js      |  4 ++--
 src/packageLogs.js                      |  2 +-
 10 files changed, 50 insertions(+), 33 deletions(-)

diff --git a/build/UserAleWebExtension/background.js 
b/build/UserAleWebExtension/background.js
index 288c3df..8c32713 100644
--- a/build/UserAleWebExtension/background.js
+++ b/build/UserAleWebExtension/background.js
@@ -19,10 +19,10 @@
 
 // these are default values, which can be overridden by the user on the 
options page
 var userAleHost = 'http://localhost:8000';
-var userAleScript = 'userale-2.0.2.min.js';
+var userAleScript = 'userale-2.1.0.min.js';
 var toolUser = 'nobody';
 var toolName = 'test_app';
-var toolVersion = '2.0.2';
+var toolVersion = '2.1.0';
 
 /* eslint-enable */
 
diff --git a/build/UserAleWebExtension/content.js 
b/build/UserAleWebExtension/content.js
index 2514e20..00aecf0 100644
--- a/build/UserAleWebExtension/content.js
+++ b/build/UserAleWebExtension/content.js
@@ -19,10 +19,10 @@
 
 // these are default values, which can be overridden by the user on the 
options page
 var userAleHost = 'http://localhost:8000';
-var userAleScript = 'userale-2.0.2.min.js';
+var userAleScript = 'userale-2.1.0.min.js';
 var toolUser = 'nobody';
 var toolName = 'test_app';
-var toolVersion = '2.0.2';
+var toolVersion = '2.1.0';
 
 /* eslint-enable */
 
diff --git a/build/UserAleWebExtension/options.js 
b/build/UserAleWebExtension/options.js
index 1badba4..353029a 100644
--- a/build/UserAleWebExtension/options.js
+++ b/build/UserAleWebExtension/options.js
@@ -19,10 +19,10 @@
 
 // these are default values, which can be overridden by the user on the 
options page
 var userAleHost = 'http://localhost:8000';
-var userAleScript = 'userale-2.0.2.min.js';
+var userAleScript = 'userale-2.1.0.min.js';
 var toolUser = 'nobody';
 var toolName = 'test_app';
-var toolVersion = '2.0.2';
+var toolVersion = '2.1.0';
 
 /* eslint-enable */
 
diff --git a/build/userale-2.1.0.js b/build/userale-2.1.0.js
index 7855a99..4c53af1 100644
--- a/build/userale-2.1.0.js
+++ b/build/userale-2.1.0.js
@@ -16,8 +16,11 @@
  * @preserved
  */
 
-var userale = (function (exports) {
-  'use strict';
+(function (global, factory) {
+  typeof exports === 'object' && typeof module !== 'undefined' ? 
factory(exports) :
+  typeof define === 'function' && define.amd ? define(['exports'], factory) :
+  (global = global || self, factory(global.userale = {}));
+}(this, (function (exports) { 'use strict';
 
   var version = "2.1.0";
 
@@ -529,7 +532,7 @@ var userale = (function (exports) {
           'sessionID': config.sessionID
       };
 
-      var log = Object.assign(customLog, metaData);
+      var log = Object.assign(metaData, customLog);
 
       if ((typeof filterHandler === 'function') && !filterHandler(log)) {
           return false;
@@ -1108,6 +1111,6 @@ var userale = (function (exports) {
   exports.stop = stop;
   exports.version = version$1;
 
-  return exports;
+  Object.defineProperty(exports, '__esModule', { value: true });
 
-}({}));
+})));
diff --git a/build/userale-2.1.0.min.js b/build/userale-2.1.0.min.js
index f005624..76cf4e6 100644
--- a/build/userale-2.1.0.min.js
+++ b/build/userale-2.1.0.min.js
@@ -15,4 +15,4 @@
  * limitations under the License.
  * @preserved
  */
-var userale=function(t){"use strict";var e="2.1.0",r=null;function 
n(t,o){Object.keys(o).forEach(function(e){if("userFromParams"===e){var 
n=function(e){var n=new 
RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),t=window.location.href.match(n);return 
t&&t[2]?decodeURIComponent(t[2].replace(/\+/g," 
")):null}(o[e]);n&&(t.userId=n)}t[e]=o[e]})}var f="undefined"!=typeof 
globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof 
global?global:"undefined"!=typeof self?self:{};var o,i,a=(fu [...]
\ No newline at end of file
+!function(e,n){"object"==typeof exports&&"undefined"!=typeof 
module?n(exports):"function"==typeof 
define&&define.amd?define(["exports"],n):n((e=e||self).userale={})}(this,function(t){"use
 strict";var e="2.1.0",r=null;function 
n(t,o){Object.keys(o).forEach(function(e){if("userFromParams"===e){var 
n=function(e){var n=new 
RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),t=window.location.href.match(n);return 
t&&t[2]?decodeURIComponent(t[2].replace(/\+/g," 
")):null}(o[e]);n&&(t.userId=n)}t[e]=o[e]})}var [...]
\ No newline at end of file
diff --git a/example/index.html b/example/index.html
index 043162f..de2a0d6 100644
--- a/example/index.html
+++ b/example/index.html
@@ -14,25 +14,31 @@ limitations under the License.
 -->
 <html>
 <head>
-  <title>UserAleJS - Example Page</title>
+  <title>UserALE.js - Example Page</title>
 
   <!-- Load UserALE.js and set logging parameters-->
   <script
-          src="{your path here}/build/userale-2.0.2.min.js"
+          src="../build/userale-2.1.0.min.js"
           data-url="http://localhost:8000/";
           data-user="example-user"
-          data-log-details="false"
+          data-log-details="true" <!--careful! 'true' will give you keys and 
inputs-->
           data-version="2.1.0"
           data-tool="Apache UserALE.js Example"
   ></script>
-  <!-- Load UserALE.js API calls to modify log stream -->
+  <!-- Load UserALE.js API calls to modify log stream-->
   <script
-          src="{your path here}/example/aleAPI.js"
+          src="./index.js"
   ></script>
 </head>
 <body>
 <br>
-<br>
+<p>
+  This UserALE.js Example Page lets you explore how UserALE.js works, deploys 
with a script tag, and the data it generates.<br>
+  By default, you'll see the raw logs UserALE.js generates. We kept this page 
simple so that its easy to see how things work.
+</p>
+<p>
+  To see how our API can be used to shape UserALE.js logs to your needs, 
uncomment the 'index.js' script tag in index.html.
+</p>
 <br>
 <p>Click the button below to generate targeted click events.</p>
 <div class="container">
@@ -40,18 +46,26 @@ limitations under the License.
 </div>
 <br>
 <br>
-<br>
-<p>Play around with these form elements to see a variety of UserALE.js log 
types:</p>
-<p>Capture inputs and changes to text fields</p>
+<p>Play around with the form elements below to see a variety of UserALE.js log 
types:</p>
+<p>
+  Capture changes to fields (and values, when it's safe).
+</p>
+<p>
+  With index.js injected into the page, you can use the 'Test Field' below to 
see the behavior of our API dynamically.<br>
+  Type in the following UserALE.js function names to see their behavior.
+<ul>
+  <li>"log" - ship a fully customized log, built from scratch</li>
+  <li>"packageLog" - hijack our own pipeline to modify and ship logs packaged 
exactly like standard UserALE.js logs</li>
+  <li>"packageCustomLog" - smash a number of custom fields together with 
UserALE.js standard metadata</li>
+</ul>
+
 <form id="test_text_input">
-  <label>Test field: <input type="text"></label>
+  <label>Test Field: <input type="text"></label>
   <br><br>
   <button type="submit">Submit form</button>
 </form>
 <br>
-<br>
-<br>
-<p>Capture inputs and changes to different types of selections</p>
+<p>Capture inputs and changes to different types of selections.</p>
 <select name="UserALE.js Committers">
   <option value="clay">Clay</option>
   <option value="rob">Rob</option>
@@ -60,7 +74,6 @@ limitations under the License.
 </select>
 <br>
 <br>
-<br>
 <form id="test_radio_input">
   <input type="radio" name="Use Case" value="business analytics" checked> 
Business Analytics<br>
   <input type="radio" name="Use Case" value="HCI"> HCI<br>
diff --git a/example/aleAPI.js b/example/index.js
similarity index 95%
rename from example/aleAPI.js
rename to example/index.js
index b46d930..2cf8cc6 100644
--- a/example/aleAPI.js
+++ b/example/index.js
@@ -29,11 +29,12 @@ window.userale.options({
 /**the 'filter' API allows you to eliminate logs you don't want
  * use as a global filter and add classes of events or log types to eliminate
  * or use in block scope to surgically eliminate logs from specific elements 
from an event handler
+ * The filter below reduces logs to capture click, change, select, and submit 
events on index.html
  * Note that for surgical filters, you may need to clear or reset back to a 
global filter callback
  * the same is true for the 'map' API. See examples below:
  */
 window.userale.filter(function (log) {
-    var type_array = ['mouseup', 'mouseover', 'mousedown', 'keydown', 
'dblclick', 'blur', 'focus', 'input'];
+    var type_array = ['mouseup', 'mouseover', 'mousedown', 'keydown', 
'dblclick', 'blur', 'focus', 'input', 'wheel'];
     var logType_array = ['interval'];
     return !type_array.includes(log.type) && 
!logType_array.includes(log.logType);
 });
@@ -94,7 +95,7 @@ document.addEventListener('change', function(e) {
             toolName: window.userale.options().toolName,
             useraleVersion: window.userale.options().useraleVersion,
             sessionID: window.userale.options().sessionID,
-            customLabel: "(custom) log Example!"
+            customLabel: "(custom) Log Example"
         });
     }
 });
@@ -126,7 +127,7 @@ document.addEventListener('change', function(e){
 document.addEventListener('change', function(e) {
     if (e.target.value === 'packageCustomLog') {
         window.userale.packageCustomLog({
-            customLabel: 'packageCustomLog Example!',
+            customLabel: 'packageCustomLog Example',
             customField1: 'foo',
             customField2: 'bar'},
             function(){return 'add additional details here!'},
diff --git a/gulpfile.js b/gulpfile.js
index 770d93f..8c8fcc0 100755
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -72,7 +72,7 @@ gulp.task('rollup', function() {
   .then(function(bundle) {
     return bundle.write({
       file : 'build/' + userale + '.js',
-      format : 'iife',
+      format : 'umd',
       name: 'userale'
     });
   });
diff --git a/src/UserALEWebExtension/globals.js 
b/src/UserALEWebExtension/globals.js
index 1a27083..c14ad47 100644
--- a/src/UserALEWebExtension/globals.js
+++ b/src/UserALEWebExtension/globals.js
@@ -19,9 +19,9 @@
 
 // these are default values, which can be overridden by the user on the 
options page
 export var userAleHost = 'http://localhost:8000';
-export var userAleScript = 'userale-2.0.2.min.js';
+export var userAleScript = 'userale-2.1.0.min.js';
 export var toolUser = 'nobody';
 export var toolName = 'test_app';
-export var toolVersion = '2.0.2';
+export var toolVersion = '2.1.0';
 
 /* eslint-enable */
diff --git a/src/packageLogs.js b/src/packageLogs.js
index 36cb9d2..92889fd 100644
--- a/src/packageLogs.js
+++ b/src/packageLogs.js
@@ -157,7 +157,7 @@ export function packageCustomLog(customLog, detailFcn, 
userAction) {
         'sessionID': config.sessionID
     };
 
-    var log = Object.assign(customLog, metaData);
+    var log = Object.assign(metaData, customLog);
 
     if ((typeof filterHandler === 'function') && !filterHandler(log)) {
         return false;

Reply via email to