From 9f220448e28f28f964508e0fb2ed2bdb1c0285a1 Mon Sep 17 00:00:00 2001 From: Joe Khoury Date: Thu, 20 Sep 2018 15:55:29 -0400 Subject: [PATCH] Version 8.0 --- README.md | 13 +++++++++++++ dist/dil.js | 1 + 2 files changed, 14 insertions(+) create mode 100644 README.md create mode 100644 dist/dil.js diff --git a/README.md b/README.md new file mode 100644 index 0000000..d373866 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# DIL + +Data Integration Library for Audience Manager. + +## Instructions + +Visit the [Releases](https://github.com/Adobe-Marketing-Cloud/dil/releases) tab and download the `source.zip` folder which contains the `dist/dil.js` library. + +If you are looking for the latest version, you can find it [here](https://github.com/Adobe-Marketing-Cloud/dil/releases/latest). + +## Docs + +[Read the public docs](https://marketing.adobe.com/resources/help/en_US/aam/dil-overview.html) diff --git a/dist/dil.js b/dist/dil.js new file mode 100644 index 0000000..d70653c --- /dev/null +++ b/dist/dil.js @@ -0,0 +1 @@ +!function(e){var t={};function r(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,r),s.l=!0,s.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)r.d(n,s,function(t){return e[t]}.bind(null,s));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";r.r(t);var n=function(e,t,r){var n="",s=t||"Error caught in DIL module/submodule: ";return e===Object(e)?n=s+(e.message||"err has no message"):(n=s+"err is not a valid object",e={}),e.message=n,r instanceof DIL&&(e.partner=r.api.getPartner()),DIL.errorModule.handleError(e),this.errorMessage=n,n},s={submitUniversalAnalytics:function(e,t,r){try{var n,s,i,a,o=e.getAll()[0],d=o[r||"b"].data.keys,u={};for(n=0,s=d.length;nthis.LIMIT));n++);this.errorMessage=h>1?"No errors - stuffing successful":"No valid values to stuff"}else this.errorMessage="Cookie name and value not found in json";if("function"==typeof this.callback)return this.callback()},submit:function(){try{var e=this;return""!==this.errorMessage?this.errorMessage:(this.dil.api.afterResult(function(t){e.process(t)}).submit(),"DIL.modules.GA.Stuffer.submit() successful")}catch(e){return this.handle(e,"DIL.modules.GA.Stuffer.submit() caught error with message ",this.dil)}}}},i={dil:null,handle:n,init:function(e,t,r,n){try{var s=this,i={name:"DIL Site Catalyst Module Error"},a=function(e){return i.message=e,DIL.errorModule.handleError(i),e};if(this.options=n===Object(n)?n:{},this.dil=null,!(t instanceof DIL))return a("dilInstance is not a valid instance of DIL");if(this.dil=t,i.partner=t.api.getPartner(),e!==Object(e))return a("siteCatalystReportingSuite is not an object");var o=e;return window.AppMeasurement_Module_DIL=o.m_DIL=function(e){var t="function"==typeof e.m_i?e.m_i("DIL"):this;if(t!==Object(t))return a("m is not an object");t.trackVars=s.constructTrackVars(r),t.d=0,t.s=e,t._t=function(){var e,t,r,n,i,o,d=this,u=","+d.trackVars+",",c=d.s,l=[],f=[],h={},p=!1;if(c!==Object(c))return a("Error in m._t function: s is not an object");if(d.d){if("function"==typeof c.foreachVar)c.foreachVar(function(e,t){void 0!==t&&(h[e]=t,p=!0)},d.trackVars);else{if(!(c.va_t instanceof Array))return a("Error in m._t function: s.va_t is not an array");if(c.lightProfileID?(e=c.lightTrackVars)&&(e=","+e+","+c.vl_mr+","):(c.pe||c.linkType)&&(e=c.linkTrackVars,c.pe&&c[t=c.pe.substring(0,1).toUpperCase()+c.pe.substring(1)]&&(e=c[t].trackVars),e&&(e=","+e+","+c.vl_l+","+c.vl_l2+",")),e){for(o=0,l=e.split(",");o=0&&f.push(l[o]);f.length&&(u=","+f.join(",")+",")}for(n=0,i=c.va_t.length;n=0&&void 0!==c[r]&&null!==c[r]&&""!==c[r]&&(h[r]=c[r],p=!0)}s.includeContextData(c,h).store_populated&&(p=!0),p&&d.d.api.signals(h,"c_").submit()}}},o.loadModule("DIL"),o.DIL.d=t,i.message?i.message:"DIL.modules.siteCatalyst.init() completed with no errors"}catch(e){return this.handle(e,"DIL.modules.siteCatalyst.init() caught error with message ",this.dil)}},constructTrackVars:function(e){var t,r,n,s,i,a,o,d,u=[];if(e===Object(e)){if((t=e.names)instanceof Array&&(s=t.length))for(n=0;n=0))for(o=0;o<=d;o++)u.push(i+o);if(u.length)return u.join(",")}return this.constructTrackVars({names:["pageName","channel","campaign","products","events","pe","pev1","pev2","pev3"],iteratedNames:[{name:"prop",maxIndex:75},{name:"eVar",maxIndex:250}]})},includeContextData:function(e,t){var r={},n=!1;if(e.contextData===Object(e.contextData)){var s,i,a,o,d,u=e.contextData,c=this.options.replaceContextDataPeriodsWith,l=this.options.filterFromContextVariables,f={};if("string"==typeof c&&c.length||(c="_"),l instanceof Array)for(s=0,i=l.length;s=0&&(t="")),t&&(s=0,I.push(t),t=""),(r=DIL.getDil(n,s))instanceof DIL&&r.api.getPartner()===n&&r.api.getContainerNSID()===s)return r;if(!(this instanceof DIL))return new DIL(e,"DIL was not instantiated with the 'new' operator, returning a valid instance with partner = "+n+" and containerNSID = "+s);DIL.registerDil(this,n,s);var _={IS_HTTPS:l||"https:"===document.location.protocol,SIX_MONTHS_IN_MINUTES:259200,IE_VERSION:function(){if(document.documentMode)return document.documentMode;for(var e=7;e>4;e--){var t=document.createElement("div");if(t.innerHTML="\x3c!--[if IE "+e+"]>'}");if((r=e.getInstance(t,{idSyncContainerID:s}))===Object(r)&&r instanceof e&&"function"==typeof r.isAllowed&&"function"==typeof r.getMarketingCloudVisitorID&&"function"==typeof r.getCustomerIDs&&"function"==typeof r.isOptedOut&&"function"==typeof r.publishDestinations)return this.VisitorAPI=e,r.isAllowed()?(this.instance=r,n=function(e){"VisitorAPI"!==o.releaseType&&(o.mid=e,o.releaseType="VisitorAPI",o.releaseRequests())},"string"==typeof(i=r.getMarketingCloudVisitorID(n))&&i.length?void n(i):void setTimeout(function(){"VisitorAPI"!==o.releaseType&&(o.releaseType="timeout",o.releaseRequests())},this.getLoadTimeout())):(this.releaseType="VisitorAPI is not allowed to write cookies",void this.releaseRequests());throw this.releaseType="invalid instance",a="Invalid Visitor instance.",r===Object(r)&&"function"!=typeof r.publishDestinations&&(a+=" In particular, visitorInstance.publishDestinations is not a function. This is needed to fire URL destinations in DIL v8.0+ and should be present in Visitor v3.3+ ."),new Error(a)}throw this.noVisitorAPI=!0,new Error("Visitor does not exist.")}catch(e){if(!y)throw new Error("Error in processing Visitor API, which is a hard dependency for DIL v8.0+: "+e.message);this.releaseRequests()}},releaseRequests:function(){this.calledBack=!0,O.registerRequest()},getMarketingCloudVisitorID:function(){return this.instance?this.instance.getMarketingCloudVisitorID():null},getMIDQueryString:function(){var e=P.isPopulatedString,t=this.getMarketingCloudVisitorID();return e(this.mid)&&this.mid===t||(this.mid=t),e(this.mid)?"d_mid="+this.mid+"&":""},getCustomerIDs:function(){return this.instance?this.instance.getCustomerIDs():null},getCustomerIDsQueryString:function(e){if(e===Object(e)){var t,r,n,s,i="",a=[],o=[];for(t in e)e.hasOwnProperty(t)&&(o[0]=t,(r=e[t])===Object(r)&&(o[1]=r.id||"",o[2]=r.authState||0,a.push(o),o=[]));if(s=a.length)for(n=0;n2048&&(d=d.substring(0,2048).substring(0,d.lastIndexOf("&"))),{corsSrc:o+"?_ts="+(new Date).getTime(),src:d,originalSrc:u,corsPostData:p+g+h,isDeclaredIdCall:""!==l}},fireRequest:function(e){if("img"===e.tag)this.fireImage(e);else{var t=O.declaredId,r=t.declaredId.request||t.declaredId.init||{},n={dpid:r.dpid||"",dpuuid:r.dpuuid||""};this.fireCORS(e,n)}},fireImage:function(e){var r,n,s=O;s.abortRequests||(s.firing=!0,r=new Image(0,0),s.sent.push(e),r.onload=function(){s.firing=!1,s.fired.push(e),s.num_of_img_responses++,s.registerRequest()},n=function(r){t="imgAbortOrErrorHandler received the event of type "+r.type,I.push(t),s.abortRequests=!0,s.firing=!1,s.errored.push(e),s.num_of_img_errors++,s.registerRequest()},r.addEventListener("error",n),r.addEventListener("abort",n),r.src=e.src)},fireCORS:function(e,r){var s=this,i=O,a=this.corsMetadata.corsType,o=e.corsSrc,d=e.corsInstance,u=e.corsPostData,c=e.postCallbackFn,l="function"==typeof c;if(!i.abortRequests&&!m){i.firing=!0;try{d.open("post",o,!0),"XMLHttpRequest"===a&&(d.withCredentials=!0,d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),d.onreadystatechange=function(){4===this.readyState&&200===this.status&&function(a){var o;try{if((o=JSON.parse(a))!==Object(o))return void s.handleCORSError(e,r,"Response is not JSON")}catch(t){return void s.handleCORSError(e,r,"Error parsing response as JSON")}try{var d=e.callbackFn;i.firing=!1,i.fired.push(e),i.num_of_cors_responses++,d(o,r),l&&c(o,r)}catch(e){e.message="DIL handleCORSResponse caught error with message "+e.message,t=e.message,I.push(t),e.filename=e.filename||"dil.js",e.partner=n,DIL.errorModule.handleError(e);try{d({error:e.name+"|"+e.message},r),l&&c({error:e.name+"|"+e.message},r)}catch(e){}}finally{i.registerRequest()}}(this.responseText)}),d.onerror=function(){s.handleCORSError(e,r,"onerror")},d.ontimeout=function(){s.handleCORSError(e,r,"ontimeout")},d.send(u)}catch(t){this.handleCORSError(e,r,"try-catch")}i.sent.push(e),i.declaredId.declaredId.request=null}},handleCORSError:function(e,t,r){O.num_of_cors_errors++,O.corsErrorSources.push(r)},handleRequestError:function(e,t){var r=O;I.push(e),r.abortRequests=!0,r.firing=!1,r.errored.push(t),r.registerRequest()}},P={isValidPdata:function(e){return!!(e instanceof Array&&this.removeEmptyArrayValues(e).length)},isValidLogdata:function(e){return!this.isEmptyObject(e)},isEmptyObject:function(e){if(e!==Object(e))return!0;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0},removeEmptyArrayValues:function(e){var t,r=0,n=e.length,s=[];for(r=0;r