diff --git a/dist/dil.js b/dist/dil.js index 9ee3d32..580ad03 100644 --- a/dist/dil.js +++ b/dist/dil.js @@ -1 +1 @@ -!function(){"use strict";function e(e,t,s){var n="",i=t||"Error caught in DIL module/submodule: ";return e===Object(e)?n=i+(e.message||"err has no message"):(n=i+"err is not a valid object",e={}),e.message=n,s instanceof DIL&&(e.partner=s.api.getPartner()),DIL.errorModule.handleError(e),this.errorMessage=n}var r,a,o,t={submitUniversalAnalytics:function(e,t,s){try{var n,i,r,a,o=e.getAll()[0],d=o[s||"b"].data.keys,u={};for(n=0,i=d.length;nthis.LIMIT));n++);this.errorMessage=1'}");if(!((s=e.getInstance(t,{idSyncContainerID:r}))===Object(s)&&s instanceof e&&"function"==typeof s.isAllowed&&"function"==typeof s.getMarketingCloudVisitorID&&"function"==typeof s.getCustomerIDs&&"function"==typeof s.isOptedOut&&"function"==typeof s.publishDestinations))throw this.releaseType="invalid instance",n="Invalid Visitor instance.",s===Object(s)&&"function"!=typeof s.publishDestinations&&(n+=" 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(n);if(this.VisitorAPI=e,!s.isAllowed())return this.releaseType="VisitorAPI is not allowed to write cookies",void this.releaseRequests();this.instance=s,this.waitForMidToReleaseRequests()}catch(e){if(!m)throw new Error("Error in processing Visitor API, which is a hard dependency for DIL v8.0+: "+e.message);this.releaseRequests()}},waitForMidToReleaseRequests:function(){var t=this;this.instance&&(this.instance.getMarketingCloudVisitorID(function(e){t.mid=e,t.releaseType="VisitorAPI",t.releaseRequests()},!0),(!j.exists||!j.isIabContext&&j.isApproved()||j.isIabContext&&x.hasGoSignal())&&setTimeout(function(){"VisitorAPI"!==t.releaseType&&(t.releaseType="timeout",t.releaseRequests())},this.getLoadTimeout()))},releaseRequests:function(){this.calledBack=!0,C.registerRequest()},getMarketingCloudVisitorID:function(){return this.instance?this.instance.getMarketingCloudVisitorID():null},getMIDQueryString:function(){var e=T.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))return"";var t,s,n,i,r="",a=[],o=[];for(t in e)e.hasOwnProperty(t)&&(s=e[o[0]=t])===Object(s)&&(o[1]=s.id||"",o[2]=s.authState||0,a.push(o),o=[]);if(i=a.length)for(n=0;n 1"):void 0},getPublishDestinationsVersion:function(){if(null!==this.publishDestinationsVersion)return this.publishDestinationsVersion;var e=C.adms.instance,t=-1;return e&&"function"==typeof e.publishDestinations&&(3===e.publishDestinations.length?t=1:1===e.publishDestinations.length&&(t=2)),this.publishDestinationsVersion=t}},R={traits:function(e){return T.isValidPdata(e)&&(O.sids instanceof Array||(O.sids=[]),E.extendArray(O.sids,e)),this},pixels:function(e){return T.isValidPdata(e)&&(O.pdata instanceof Array||(O.pdata=[]),E.extendArray(O.pdata,e)),this},logs:function(e){return T.isValidLogdata(e)&&(O.logdata!==Object(O.logdata)&&(O.logdata={}),E.extendObject(O.logdata,e)),this},customQueryParams:function(e){return T.isEmptyObject(e)||E.extendObject(O,e,C.reservedKeys),this},signals:function(e,t){var s,n=e;if(!T.isEmptyObject(n)){if(t&&"string"==typeof t)for(s in n={},e)e.hasOwnProperty(s)&&(n[t+s]=e[s]);E.extendObject(O,n,C.reservedKeys)}return this},declaredId:function(e){return C.declaredId.setDeclaredId(e,"request"),this},result:function(e){return"function"==typeof e&&(O.callback=e),this},afterResult:function(e){return"function"==typeof e&&(O.postCallbackFn=e),this},useImageRequest:function(){return O.useImageRequest=!0,this},clearData:function(){return O={},this},submit:function(e){return O.isDefaultRequest=!!e,P.submitRequest(O),O={},this},getPartner:function(){return I},getContainerNSID:function(){return r},getEventLog:function(){return y},getState:function(){var e={},t={};return E.extendObject(e,C,{registerRequest:!0}),E.extendObject(t,A,{requestToProcess:!0,process:!0,sendMessages:!0}),{initConfig:s,pendingRequest:O,otherRequestInfo:e,destinationPublishingInfo:t,log:y}},idSync:function(){throw new Error("Please use the `idSyncByURL` method of the Experience Cloud ID Service (Visitor) instance")},aamIdSync:function(){throw new Error("Please use the `idSyncByDataSource` method of the Experience Cloud ID Service (Visitor) instance")},passData:function(e){return T.isEmptyObject(e)?"Error: json is empty or not an object":(P.defaultCallback(e),e)},getPlatformParams:function(){return C.platformParams},getEventCallConfigParams:function(){var e,t=C,s=t.modStatsParams,n=t.platformParams;if(!s){for(e in s={},n)n.hasOwnProperty(e)&&!t.nonModStatsParams[e]&&(s[e.replace(/^d_/,"")]=n[e]);!0===d?s.coop_safe=1:!1===d&&(s.coop_unsafe=1),t.modStatsParams=s}return s},setAsCoopSafe:function(){return d=!0,this},setAsCoopUnsafe:function(){return d=!1,this},getEventCallIabSignals:function(e){var t;return e!==Object(e)?"Error: config is not an object":"function"!=typeof e.callback?"Error: config.callback is not a function":(t=parseInt(e.timeout,10),isNaN(t)&&(t=null),void x.getQueryStringObject(e.callback,t))}},P={corsMetadata:(w="none","undefined"!=typeof XMLHttpRequest&&XMLHttpRequest===Object(XMLHttpRequest)&&"withCredentials"in new XMLHttpRequest&&(w="XMLHttpRequest"),{corsType:w}),getCORSInstance:function(){return"none"===this.corsMetadata.corsType?null:new window[this.corsMetadata.corsType]},submitRequest:function(e){return C.registerRequest(P.createQueuedRequest(e)),!0},createQueuedRequest:function(e){var t,s,n,i,r,a=e.callback,o="img",d=e.isDefaultRequest;if(delete e.isDefaultRequest,!T.isEmptyObject(u))for(n in u)if(u.hasOwnProperty(n)){if(null==(i=u[n])||""===i)continue;if(n in e&&!(i in e)&&!(i in C.reservedKeys)){if(null==(r=e[n])||""===r)continue;e[i]=r}}return T.isValidPdata(e.sids)||(e.sids=[]),T.isValidPdata(e.pdata)||(e.pdata=[]),T.isValidLogdata(e.logdata)||(e.logdata={}),e.logdataArray=E.convertObjectToKeyValuePairs(e.logdata,"=",!0),e.logdataArray.push("_ts="+(new Date).getTime()),"function"!=typeof a&&(a=this.defaultCallback),t=this.makeRequestSrcData(e),(s=this.getCORSInstance())&&!0!==e.useImageRequest&&(o="cors"),{tag:o,src:t.src,corsSrc:t.corsSrc,callbackFn:a,postCallbackFn:e.postCallbackFn,useImageRequest:!!e.useImageRequest,requestData:e,corsInstance:s,corsPostData:t.corsPostData,isDefaultRequest:d}},defaultCallback:function(e,t){var s,n,i,r,a,o,d,u,c;if((s=e.stuff)&&s instanceof Array&&(n=s.length))for(i=0;ithis.LIMIT));n++);this.errorMessage=1'}");if(!((s=e.getInstance(t,{idSyncContainerID:r}))===Object(s)&&s instanceof e&&"function"==typeof s.isAllowed&&"function"==typeof s.getMarketingCloudVisitorID&&"function"==typeof s.getCustomerIDs&&"function"==typeof s.isOptedOut&&"function"==typeof s.publishDestinations))throw this.releaseType="invalid instance",n="Invalid Visitor instance.",s===Object(s)&&"function"!=typeof s.publishDestinations&&(n+=" 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.0+ ."),new Error(n);if(this.VisitorAPI=e,!s.isAllowed())return this.releaseType="VisitorAPI is not allowed to write cookies",void this.releaseRequests();this.instance=s,this.waitForMidToReleaseRequests()}catch(e){if(!m)throw new Error("Error in processing Visitor API, which is a hard dependency for DIL v8.0+: "+e.message);this.releaseRequests()}},waitForMidToReleaseRequests:function(){var t=this;this.instance&&(this.instance.getMarketingCloudVisitorID(function(e){t.mid=e,t.releaseType="VisitorAPI",t.releaseRequests()},!0),(!k.exists||!k.isIabContext&&k.isApproved()||k.isIabContext&&N.hasGoSignal())&&setTimeout(function(){"VisitorAPI"!==t.releaseType&&(t.releaseType="timeout",t.releaseRequests())},this.getLoadTimeout()))},releaseRequests:function(){this.calledBack=!0,w.registerRequest()},getMarketingCloudVisitorID:function(){return this.instance?this.instance.getMarketingCloudVisitorID():null},getMIDQueryString:function(){var e=E.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))return"";var t,s,n,i,r="",a=[],o=[];for(t in e)e.hasOwnProperty(t)&&(s=e[o[0]=t])===Object(s)&&(o[1]=s.id||"",o[2]=s.authState||0,a.push(o),o=[]);if(i=a.length)for(n=0;n 1"):void 0},getPublishDestinationsVersion:function(){if(null!==this.publishDestinationsVersion)return this.publishDestinationsVersion;var e=w.adms.instance,s=-1;return e.publishDestinations(null,null,function(e){if(e===Object(e)){var t=e.error;"subdomain is not a populated string."===t?s=1:"Invalid parameters passed."===t&&(s=2)}}),this.publishDestinationsVersion=s}},R={traits:function(e){return E.isValidPdata(e)&&(C.sids instanceof Array||(C.sids=[]),j.extendArray(C.sids,e)),this},pixels:function(e){return E.isValidPdata(e)&&(C.pdata instanceof Array||(C.pdata=[]),j.extendArray(C.pdata,e)),this},logs:function(e){return E.isValidLogdata(e)&&(C.logdata!==Object(C.logdata)&&(C.logdata={}),j.extendObject(C.logdata,e)),this},customQueryParams:function(e){return E.isEmptyObject(e)||j.extendObject(C,e,w.reservedKeys),this},signals:function(e,t){var s,n=e;if(!E.isEmptyObject(n)){if(t&&"string"==typeof t)for(s in n={},e)e.hasOwnProperty(s)&&(n[t+s]=e[s]);j.extendObject(C,n,w.reservedKeys)}return this},declaredId:function(e){return w.declaredId.setDeclaredId(e,"request"),this},result:function(e){return"function"==typeof e&&(C.callback=e),this},afterResult:function(e){return"function"==typeof e&&(C.postCallbackFn=e),this},useImageRequest:function(){return C.useImageRequest=!0,this},clearData:function(){return C={},this},submit:function(e){return C.isDefaultRequest=!!e,T.submitRequest(C),C={},this},getPartner:function(){return I},getContainerNSID:function(){return r},getEventLog:function(){return b},getState:function(){var e={},t={};return j.extendObject(e,w,{registerRequest:!0}),j.extendObject(t,P,{requestToProcess:!0,process:!0,sendMessages:!0}),{initConfig:s,pendingRequest:C,otherRequestInfo:e,destinationPublishingInfo:t,log:b}},idSync:function(){throw new Error("Please use the `idSyncByURL` method of the Experience Cloud ID Service (Visitor) instance")},aamIdSync:function(){throw new Error("Please use the `idSyncByDataSource` method of the Experience Cloud ID Service (Visitor) instance")},passData:function(e){return E.isEmptyObject(e)?"Error: json is empty or not an object":(T.defaultCallback(e),e)},getPlatformParams:function(){return w.platformParams},getEventCallConfigParams:function(){var e,t=w,s=t.modStatsParams,n=t.platformParams;if(!s){for(e in s={},n)n.hasOwnProperty(e)&&!t.nonModStatsParams[e]&&(s[e.replace(/^d_/,"")]=n[e]);!0===d?s.coop_safe=1:!1===d&&(s.coop_unsafe=1),t.modStatsParams=s}return s},setAsCoopSafe:function(){return d=!0,this},setAsCoopUnsafe:function(){return d=!1,this},getEventCallIabSignals:function(e){var t;return e!==Object(e)?"Error: config is not an object":"function"!=typeof e.callback?"Error: config.callback is not a function":(t=parseInt(e.timeout,10),isNaN(t)&&(t=null),void N.getQueryStringObject(e.callback,t))}},T={corsMetadata:(L="none","undefined"!=typeof XMLHttpRequest&&XMLHttpRequest===Object(XMLHttpRequest)&&"withCredentials"in new XMLHttpRequest&&(L="XMLHttpRequest"),{corsType:L}),getCORSInstance:function(){return"none"===this.corsMetadata.corsType?null:new window[this.corsMetadata.corsType]},submitRequest:function(e){return w.registerRequest(T.createQueuedRequest(e)),!0},createQueuedRequest:function(e){var t,s,n,i,r,a=e.callback,o="img",d=e.isDefaultRequest;if(delete e.isDefaultRequest,!E.isEmptyObject(u))for(n in u)if(u.hasOwnProperty(n)){if(null==(i=u[n])||""===i)continue;if(n in e&&!(i in e)&&!(i in w.reservedKeys)){if(null==(r=e[n])||""===r)continue;e[i]=r}}return E.isValidPdata(e.sids)||(e.sids=[]),E.isValidPdata(e.pdata)||(e.pdata=[]),E.isValidLogdata(e.logdata)||(e.logdata={}),e.logdataArray=j.convertObjectToKeyValuePairs(e.logdata,"=",!0),e.logdataArray.push("_ts="+(new Date).getTime()),"function"!=typeof a&&(a=this.defaultCallback),t=this.makeRequestSrcData(e),(s=this.getCORSInstance())&&!0!==e.useImageRequest&&(o="cors"),{tag:o,src:t.src,corsSrc:t.corsSrc,callbackFn:a,postCallbackFn:e.postCallbackFn,useImageRequest:!!e.useImageRequest,requestData:e,corsInstance:s,corsPostData:t.corsPostData,isDefaultRequest:d}},defaultCallback:function(e,t){var s,n,i,r,a,o,d,u,c;if((s=e.stuff)&&s instanceof Array&&(n=s.length))for(i=0;i